Jump to content

Embeding PHP code in XML??


ausgezeichnete

Recommended Posts

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

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

$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

 

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.