sean14592 Posted June 8, 2008 Share Posted June 8, 2008 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 https://forums.phpfreaks.com/topic/109261-php-and-xml/ Share on other sites More sharing options...
retro Posted June 8, 2008 Share Posted June 8, 2008 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 https://forums.phpfreaks.com/topic/109261-php-and-xml/#findComment-560487 Share on other sites More sharing options...
webent Posted June 8, 2008 Share Posted June 8, 2008 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 https://forums.phpfreaks.com/topic/109261-php-and-xml/#findComment-560494 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.