[wp-hackers] Using eval within Wordpress for a function mixed
with html
Jacob Santos
wordpress at santosj.name
Tue Dec 2 04:55:11 GMT 2008
You're problem appears to be that you are programming when you should be
developing. Take for example your situation. You want a complex solution
to a simple problem. If you were a developer, you would use the simple
solution for the simple problem. The simple solution would be one that
does not involve eval(). I think that if you gave us more code, we'd be
able to get to the root of your problem and fix the cause instead of
implementing something to cover it up.
Jacob Santos
Chris 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
>
>
More information about the wp-hackers
mailing list