Forum Moderators: coopster

Message Too Old, No Replies

What do I need to add to this code?

         

egibberate

9:54 pm on Mar 1, 2009 (gmt 0)

10+ Year Member



Hi
sorry for the vague thread title but I couldn't figure how to word it short enough.
My php file is part of an ajax routine that searches an xml file and returns the results to my page.
The problem is that the php code delivers the reults to the page without any formating having been done by the xsl file.
What do I need to add to the php code in order to make this happen?
Thank you for any help.


<?php
$q=$_GET["q"];$xmlDoc = new DOMDocument();
$xmlDoc->load("book2.xml");
$x=$xmlDoc->getElementsByTagName('title');
for ($i=0; $i<=$x->length-1; $i++)
{
//Process only element nodes
if ($x->item($i)->nodeType==1)
{
if ($x->item($i)->childNodes->item(0)->nodeValue == $q)
{
$y=($x->item($i)->parentNode);
}
}
}
$cd=($y->childNodes);for ($i=0;$i<$cd->length;$i++)
{

//Process only element nodes
if ($cd->item($i)->nodeType==1)
{

echo($cd->item($i)->childNodes->item(0)->nodeValue);
}
}
?>

blang

10:01 pm on Mar 1, 2009 (gmt 0)

10+ Year Member



How many forums do you intend to post this on? It's not clear to me that this a PHP issue.

egibberate

10:08 pm on Mar 1, 2009 (gmt 0)

10+ Year Member



It's posted on two forums. Thanks for your help.

egibberate

11:13 pm on Mar 1, 2009 (gmt 0)

10+ Year Member



Hi,
a kind expert in another forum pointed me in the right direction and I have thus solved my problem.
For anyone who may be interested in the solution it is at the online PHP manual;

[php.net...]

blang

12:10 am on Mar 2, 2009 (gmt 0)

10+ Year Member



Yes, I saw the response on 'that other forum'. I don't mean to be rude, but posting on multiple forums without waiting for a response is against good netiquette (if you believe in that sort of thing). I usually call it out when I see it. No harm no foul, I'm sincerely glad you got it sorted and posted the solution.

egibberate

12:45 am on Mar 2, 2009 (gmt 0)

10+ Year Member



I'm sure you didn't mean to be rude blang & I don't mind being pulled up for being naughty. I don't do it often and I'm the first to curl a lip when I see others being naughty.
Now and again, like a lot of people I guess, I misbehave and mostly get away with it. I got caught this time.