Jump to content

Can someone check syntax on this line for me?


LuciBKen

Recommended Posts

Hey all,

 

I was wondering what the correct syntax would b for this line of code:

 

$xml .= '<slide jpegURL="thumbs/($thumb)" ';

 

here's the whole script:

$query = "SELECT * FROM jos_pic_player";
$result = mysql_query($query) OR DIE("Error!!!");
// close connection to db
include 'closedb.php';

if ($result) {
$xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
$xml .= "<flash_parameters>";

    	$xml .= '<preferences>
	<global>
	<basic_property movieWidth="310" movieHeight="360" html_title="" loadStyle="Pie"/>
	<title_property photoTitle="false" photoTitleX="5" photoTitleY="5" photoTitleSize="NULL" 				photoTitleFont="Verdana" photoTitleColor="0xffffff"/>
	<music_property path="" stream="false"/>
	<photo_property topPadding="0" bottomPadding="0" leftPadding="0" rightPadding="0"/>
	</global>
<thumbnail>
	<basic_property autoHide="true" width="75" height="60" alpha="80" align="right"/>
</thumbnail>
	</preferences>';
$xml .= "<album>";
while ($r = mysql_fetch_array($result)) {
	$title = $r["title"];
	$file = $r["file"];		
	$desc = $r["description"];
	$thumb = $r["thumbnail"];
	$xml .= '<slide jpegURL="thumbs/($thumb)" ';
	$xml .= 'd_URL="slides/$file"';
	$xml .= ' transition="8" ';
	$xml .= 'phototime="15" ';
	$xml .= 'url="http://www.photograffx.smugmug.com" ';
	$xml .= 'title="$title" ';
	$xml .= '/>';
	}
$xml .= "</album>";
$xml .= "</flash_parameters>";
} else {
echo "Nothing in the db!!!";
}
$filename = 'slides.xml';
$somecontent = "$xml\n";

// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {

    // In our example we're opening $filename in append mode.
    // The file pointer is at the bottom of the file hence
    // that's where $somecontent will go when we fwrite() it.
    if (!$handle = fopen($filename, 'w')) {
         echo "Cannot open file ($filename)";
         exit;
    }

    // Write $somecontent to our opened file.
    if (fwrite($handle, $somecontent) === FALSE) {
        echo "Cannot write to file ($filename)";
        exit;
    }

    echo "Success, wrote ($somecontent) to file ($filename)";

    fclose($handle);

} else {
    echo "The file $filename is not writable";
}
?>

 

it's in a php file that draws info from a db and places it in a certain area in an xml file.

 

Thanks for the help

 

Ok, changing the quotes etc... worked, but here's my output file and the pic viewer won't read it! SO how can I get my output code to look like a good xml code file?

 

<?xml version="1.0" encoding="utf-8"?><flash_parameters><preferences>
	<global>
	<basic_property movieWidth="310" movieHeight="360" html_title="" loadStyle="Pie"/>
	<title_property photoTitle="false" photoTitleX="5" photoTitleY="5" photoTitleSize="NULL" 				photoTitleFont="Verdana" photoTitleColor="0xffffff"/>
	<music_property path="" stream="false"/>
	<photo_property topPadding="0" bottomPadding="0" leftPadding="0" rightPadding="0"/>
	</global>
<thumbnail>
	<basic_property autoHide="true" width="75" height="60" alpha="80" align="right"/>
</thumbnail>
	</preferences><album><slide jpegURL="http://www.hawaiisoccermag.com/uploadtest/photoshow/thumbs/(flip over.jpg)" d_URL="http://www.hawaiisoccermag.com/uploadtest/photoshow/slides/(flip over.jpg)" transition="8" phototime="15" url="http://www.photograffx.smugmug.com" title="Flip Over"/><slide jpegURL="http://www.hawaiisoccermag.com/uploadtest/photoshow/thumbs/(soccer ball.jpg)" d_URL="http://www.hawaiisoccermag.com/uploadtest/photoshow/slides/(soccer ball.jpg)" transition="8" phototime="15" url="http://www.photograffx.smugmug.com" title="Soccer Ball"/><slide jpegURL="http://www.hawaiisoccermag.com/uploadtest/photoshow/thumbs/(soccergirl.jpg)" d_URL="http://www.hawaiisoccermag.com/uploadtest/photoshow/slides/(Soccergirl.jpg)" transition="8" phototime="15" url="http://www.photograffx.smugmug.com" title="Soccer Girl"/><slide jpegURL="http://www.hawaiisoccermag.com/uploadtest/photoshow/thumbs/(soccer kick.jpg)" d_URL="http://www.hawaiisoccermag.com/uploadtest/photoshow/slides/(soccer kick.jpg)" transition="8" phototime="15" url="http://www.photograffx.smugmug.com" title="Soccer Kick"/></album></flash_parameters>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.