rosscoism Posted September 8, 2009 Share Posted September 8, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/173602-blog-snippet-newbie/ Share on other sites More sharing options...
Grayda Posted September 10, 2009 Share Posted September 10, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/173602-blog-snippet-newbie/#findComment-915774 Share on other sites More sharing options...
rosscoism Posted September 11, 2009 Author Share Posted September 11, 2009 thanks Grayda! I need to have a play with this and will let you know how I get on. Thank you again. Quote Link to comment https://forums.phpfreaks.com/topic/173602-blog-snippet-newbie/#findComment-916440 Share on other sites More sharing options...
Grayda Posted September 16, 2009 Share Posted September 16, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/173602-blog-snippet-newbie/#findComment-919806 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.