Pixelpost

Authentic Photoblog Flavour


Go Back   Pixelpost Forum > DEVELOPMENT > Addons

Post Reply
 
Thread Tools
  #1  
Old 12-20-2007, 05:43 PM
arpana Offline
forum loafer
 
Join Date: Dec 2007
Posts: 4
A little PHP help please

Hi all,

I am using the songs.php plugin but would like to ammend how the song information is output. As it stands it just outputs in a continuous line, I would like to make it output as an unordered list.

I have virtually no PHP experience although I have (somehow) managed to work out where the <ul></ul> goes but unsure how to add the <li></li>, can anyone offer any guidance please?

Here is the code:

PHP Code:
// Try to load and parse RSS file 
// [url]http://www.techie-blog.com/rss.php?blogId=1&profile=rss090[/url]
// [url]http://ws.audioscrobbler.com/rss/recent.php?user=name_here[/url]
if ($rs $rss->Get('http://ws.audioscrobbler.com/rss/recent.php?user=name_here'10)) { 
    
// Show last published articles (title, link, description) 
    
$ctr 1;
    foreach(
$rs['items'] as $item) { 
        
// formatting
        
$html .= "$ctr) "
        
        
$html .= $item['title'];
        
        
// formatting
        
$html .= "&nbsp;&nbsp;//&nbsp;&nbsp;"
        
$ctr++;
    } 

    
// strip the last slashes
    
$html ereg_replace("//&nbsp;&nbsp;$"""$html);

    if (!
$html$html "Sorry - I've not got any recently played songs - come back soon.";
    
    
$tpl ereg_replace("<MY_SONGS>","<ul class=\"pp-songs\">\n".$html."</ul>\n",$tpl);

else { 
    
$tpl ereg_replace("<MY_SONGS>","Sorry - either I've not listened to any songs recently, or there's trouble collecting the feed of songs over the Net, either way, there's nought to be seen here.\n",$tpl); 

Thanks
Arpi

Last edited by GeoS; 12-20-2007 at 09:37 PM. Reason: Use
Reply With Quote
  #2  
Old 12-20-2007, 06:10 PM
dakwegmo's Avatar
dakwegmo+ Offline
Team Pixelpost
 
Join Date: Jul 2005
Location: West of Between
Posts: 689
Try changing this line:
PHP Code:
$html .= $item['title']; 
To this:
PHP Code:
$html .= "<li>" $item['title'] . "</li>"
__________________
My Photoblog
If you find my help useful please consider feeding the PixelPost Kitty
If you're short on cash just feed my ego
Reply With Quote
  #3  
Old 12-20-2007, 06:23 PM
arpana Offline
forum loafer
 
Join Date: Dec 2007
Posts: 4
Darn, that didn't work. Thanks anyway
Reply With Quote
  #4  
Old 12-20-2007, 07:07 PM
dakwegmo's Avatar
dakwegmo+ Offline
Team Pixelpost
 
Join Date: Jul 2005
Location: West of Between
Posts: 689
Try this:
PHP Code:
// Try to load and parse RSS file
// http://www.techie-blog.com/rss.php?b...profile=rss090
// http://ws.audioscrobbler.com/rss/rec...user=name_here
if ($rs $rss->Get('http://ws.audioscrobbler.com/rss/recent.php?user=name_here'10)) {
// Show last published articles (title, link, description)

foreach($rs['items'] as $item) {
// formatting
$html .= "<li>";

$html .= $item['title'];

// formatting
$html .= "</li>\n";

}


if (!
$html$html "Sorry - I've not got any recently played songs - come back soon.";

$tpl ereg_replace("<MY_SONGS>","<ul class=\"pp-songs\">\n".$html."</ul>\n",$tpl);
}
else {
$tpl ereg_replace("<MY_SONGS>","Sorry - either I've not listened to any songs recently, or there's trouble collecting the feed of songs over the Net, either way, there's nought to be seen here.\n",$tpl);

Sorry I can't test this, I don't have a feed that works. If you have a feed that I can use to test I would be able to make sure it works before posting.
__________________
My Photoblog
If you find my help useful please consider feeding the PixelPost Kitty
If you're short on cash just feed my ego
Reply With Quote
  #5  
Old 12-20-2007, 07:13 PM
arpana Offline
forum loafer
 
Join Date: Dec 2007
Posts: 4
Hey, that code did the trick

You are a shining star, thank you so much

The whole script is here: http://www.pixelpost.org/extend/addons/songs/

Arpy
Reply With Quote
  #6  
Old 12-20-2007, 07:21 PM
dakwegmo's Avatar
dakwegmo+ Offline
Team Pixelpost
 
Join Date: Jul 2005
Location: West of Between
Posts: 689
I just tested that last bit of code and it works.
__________________
My Photoblog
If you find my help useful please consider feeding the PixelPost Kitty
If you're short on cash just feed my ego
Reply With Quote
Post Reply


Thread Tools




All times are GMT. The time now is 09:44 AM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. | Style Design: d3 designs