jojogingerhead
09 Jun 2010, 05:41 AM
I have an ap div on my new site that has php code in to get my rss feed from my blogger blog to include in a section on the right hand side of every page my site, so it updates automatically every itme I blog on blogger. (Apologies if I am describing this badly I am really new to website design and this is my first ever site!)
It currently looks really wordy and i was wondering if there was anyway more php code could be added to include a thumbnail of the first image i use on each blog post, also if this is possible is there any way we could control the size of the thumbnail image so it is not huge?
My site is gingerhead.co.uk
And the php code from the div:
<div id="blog">
<style type="text/css">
/* NEED TO DO THIS AS IMAGES IN THE FEED ARE TOO WIDE FOR THE RIGHT HAND COL ON YOUR SITE */
#blog img {display:none;}
</style>
<?php
$i=0;
$URL="jojogingerhead.blogspot.com/feeds/posts/default?alt=rss";
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
$txt=curl_exec($ch);
curl_close($ch);
$rss = new SimpleXMLElement($txt);
// set value to 8 - limit number of posts being pulled
foreach ($rss->channel->item as $item)
{
$i++;
print "<h4><a href='" . $item->link . "'>" . $item->title . "</a></h4>\n";
if ($i>=8) break;
}
?>
<h3><a href="http://jojogingerhead.blogspot.com/"></a></h3>
</div>
It currently looks really wordy and i was wondering if there was anyway more php code could be added to include a thumbnail of the first image i use on each blog post, also if this is possible is there any way we could control the size of the thumbnail image so it is not huge?
My site is gingerhead.co.uk
And the php code from the div:
<div id="blog">
<style type="text/css">
/* NEED TO DO THIS AS IMAGES IN THE FEED ARE TOO WIDE FOR THE RIGHT HAND COL ON YOUR SITE */
#blog img {display:none;}
</style>
<?php
$i=0;
$URL="jojogingerhead.blogspot.com/feeds/posts/default?alt=rss";
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
$txt=curl_exec($ch);
curl_close($ch);
$rss = new SimpleXMLElement($txt);
// set value to 8 - limit number of posts being pulled
foreach ($rss->channel->item as $item)
{
$i++;
print "<h4><a href='" . $item->link . "'>" . $item->title . "</a></h4>\n";
if ($i>=8) break;
}
?>
<h3><a href="http://jojogingerhead.blogspot.com/"></a></h3>
</div>