Thanks for the reply. It didn’t work but my fault not yours for not supplying enough information.
It’s a wordpress site and I’m trying to amend an old plugin that is no longer supported. The xml file is read in already via a functions file. I’ve made some progress using this:
[php]foreach ($property->variables->varcat->varcatitems->varcatitem as $variablecat):
if($variablecat->variable[“id”] != “24024”)
{
$summaryStr .= 'item not found';
$summaryStr .= 'etc';
$summaryStr .= '<br />';
}
else
{
$summaryStr .= 'found';
$summaryStr .= 'etc...';
$summaryStr .= '<br />';
}
endforeach;[/php]
This at least works and prints out ‘not found’ for each line, however I only want this text once. Can I use a counter within the foreach? If I set a counter to 0 and increment it only if it finds the matching item then can I test for greater than 0 and print my text?
I’ve tried a number of ways but so far not succeeding! I’m learning fast but some help would be greatfully received!