Afficher un message
Vieux 08/01/2006, 21h02   #1
Tony
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Problem parsing xml link with _GET parameters.

I tried using the following to produce xml output like the
hypothetical example...

<?php
echo '<link>www.domain.com/index.php?A=1&B=2&C=3</link>';
?>

but I found I had to substitute HTML character code like the
following to prevent xml errors...

<?php
echo '<link>www.domain.com/index.php?A#61;1&B=2&C=3</link>';
?>

Once that was accomplished I then tried to parse the above xml line with Smarty.
I expected something like...

<a href="http://www.domain.com/index.php?A=1&B=2&C=3">LINK</a>


However, when Smarty parses the file, the output is:

<a href="http://www.domain.com/index.php?A">LINK</a>
<a href="http://=">LINK</a>
<a href="http://1">LINK</a>
<a href="http://&">LINK</a>
<a href="http://B">LINK</a>
<a href="http://=">LINK</a>
<a href="http://2">LINK</a>
<a href="http://&">LINK</a>
<a href="http://C">LINK</a>
<a href="http://=">LINK</a>
<a href="http://3">LINK</a>

Smarty Parsing Functions:

function startContact($parser, $name, $attribs){
global $currentTag, $currentAttribs, $contact, $page;
$currentTag = $name;
$currentAttribs = $attribs;
switch ($name) {
case "link";
$contact .= "";
break;
}
return $contact;
}

function endContact($parser, $name){
global $currentTag, $contact, $page;
switch ($name) {
case "link";
$contact .= "";
break;
}
$currentTag = "";
$currentAttribs = "";
return $contact;
}

function dataContact($parser, $data){
global $currentTag, $contact, $page;
switch ($currentTag) {
case "link";
$contact .= "<a href=\"http://".$data."\">LINK</a>";
break;
}
return $contact;
}

Has anyone experienced this problem? How should I correct for it?
  Réponse avec citation
 
Page generated in 0,05466 seconds with 9 queries