hi, i need help with including this
<?php
require("MagicParser.php");
function myRecordHandler($item)
{
print "<a href='".$item["LINK"]."'>".$item["TITLE"]."</a>";
}
$url = "http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml";
MagicParser_parse($url,"myRecordHandler","xml|RSS/CHANNEL/ITEM/");
?>
on a php page using xtemplate.
here is an example of a simple expression.
$box_content = "Hello World, today's date is" . date("F j, Y, g:i a");
some advice that.
"If your PHP has print or echo statements in it, remove them and concatenate them into a variable instead. If you try printing from that file, it won't work as you found for your self."
how can i do it with the magicparser example above?
thanks in advance.
Hi,
It sounds like what you need to do is create a global variable called $box_content; and then append all the output to that variable rather than print it directly. Then you can use $box_content within your template file. For example:
<?php
require("MagicParser.php");
function myRecordHandler($item)
{
global $box_content;
$box_content .= "<a href='".$item["LINK"]."'>".$item["TITLE"]."</a> ";
}
$url = "http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml";
MagicParser_parse($url,"myRecordHandler","xml|RSS/CHANNEL/ITEM/");
?>
Hope this helps,
Cheers,
David.