You are here: evaluate code before serving it « PHP Programming Language « IT news, forums, messages
evaluate code before serving it

Posted by Sander Tekelenburg on 07/24/07 17:59

Situation: I store news articles as individual PHP files. Each file
contains HTML and now and then some embedded PHP snippets.

Serving those news articles on the Web works fine, through include().
But I want to also serve them through RSS, and found that in that case
the PHP source code is served -- it's not being evaluated.

So it seems obvious that 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. I thought that'd be pretty straight-forward, but for
the life of me I can't figure out how to do it.

I've experimented with eval() and ob_start() but either I misunderstand
how to use them, or they're not the right tools for this use.

<http://de.php.net/manual/en/function.eval.php#76339> claims a solution,
but it doesn't work for me. (I get no output whatsover using that
approach.)


Any suggestions? TIA!

--
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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация