Jump to content

[SOLVED] Displaying XML List in php page


jonahpup

Recommended Posts

Hi there...

 

I have the following xml list

 

<publications>
<pub>
	<date>November 2007</date>
	<location>/pubs/nov07.pdf</location>
</pub>

<pub>
	<date>October 2007</date>
	<location>/pubs/oct07.pdf</location>
</pub>

<pub>
	<date>September 2007</date>
	<location>/pubs/sep07.pdf</location>
</pub>

<pub>
	<date>August 2007</date>
	<location>/pubs/aug07.pdf</location>
</pub>

</publications>

 

What I am wanting to do is display only the current month, and the previous month, as a hyperlink on my page. 

 

I have no idea how to use xml in php.  Can someone help me please??

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/80210-solved-displaying-xml-list-in-php-page/
Share on other sites

  • 3 weeks later...

Study this, it'll help

 

$xml = new SimpleXMLElement(file_get_contents("http://services.hotornot.com/rss/girls/"));

foreach($xml->channel->item as $item) {
$picture = $item->title;
$link = $item->link;
$description = $item->description;

print "<div class=\"person\">";

print "<div class=\"picture\">";
print "<a href='".$link."' target=\"new\">".$picture."</a>";
print "</div>";

print "<div class=\"personInfo\">";
print "<p>" . $description . "</p>";
print "</div>";

print "</div>";
}

 

Cheers  ;D

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.