christsealed
New member
identical code.? The original XML file looks something like this.
<?xml version="1.0"?>
<galleries>
<gallery title="architecture" intro="These are the photos of various buildings in the cities, towns and villages I visited during my voyages.">
<image>Dallas.</image>
<image>Tresnjevka. I love the atmosphere on this one.</image>
<image>Motovun.</image>
<image>New York.</image>
<image>Paris.</image>
</gallery>
<gallery title="essays" intro="A collection of various photos which either do not fit any other category - experiments and such.">
<image>Color mayhem!</image>
<image>The sleeping monster.</image>
<image>Let me out!</image>
<image>A barrel on the side of the trail.</image>
<image>Subterranean passage.</image>
<image>A train in snow.</image>
</gallery>
<galleries>
Here's my php
<?PHP
$xml = '<?xml version="1.0" encoding="utf-8" standalone="yes"?>';
$gallPath = '/gallery/';
$link = mysql_connect ("localhost", "root", "");
mysql_select_db ("test");
$query = 'SELECT * FROM galleries';
$results = mysql_query($query);
echo "$xml\n";
echo "<galleries>\n";
while ($line = mysql_fetch_assoc($results)) {
echo "<gallery title=\"{$line["galleryTitle"]}\" intro=\"{$line["galleryIntro"]}\">\n";
echo "<img src=\"$gallPath{$line["galleryTitle"]}/{$line["imgName"]}\" description=\"{$line["imgDesc"]}\" />\n";
echo "</gallery>\n";
}
echo "</galleries>";
mysql_close($link);
?>
But the output isn't the same. I've changed a few things, obviously, but I would just like that based on the table field galleryTitle, the php would echo each item with that title and then close the node, instead of closing the node after each item.
Does that make sense?
<?xml version="1.0"?>
<galleries>
<gallery title="architecture" intro="These are the photos of various buildings in the cities, towns and villages I visited during my voyages.">
<image>Dallas.</image>
<image>Tresnjevka. I love the atmosphere on this one.</image>
<image>Motovun.</image>
<image>New York.</image>
<image>Paris.</image>
</gallery>
<gallery title="essays" intro="A collection of various photos which either do not fit any other category - experiments and such.">
<image>Color mayhem!</image>
<image>The sleeping monster.</image>
<image>Let me out!</image>
<image>A barrel on the side of the trail.</image>
<image>Subterranean passage.</image>
<image>A train in snow.</image>
</gallery>
<galleries>
Here's my php
<?PHP
$xml = '<?xml version="1.0" encoding="utf-8" standalone="yes"?>';
$gallPath = '/gallery/';
$link = mysql_connect ("localhost", "root", "");
mysql_select_db ("test");
$query = 'SELECT * FROM galleries';
$results = mysql_query($query);
echo "$xml\n";
echo "<galleries>\n";
while ($line = mysql_fetch_assoc($results)) {
echo "<gallery title=\"{$line["galleryTitle"]}\" intro=\"{$line["galleryIntro"]}\">\n";
echo "<img src=\"$gallPath{$line["galleryTitle"]}/{$line["imgName"]}\" description=\"{$line["imgDesc"]}\" />\n";
echo "</gallery>\n";
}
echo "</galleries>";
mysql_close($link);
?>
But the output isn't the same. I've changed a few things, obviously, but I would just like that based on the table field galleryTitle, the php would echo each item with that title and then close the node, instead of closing the node after each item.
Does that make sense?