jonahpup Posted December 5, 2007 Share Posted December 5, 2007 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?? Quote Link to comment https://forums.phpfreaks.com/topic/80210-solved-displaying-xml-list-in-php-page/ Share on other sites More sharing options...
Crew-Portal Posted December 7, 2007 Share Posted December 7, 2007 For something as easy as that dont use XML PHP is great for date functions. Try the PHP forum for more details on how to do this type of stuff.. Quote Link to comment https://forums.phpfreaks.com/topic/80210-solved-displaying-xml-list-in-php-page/#findComment-409357 Share on other sites More sharing options...
shlumph Posted December 26, 2007 Share Posted December 26, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/80210-solved-displaying-xml-list-in-php-page/#findComment-423171 Share on other sites More sharing options...
jonahpup Posted December 26, 2007 Author Share Posted December 26, 2007 Hey... cool... thanks for that... the only problem I have is my hosting server doesnt support php5 and therefore doesn't support SimpleXMLElement... is there any alternative way of doing this in php4?? Quote Link to comment https://forums.phpfreaks.com/topic/80210-solved-displaying-xml-list-in-php-page/#findComment-423708 Share on other sites More sharing options...
Daniel0 Posted December 28, 2007 Share Posted December 28, 2007 XML support sucks in PHP 4. I'd say get your host to upgrade or find a better host. If they haven't upgraded by now they aren't worth using IMO. Here is a list of hosts supporting PHP 5.2: http://gophp5.org/hosts Quote Link to comment https://forums.phpfreaks.com/topic/80210-solved-displaying-xml-list-in-php-page/#findComment-424747 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.