Having an href in an XML field does not show up in grid
Below is a sample XML file that includes an href in the jobname field. However, the link does not show up in the grid?
<jobs>
<job>
<startdate>09/23/07</startdate>
<enddate>09/23/07</enddate>
<jobname><a href="talent_job_details.php">National Aviation</a></jobname>
<location>Georgia World Congress Center</location>
<contact>Jim Broaderick</contact>
</job>
</jobs>
Is there any solution to this?
Fred
May 29,
You should 'escape' html control characters inside XML -
instead of
<a href="talent_job_details.php...
it should be
<a href="talent_job_details.php...
Alex (ActiveWidgets)
May 30,
I use the following in PERL to account for the special characters which should fix your problem.
$value = "<![CDATA[$value]]>" if ($value =~ /[&'"<>]/);
In your example, this line:
<jobname><a href="talent_job_details.php">National Aviation</a></jobname>
Would be replaced with:
<![CDATA[<jobname><a href="talent_job_details.php">National Aviation</a></jobname>]]
Mike
June 1,
I use the following in PERL to account for the special characters which should fix your problem.
$value = "<![CDATA[$value]]>" if ($value =~ /[&'"<>]/);
In your example, this line:
<jobname><a href="talent_job_details.php">National Aviation</a></jobname>
Would be replaced with:
<![CDATA[<jobname><a href="talent_job_details.php">National Aviation</a></jobname>]]
Mike
June 1,
My appologies for the double post.
Also, I had the last line wrong...should read:
<jobname><![CDATA[<a href="talent_job_details.php">National Aviation</a>]]</jobname>
Mike
June 1,
Just thought I would post my solution for PHP users:
echo "<field>".htmlentities("<a href='index.php?pagename=$link_page&$link_field=".$result->$field."'>".$result->$field."</a>")."</field>";
ends up looking like this:
<field><a href='index.php?pagename=customer_edit&id=18'>18</a></field>
htmlentities does it all for you!
Jim
Jim Nickel
November 7,