Jump to content

blog snippet; newbie!


rosscoism

Recommended Posts

Hi everyone,

Now this is my first post so please bare with me.

What i am currently trying to do is I have designed a friends website (great place to start.)

 

What I have got is a static page site www.creativerelease.co.nz/lines.php

and what I would like to have happen is a section (the sidebar) to automatically up date with text and images (if possible) from the portfolio page (a blogspot blog).

 

 

Now I feel like a bit of a doush with not even having an attempt at the code but I have no idea where to start. 

 

any comments? ideas? suggestion?

Thanks In advance

Link to comment
Share on other sites

I'm guessing this portfolio page is hosted elsewhere? If that's the case, you should be able to call fopen or some kind of cURL call to "download" the page on to your site (once a day / week / month, depending on how often the portfolio is updated) and re-work the HTML (using explode() or split() calls etc.) so it will display nicely in your page. I'm not well versed in fopen or cURL, but using file_get _contents might look like this:

 

function downloadAndDisplay() {
    $data = file_get_contents("http://www.example.com/profile.php");
    $links = explode("</div><div class='links'>", $data);
    $images = explode("</div><div class='image'>", $data);
    foreach($data as $arr) {
        echo $data, "<br />", $links;
    }
}

 

Make sure you have permission to fopen / file_get_contents / cURL external files. See http://au2.php.net/manual/en/wrappers.http.php for more info on this.

 

But if the page is hosted locally, you could just include the file:

 

include("portfolio/portfoliopage.php");

 

or convert the portfolio page to dynamic, so when the user adds a new portfolio piece, a table in the database is created. Then you can just 'SELECT link, image FROM tblPortfolio WHERE id='32'' and output it as you wish.

 

Hope this helps? A good book on PHP + MySQL or some of the tutorials on this site should help you out if you're unsure about databases

Link to comment
Share on other sites

You're welcome! And I need to add a correction to my last post. In my explanation of the database side of things, it should read:

 

so when the user adds a new portfolio piece, a ROW in the TABLE is created

 

instead of:

 

so when the user adds a new portfolio piece, a table in the database is created

 

I was at work, busy with another project soI didn't have time to think ;)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.