You can mix and match php with output (html/xml/whatever). Also better to use print.
Stick a space after 'if', inbetween your greater than sign, and before the {.
There's no reason to concatenate after 'work.'
If you use double quotes, include the variable inside them. Double quotes will parse variables and newlines (\n & \r). Or use single quotes and you don't have to escape your double quotes in the text. Or use single quotes in the text. ^_^ Choices, choices. You can also use {} around a variable in a string to make it easy to find etc. ("sometext{$var}moretext" rather than "sometext$varmoretext")
Code: Select all
<?xml version="1.0"?>
<portfolio>
<?php
$dh = opendir('images');
while (false !== ($file = readdir($dh))) {
if (strpos($file,'.') > 0) {
print("<work url='images/{$file}' />\n";
}
}
?>
</portfolio>