Saturday, 26 February 2011

Producing individual Divs for each twitter update and photo

This shows produces an individual div for each element taken from the RSS file :





   Show RSS Document 




channel->item as $photoitem) {
	if($photocounter < 6){
	    $photocounter=$photocounter+1;
}  
	//loads rss feed variable of the image, concatination used to add a counter e.g. 1,2,3... to each photo so that they can be individually edited - using css ID, however had to apply ID to the image source not ID for css styles to work
	print "

"; print "
"; // if the counter reaches 6, break the function, meaning that it will only display 6 photos in total from the RSS feed. if($photocounter==6){ break; } } foreach ($twitterxml->channel->item as $twitteritem) { /*loads rss feed of the twitter same proccess as above, but different paremeters have been used in the CSS stylesheet for each individual twitter update. however unlike the photos above div id is added to the div */ print "
$twitteritem->title
"; print "
"; if($twittercounter < 6){ $twittercounter=$twittercounter+1; if($twittercounter==6){ break; } } } ?>

Friday, 25 February 2011

Update: what to do next

I now have to work out how to split individual parts of the RSS feed into div tags rather than them all displaying in one division, therefore enabling me to place each twitter and photo feed where I want on the place, and are able to customize each image as I want using CSS styles.

1) I have to use concatination - joining two strings together
2) Using an array function
2) Using a for each function to display individual divisions for each element of the XML file
4) Using a counter to plus 1 to each image, so that they have individual class names e.g. 'photo1' 'photo2'
5 Putting a break function in so that it only displays this for a set amount of photos/twitter feeds.

Wednesday, 23 February 2011

PHP Parsing Photobucket

Here is the Photobucket feed which is being parsed:





   Show RSS Document 




 and 
  • functions
    print "
      \n"; foreach ($twitterxml->channel->item as $twitteritem) { print "
    • $twitteritem->title
    • \n"; } print "
    ";
    print "

    ";
    print "
      \n"; foreach ($photoxml->channel->item as $photoitem) { //loads tss feed variable of the image and and img tags display as a jpeg, also resizing the images as thumbnails print "\n"; } print "
    ";
    ?>









  • And the HTML that is produced:

    
    
    
       Show RSS Document 
    
    
    
    
    
    • ches_cat: about to go off to uni... time for some film philosophy
    • ches_cat: is about to get started on this essssayyyyyyyyy!
    • ches_cat: yooooo
    • ches_cat: also sopranos what an awesome show! where has it been all my life?
    • ches_cat: is about to sleep
      lots to think about - dissertation, my web project and a philosophy exam! But was happy to get a 69 for his exam!!
    • ches_cat: yo
    • ches_cat: hello
    • ches_cat: hi
    • ches_cat: i am sitting in the su with ant, marta and aggi
    • ches_cat: enjoyed misfits. whos the masked dude??
    • ches_cat: doesn't like gin anymore :'(
    • ches_cat: loved 'how to train your dragon' ace animation!
    • ches_cat: whos watching?
    • ches_cat: has just finished his second run of the week, a bit hard this time. getting cold.
    • ches_cat: is going to have a cup of tea with nem. woop.
    • ches_cat: is feeling a lot better. roll on game studies presentation.
    • ches_cat: is feeling ill :(
    • ches_cat: has just been on a run, feels energized!!!
    • ches_cat: is ready to start the week! still slightly hung-over though.
    • ches_cat: is hungovvvver


    Using PHP to Parse external RSS file.

    I have written a basic script to parse RSS, at the moment it parses a external twitter RSS:
    PHP:
    
    
    
       Show RSS Document 
    
    
    
     and
    
  • functions
    print "
      \n"; foreach ($twitterxml->channel->item as $twitteritem) { print "
    • $twitteritem->title
    • \n"; } print "
    ";

    ?>




  • HTML Produced, putting the twitter feed into a list, this can not be customized using CSS styles:
    
    
    
       Show RSS Document 
    
    
    
    
    • ches_cat: about to go off to uni... time for some film philosophy
    • ches_cat: is about to get started on this essssayyyyyyyyy!
    • ches_cat: yooooo
    • ches_cat: also sopranos what an awesome show! where has it been all my life?
    • ches_cat: is about to sleep
      lots to think about - dissertation, my web project and a philosophy exam! But was happy to get a 69 for his exam!!
    • ches_cat: yo
    • ches_cat: hello
    • ches_cat: hi
    • ches_cat: i am sitting in the su with ant, marta and aggi
    • ches_cat: enjoyed misfits. whos the masked dude??
    • ches_cat: doesn't like gin anymore :'(
    • ches_cat: loved 'how to train your dragon' ace animation!
    • ches_cat: whos watching?
    • ches_cat: has just finished his second run of the week, a bit hard this time. getting cold.
    • ches_cat: is going to have a cup of tea with nem. woop.
    • ches_cat: is feeling a lot better. roll on game studies presentation.
    • ches_cat: is feeling ill :(
    • ches_cat: has just been on a run, feels energized!!!
    • ches_cat: is ready to start the week! still slightly hung-over though.
    • ches_cat: is hungovvvver

    Next step is to interlink two RSS files, one twitter feed, and then one image.

    Friday, 18 February 2011

    Testing PHP Continued

    Some of the functions I have been learning for loops, arrays, if statements:

    What to do next: Parsing RSS/XML files through similiar functions as to bellow using variables from the RSS file:
    = 0){
     echo "
    counter is zero or greater
    "; } else{ echo "
    counter is less than zero
    "; } //this is a test for a loop, in whicch it adds one to the counter untill it reaches four while($counter < 4){ $counter=$counter+1; echo "
    I now have $counter bits of paper
    "; if ($counter == 2){ echo "
    "; } } //this is a test for displaying an image depending on the time, if after 6pm display a night image, if not display a day image if ($current_time >= 18){ echo "
    "; } else{ echo "
    "; } //printing an element in an array in this case $food //echo $food[1]; //echo $food[$foodarraycounter]; while($foodarraycounter<4){ //echo $food[$foodarraycounter]; if($food[$foodarraycounter]=="soup"){ //echo "working"; echo "
    "; } // if the food array counter corresponds to orange print the image if($food[$foodarraycounter]=="orange"){ echo "
    "; } // this is the loop function in which it pluses one untill it reaches the parameters of the if statement and prints the corresponding image $foodarraycounter=$foodarraycounter+1; } ?>

    Tuesday, 15 February 2011

    Getting the hang of PHP

    At the moment reading a PHP beginners book to get familiar with the coding,

    Simple things such as starting with <?php and ending with ?> - functions, print/echo, comments are useful and to indicate a comment use // or to block out a whole section of php /* SELECTION /*, as well as strings which are situated with 'hello' ...

    Saturday, 12 February 2011

    Iframe GoogleMaps

    Googlemaps displayed as an Iframe:


    Thursday, 10 February 2011

    Update


    I have managed to using a combination of PHP and CSS to display the RSS FEEDS in a Loop in Blocks, however I now need to figure out how I can seperate each element of the RSS Feed so for example display 1) Twitter Feed and 2) An Image, and so on, in which I can choose where to put these different individual elements on the page, rather than them being seperated into blocks and loops as is in the current PHP script as well as CSS layout

    Also I need to find out a way to display all the co-ordinates of my GEORSS Feed as a map, and possibly display it as a background or a Iframe on the back of my website.

    Here is the html document for the website displayed in the image above:

    
    
    
    
    Loading directly an RSS feed and displaying it
    
    	
    
    
    
    
    

    Tuesday, 8 February 2011

    Problems to resolve...

    RSS Feed reader only displays the latest 5 feeds (and this is because the XML filed do not hold the entire history of the feed, but only the latest) - need to find how I can display more.

    The GEO RSS feed is not compatible with the PHP RSS reader used at the moment - need to find a way to display this alongside the normal RSS Feeds.

    As suggested bellow the problem is that the RSS Reader PHP code cannot proccess the feed.

    Wednesday, 2 February 2011

    GEORSS!

    I have located the RSS for my location feed off blogloc, when I open up the XML file I am displayed with the following:
    The XML Format Looks as follows:
    
      chesterloffman's current location
      
      Powered by blogloc
      
        2010/11/14 Bristol, UK
        
        
          
        
        2010-11-14T18:17:40Z
        2010-11-14T18:17:40Z
        <p>&quot;is back at home XD&quot;</p><p>Latitude: 51.4815691<br/>Longitude: -2.5269726<br/>Bristol, UK<br/>Updated at: 2010/11/14, 18:17 local time (GMT +0:00)<p><strong>Updated via Web</strong></p><p><img src="http://maps.google.com/staticmap?center=51.4815691,-2.5269726&zoom=12&size=160x120&markers=51.4815691,-2.5269726&key=ABQIAAAAhScxmuV3ybzUgUXK5Hrc6BTKuGVEvWvsT_m2CQTZIH6fKg8lshThBPnuBALSdRec6dW8KOGn_XZwtw" /><br/><a href="http://maps.google.com/maps?q=51.4815691,-2.5269726&z=12">View larger map...</a></p>
        2010-11-14T18:17:40Z
        51.4815691 -2.5269726
      
    
    
    
    However when trying to parse it through the RSS reader it does not display - I need to find a way to be able to display it - this is probably because it has different elements such as <georss: point>