This is probably quite easy, but is a bit beyond my level. I use a simple XML function to load some snippets from files to go into my index of old articles, as follows, and I just need a simple if statement as explained in the comments below:
<?php
// if the file exists, go ahead and load it...
$xml = simplexml_load_file('articles2011.xml');
foreach($xml as $article) {
echo '<li><a href="'.$article->url.'">'.$article->title.'</a></li>
<li>'.$article->desc.'</li>';
}
// else do nothing
?>
I have used if statements once or twice but not in the context of files and simple XML.