09-27-2010, 06:44 PM
|
#7 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
|
Hi Lucy, sorry for missing this thread!
You were very nearly there with your code above, just a couple of things were a bit strange. Below is some code which is very similar to yours but doesn't output anything; it's just to show how to access the information that you're looking for.
Any questions about what it does differently, and why, just shout.
PHP Code:
// Search results statistics
// No need to loop here, there is only ever
// one block of openSearch numbers
$opensearch = $xml->channel->children('openSearch', TRUE);
$total = $opensearch->totalResults;
$start = $opensearch->startIndex;
$per_page = $opensearch->itemsPerPage;
// Loop over the <ad:advertisement> nodes
foreach ($xml->channel->children('ad', TRUE)->advertisement as $advert) {
$title = $advert->title;
$sub_title = $advert->subTitle;
$disp_url = $advert->displayUrl;
}
// Loop over the <item> nodes, access <mc:displayUrl> nodes
foreach($xml->channel->item as $post) {
$title = $post->title;
$desc = $post->description;
$url = $post->link;
$disp_url = $post->children('mc', TRUE)->displayUrl;
}
|
|
|
|