[wp-hackers] Using eval within Wordpress for a function mixed with html

Chris chris.hearn01 at ntlworld.com
Mon Dec 1 23:22:48 GMT 2008

Yes, quite right Otto,
I simplified it for the post and inadvertantly altered it in theprocess 
- I am indeed returning $theresult in the actual code I am trying out.

The key thing is how to eval() a mixture of php and html to get same 
result as if it was put straight into a php page.
I saw on php lots of discussion of eval(), and different ideas, but also 
comments that none of them worked properly, so thought would ask on the 
hackers list.

just to re-iterate: this following type of code works straight in a page,
<a rel="external nofollow" 
src="/oldsite/images/junior/.thumbs/.mirror.jpg" alt="mirror.jpg" 
title="mirror.jpg" width="95%" /></a> <hr />

so what should it be so that I can pull it in from a text file, or a 
database,  and then eval() it will give same result?

Otto wrote:
> On Mon, Dec 1, 2008 at 3:58 PM, Chris <chris.hearn01 at ntlworld.com> wrote:
>> How to use eval() to get the proper result from this type of thing:
>> Assuming I read the above fragment from a text file into variable $s
>> function myfunc($s)
>> eval('\$theresult= \$s;')
>> return $s;
> Shouldn't you be returning $theresult?
> -Otto
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list