Here is the PHP section, it's running through an XML file of my own creation and is outputting it in a way that I like. I'm still working on design right now, but part of what I want to do is create a list of all the names. The problem is that by how the XML document is that I created they won't necessarily have a last name given.
Below is the PHP code for that section.
elseif(ereg('<name>',$line)){
echo '<h2>';
}
elseif(ereg('<first_name>[A-Za-z ]+</first_name>',$line)){
list($l,$line) = split('>',$line);
list($line,$l) = split('<',$line);
echo $line;
if($i==''){$i=0;}
else{$i++;}
$first[$i]=$line;
}
elseif(ereg('<last_name>[A-Za-z ]+</last_name>',$line)){
list($l,$line) = split('>',$line);
list($line,$l) = split('<',$line);
echo " ".$line;
$last[$i]=$line;
}
elseif(ereg('</name>',$line)){
echo "</h2>\n";
}
The code works fine how it is right now, but I've just decided to add the arrays. I don't know enough about arrays to know if this will work how I want it to, so that I can have it do a loop something like this:
for($r=0;$r<=$i;$r++){
echo '<p><a href="#'.$r.'">'.$first[$r].' '.$last[$r].'</a></p>';
}
If you need any further information let me know, thanks in advance.