ausgezeichnete Posted January 28, 2008 Share Posted January 28, 2008 I have a XML file contains images [HIGHLIGHT=XML] <content width="368" height="450" bgcolor="cccccc" loadercolor="ffffff" panelcolor="5d5d61" buttoncolor="5d5d61" textcolor="ffffff"> <page src="pages/01.jpg"/> <page src="pages/02.swf"/> <page src="pages/03.swf"/> <page src="pages/04.jpg"/> <page src="pages/05.jpg"/> <page src="pages/06.jpg"/> <page src="pages/07.swf"/> <page src="pages/08.jpg"/> <page src="pages/09.swf"/> <page src="pages/10.jpg"/> <page src="pages/11.swf"/> <page src="pages/12.jpg"/> <page src="pages/13.jpg"/> <page src="pages/14.jpg"/> </content> [/highlight] well,let me explain to u the case am using a bookflip application downloaded from the net http://www.flashpageflip.com/ its is a html pages contains flash which gets its images from the xml file and the above r the code in the XML file my problem now,that i wan this images to be dynamically from the database using PHP so,am trying to find the way to embed the php into this XML file Quote Link to comment https://forums.phpfreaks.com/topic/88178-embeding-php-code-in-xml/ Share on other sites More sharing options...
priti Posted January 28, 2008 Share Posted January 28, 2008 Hi, Do you have path of these images in DB??? if yes then its simple 1.query to get the images from db 2.create the XML file as below format 3.then submit the file this application It should solve your problem.If i have understood what you have written. kindly confirm Regards Quote Link to comment https://forums.phpfreaks.com/topic/88178-embeding-php-code-in-xml/#findComment-451139 Share on other sites More sharing options...
ausgezeichnete Posted January 28, 2008 Author Share Posted January 28, 2008 ok i tried doing that <?php header('Content-Type: text/xml'); require_once('../../Connections/mystique.php'); mysql_select_db($database_mystique, $mystique); $query_Recordset1 = "SELECT * FROM gallery_thumb"; $Recordset1 = mysql_query($query_Recordset1, $mystique) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?> <?php do{?> <content width="368" height="450" bgcolor="cccccc" loadercolor="ffffff" panelcolor="5d5d61" buttoncolor="5d5d61" textcolor="ffffff"> <page src="../../allwebcodesign/Admin/gallery/<?php echo $row_Recordset1['foto']; ?>"/> </content> <?php }while($row_Recordset1 = mysql_fetch_assoc($Recordset1));?> but xm ddidnt read the php code!!!!!!!!!!!!!! and this file must be saved as .XMl Quote Link to comment https://forums.phpfreaks.com/topic/88178-embeding-php-code-in-xml/#findComment-451143 Share on other sites More sharing options...
priti Posted January 28, 2008 Share Posted January 28, 2008 $str='<?xml version="1.0" encoding="UTF-8"?>'; $str.='<imageset>'; <?php do{ $str.=$str.='<content width="368" height="450" bgcolor="cccccc" loadercolor="ffffff" panelcolor="5d5d61" buttoncolor="5d5d61" textcolor="ffffff"><page src="../../allwebcodesign/Admin/gallery/'.$row_Recordset1['foto'];.'"/></content>'; }while($row_Recordset1 = mysql_fetch_assoc($Recordset1)); $str.='</imageset>'; header('Content-Type: text/xml'); echo $str; Try this.Please take care of syntax from your side. Regards Quote Link to comment https://forums.phpfreaks.com/topic/88178-embeding-php-code-in-xml/#findComment-451144 Share on other sites More sharing options...
trq Posted January 28, 2008 Share Posted January 28, 2008 if you want the file to retain the .xml extension you will also need to configure your server to interpret xml files as php. eg; AddType application/x-httpd-php .xml Quote Link to comment https://forums.phpfreaks.com/topic/88178-embeding-php-code-in-xml/#findComment-451145 Share on other sites More sharing options...
ausgezeichnete Posted January 28, 2008 Author Share Posted January 28, 2008 sorry priti but is this code for including the php in xml or the oppesite??? Quote Link to comment https://forums.phpfreaks.com/topic/88178-embeding-php-code-in-xml/#findComment-451148 Share on other sites More sharing options...
priti Posted January 28, 2008 Share Posted January 28, 2008 This code will output the xml file the one you have to give to the application further i.e the output of php is embedded in you xml file. reomve that <imageset> tag if your application is not able to interpret the xml tag. Quote Link to comment https://forums.phpfreaks.com/topic/88178-embeding-php-code-in-xml/#findComment-451151 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.