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

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

True - I just quoted what I want as a final evaluated result. eval 
assumes the string is php code, and html can be added by dropping out of 
php , like $s= 'echo "hello";?> html here '; eval($s)
but it doesn't like function bloginfo('wpurl') and doesnt like angle 
brackets in the html much either.

Daniel Torreblanca wrote:
> I've never tried this myself, but what's jumping out at me is that
> you're not using <?php .... ?> in that text...
> On Mon, Dec 1, 2008 at 4:58 PM, Chris <chris.hearn01 at ntlworld.com> wrote:
>> Hi
>> I want to evaluate the string below within myfunc() and return a result
>> ready to drop into my home page (echo $s;)
>> For reasons I won't bore you with I want to store this fragment in a text
>> file.
>> Have bashed my head with all sorts of variants, but cannot get eval() to
>> work!
>> The bit that works directly in a page is this:
>> '<a rel="external nofollow"
>> href="'.get_bloginfo('wpurl').'/juniors/mirror"><img
>> src="/oldsite/images/junior/.thumbs/.mirror.jpg" alt="mirror.jpg"
>> title="mirror.jpg" width="95%" /></a> <hr />';
>> 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;
>> So any help would be MUCH appreciated!
>> Best regards from the UK!
>> Chris
>> --
>>   **********************************************************************
>> Chris Hearn   *Tel:* 01625 827589   *Mob:* 07768 725141   *email:*
>> chris.hearn01 at ntlworld.com
>> **********************************************************************   The
>> information transmitted is intended only for the person or entity   to which
>> it is addressed and may contain confidential and/or privileged   material.
>> Any review, retransmission, dissemination or other use of,   or taking of
>> any action in reliance upon, this information by persons   or entities other
>> than the intended recipient is prohibited.   If you received this in error,
>> please contact the sender and delete the   material from any computer.
>> **********************************************************************
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
> _______________________________________________
> 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