|
Posted by Sander Tekelenburg on 07/24/07 20:51
In article <op.tvzecvwtqnv3q9@metallium>,
Rik <luiheidsgoeroe@hotmail.com> wrote:
> On Tue, 24 Jul 2007 19:59:27 +0200, Sander Tekelenburg
> <user@domain.invalid> wrote:
>
> > [...] Each file
> > contains HTML and now and then some embedded PHP snippets.
> >
> > [...] I need to first evaluate those PHP snippets,
> > store the result in a variable, and use *that* as the input for the RSS
> > generator script.
[...]
> ob_start();
> eval('?>'.file_get_contents('file.php').'<?php');
> $string = ob_get_clean();
Yeah, I had tried that. But for some reason this results in $string
being (defined but) empty.
> Then again, that would basically be the same as:
> ob_start();
> include('file.php');
> $string = ob_get_clean();
Bingo! That works. Thanks!
[...]
> It could be that your RSS-generator only swallows files/urls, and not
> strings?
It eats strings. I'm making use of FeedCreator.class.php. See
<http://www.bitfolge.de/rsscreator-en.html>
So the code essentially is this:
require_once("feedcreator.class.php");
$news = new UniversalFeedCreator();
//loop through list of news files
ob_start();
include($s_pathtofile);
$s_content = ob_get_clean();
$item = new FeedItem();
$item->description = $s_content;
$item->addItem($item);
//end loop
$news->saveFeed("RSS1.0", "path/file.xml", false);
> In that case:
[...]
> //write output to temporary file [...]
Yeah, I was considering going there. Glad I don't have to :)
--
Sander Tekelenburg, <http://www.euronet.nl/~tekelenb/>
Mac user: "Macs only have 40 viruses, tops!"
PC user: "SEE! Not even the virus writers support Macs!"
Navigation:
[Reply to this message]
|