Jump to content

PHP/xml phraser count help


spfoonnewb

Recommended Posts

Hi,

I have this xml phraser, I am having trouble getting it to display the count.. So basically for each, I want a number.. so $l should output 1-50 or whatever it happens to be.

If I replace $l with $xml_index['TITLE'][$i], it just outputs a bunch of random numbers.. 67, 15, 93.. etc.

It does currently populate all of those elements, it just doesn't provide the count.

[code]<?php;
$url = "http://";
define(feed, $url);

$xml_feed = file_get_contents(feed);

$xml_praser = xml_parser_create();

xml_parse_into_struct($xml_praser,$xml_feed,$xml_keys,$xml_index);

xml_parser_free($xml_praser);

for($i = 0; !empty($xml_index['TITLE'][$i]);$i++){
for ($l = 1; $l <= 10; ++$l) {
if($i == 0){

echo ''.$xml_keys[$xml_index['TITLE'][$i]]['value'].'';
echo ''.$xml_keys[$xml_index['DATA'][$i]]['value'].'';
echo ''.$xml_keys[$xml_index['URL'][$i]]['value'].'';

}else{

echo ''.$xml_keys[$xml_index['TITLE'][$i]]['value'].'';
echo ''.$xml_keys[$xml_index['DATA'][$i]]['value'].'';
echo ''.$xml_keys[$xml_index['URL'][$i]]['value'].'';

}
}
}

?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/35612-phpxml-phraser-count-help/
Share on other sites

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.