Jump to content

PHP and XML


sean14592

Recommended Posts

Im, using a slideshow script and it uses this xml to fetch the images....

[code]
<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<root>
<settings bordercolor="0xFF0000" delay="20" step="10" a="140"/>
<images>
	<img src="images/ws2-b1581-20040201181235-t.jpg" alt="www.frogstyle.ch" width="128" height="96" big_src="images/ws2-b1581-20040201181235-g.jpg" big_width="640" big_height="480"/>
	<img src="images/ws2-b1570-20040201180406-t.jpg" alt="www.frogstyle.ch" width="128" height="96" big_src="images/ws2-b1570-20040201180406-g.jpg" big_width="640" big_height="480"/>
	<img src="images/ws2-b1572-20040201180444-t.jpg" alt="www.frogstyle.ch" width="128" height="96" big_src="images/ws2-b1572-20040201180444-g.jpg" big_width="640" big_height="480"/>
</images>
</root>

 

 

 

 

Though I need the image to change to a var fetched from mysql, So that it looks like this.

 

<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<root>
<settings bordercolor="0xFF0000" delay="20" step="10" a="140"/>
<images>
	<img src="$siteurl."properties/owners".$row['username']."images/ws2-b1581-20040201181235-t.jpg" alt="www.frogstyle.ch" width="128" height="96" big_src="$siteurl."properties/owners".$row['username']."images/ws2-b1581-20040201181235-g.jpg" big_width="640" big_height="480"/>
	<img src="$siteurl."properties/owners".$row['username']."images/ws2-b1570-20040201180406-t.jpg" alt="www.frogstyle.ch" width="128" height="96" big_src="$siteurl."properties/owners".$row['username']."images/ws2-b1570-20040201180406-g.jpg" big_width="640" big_height="480"/>
	<img src="$siteurl."properties/owners".$row['username']."images/ws2-b1572-20040201180444-t.jpg" alt="www.frogstyle.ch" width="128" height="96" big_src="$siteurl."properties/owners".$row['username']."images/ws2-b1572-20040201180444-g.jpg" big_width="640" big_height="480"/>
</images>
</root>

 

So it includes variables, How can I do this or is there anythere way?

 

Cheers

Sean[/code]

Link to comment
Share on other sites

You need to tell it you're using PHP....

 

<?php
echo("<img src=\"dir1/dir2/" . $row["username"] . "/images/image.jpg /\">");
?>

 

or

 

<a href="dir1/dir2/<? echo($row["username"]); ?>/images/image.jpg" />

Link to comment
Share on other sites

Or echo the whole thing...

 

<?php
echo '
<root>
<settings bordercolor="0xFF0000" delay="20" step="10" a="140"/>
<images>
	<img src="' . $siteurl . '"properties/owners"' . $row['username'] . '"images/ws2-b1581-20040201181235-t.jpg" alt="www.frogstyle.ch" width="128" height="96" big_src="' . $siteurl . '"properties/owners"' . $row['username'] . '"images/ws2-b1581-20040201181235-g.jpg" big_width="640" big_height="480"/>
	<img src="' . $siteurl . '"properties/owners"' . $row['username'] . '"images/ws2-b1570-20040201180406-t.jpg" alt="www.frogstyle.ch" width="128" height="96" big_src="' . $siteurl . '"properties/owners"' . $row['username'] . '"images/ws2-b1570-20040201180406-g.jpg" big_width="640" big_height="480"/>
	<img src="' . $siteurl . '"properties/owners"' . $row['username'] . '"images/ws2-b1572-20040201180444-t.jpg" alt="www.frogstyle.ch" width="128" height="96" big_src="' . $siteurl . '"properties/owners"' . $row['username'] . '"images/ws2-b1572-20040201180444-g.jpg" big_width="640" big_height="480"/>
</images>
</root>
';  
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.