Using eval within Wordpress for a function mixed with html

View: New views
13 Messages — Rating Filter:   Alert me  

Using eval within Wordpress for a function mixed with html

by Chris-212 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
    **********************************************************************
    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@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: Using eval within Wordpress for a function mixed with html

by Daniel Torreblanca :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...> 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@...
> **********************************************************************   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@...
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: Using eval within Wordpress for a function mixed with html

by Otto-19 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Dec 1, 2008 at 3:58 PM, Chris <chris.hearn01@...> 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@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: Using eval within Wordpress for a function mixed with html

by Chris-212 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.
Chris

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@...> 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@...
>> **********************************************************************   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@...
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>>    
> _______________________________________________
> wp-hackers mailing list
> wp-hackers@...
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
>  
_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: Using eval within Wordpress for a function mixed with html

by Chris-212 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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"
href="'.get_bloginfo('wpurl').'/juniors/mirror"><img
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?
Thanks
Chris

Otto wrote:

> On Mon, Dec 1, 2008 at 3:58 PM, Chris <chris.hearn01@...> 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@...
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
>  
_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: Using eval within Wordpress for a function mixed with html

by jasonistaken :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Why don't you just use sprintf?

$string = '<a rel="external nofollow" href="%s/juniors/mirror"><img
src="/oldsite/images/junior/.thumbs/.mirror.jpg" alt="mirror.jpg"
title="mirror.jpg" width="95%" /></a> <hr />';

$string = sprintf($string, get_bloginfo('wpurl'));

Done!



Chris wrote:

> 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"
> href="'.get_bloginfo('wpurl').'/juniors/mirror"><img
> 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?
> Thanks
> Chris
>
> Otto wrote:
>> On Mon, Dec 1, 2008 at 3:58 PM, Chris <chris.hearn01@...>
>> 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@...
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>>  
> _______________________________________________
> wp-hackers mailing list
> wp-hackers@...
> http://lists.automattic.com/mailman/listinfo/wp-hackers

_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: Using eval within Wordpress for a function mixed with html

by Chris-212 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

good point on sprintf() - but assumes that I know the link will always
have the bloginfo() as the variable.
 I was trying to generalise it so that, for several records in a text
file, it would do the whole thing!
Thanks for suggestion
Does anyone know hwo to combine php functions and html using eval?? I
would still like to know.
Chris




Jason Webster wrote:

> Why don't you just use sprintf?
>
> $string = '<a rel="external nofollow" href="%s/juniors/mirror"><img
> src="/oldsite/images/junior/.thumbs/.mirror.jpg" alt="mirror.jpg"
> title="mirror.jpg" width="95%" /></a> <hr />';
>
> $string = sprintf($string, get_bloginfo('wpurl'));
>
> Done!
>
>
>
> Chris wrote:
>> 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"
>> href="'.get_bloginfo('wpurl').'/juniors/mirror"><img
>> 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?
>> Thanks
>> Chris
>>
>> Otto wrote:
>>> On Mon, Dec 1, 2008 at 3:58 PM, Chris <chris.hearn01@...>
>>> 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@...
>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>
>>>  
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers@...
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers@...
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: Using eval within Wordpress for a function mixed with html

by DD32 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Not having tested it, But going off what you originally posted:

function getStringFromFile($file) {
     $s = file_get_contents($file);
     eval('return ' . $s);
}
You need to combine the strings, not to insert one string inside the other  
i believe.


On Tue, 02 Dec 2008 11:25:10 +1100, Chris <chris.hearn01@...>  
wrote:

> good point on sprintf() - but assumes that I know the link will always
> have the bloginfo() as the variable.
>  I was trying to generalise it so that, for several records in a text
> file, it would do the whole thing!
> Thanks for suggestion
> Does anyone know hwo to combine php functions and html using eval?? I
> would still like to know.
> Chris
>
>
>
>
> Jason Webster wrote:
>> Why don't you just use sprintf?
>>
>> $string = '<a rel="external nofollow" href="%s/juniors/mirror"><img
>> src="/oldsite/images/junior/.thumbs/.mirror.jpg" alt="mirror.jpg"
>> title="mirror.jpg" width="95%" /></a> <hr />';
>>
>> $string = sprintf($string, get_bloginfo('wpurl'));
>>
>> Done!
>>
>>
>>
>> Chris wrote:
>>> 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"
>>> href="'.get_bloginfo('wpurl').'/juniors/mirror"><img
>>> 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?
>>> Thanks
>>> Chris
>>>
>>> Otto wrote:
>>>> On Mon, Dec 1, 2008 at 3:58 PM, Chris <chris.hearn01@...>
>>>> 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@...
>>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>>
>>>>
>>> _______________________________________________
>>> wp-hackers mailing list
>>> wp-hackers@...
>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers@...
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers@...
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: Using eval within Wordpress for a function mixed with html

by DD32 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

oops, Heres a tested version:

function getStringFromFile($file) {
     $s = file_get_contents($file);
     eval('$return = ' . $s . ';');
     return $return;
}


---

Not having tested it, But going off what you originally posted:

function getStringFromFile($file) {
       $s = file_get_contents($file);
       eval('return ' . $s);
}
You need to combine the strings, not to insert one string inside the other
i believe.


On Tue, 02 Dec 2008 11:25:10 +1100, Chris <chris.hearn01@...>
wrote:

> good point on sprintf() - but assumes that I know the link will always
> have the bloginfo() as the variable.
>  I was trying to generalise it so that, for several records in a text
> file, it would do the whole thing!
> Thanks for suggestion
> Does anyone know hwo to combine php functions and html using eval?? I
> would still like to know.
> Chris
>
>
>
>
> Jason Webster wrote:
>> Why don't you just use sprintf?
>>
>> $string = '<a rel="external nofollow" href="%s/juniors/mirror"><img
>> src="/oldsite/images/junior/.thumbs/.mirror.jpg" alt="mirror.jpg"
>> title="mirror.jpg" width="95%" /></a> <hr />';
>>
>> $string = sprintf($string, get_bloginfo('wpurl'));
>>
>> Done!
>>
>>
>>
>> Chris wrote:
>>> 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"
>>> href="'.get_bloginfo('wpurl').'/juniors/mirror"><img
>>> 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?
>>> Thanks
>>> Chris
>>>
>>> Otto wrote:
>>>> On Mon, Dec 1, 2008 at 3:58 PM, Chris <chris.hearn01@...>
>>>> 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@...
>>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>>
>>>>
>>> _______________________________________________
>>> wp-hackers mailing list
>>> wp-hackers@...
>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers@...
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers@...
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: Using eval within Wordpress for a function mixed with html

by Alan Castonguay :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If you're just going to echo the result in the template, why not just  
include() the text file?

Alan

Sent from my iPhone

On 1-Dec-08, at 16:58, Chris <chris.hearn01@...> 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@...    
> ***
> ***
> ****************************************************************    
> 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@...
> http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: Using eval within Wordpress for a function mixed with html

by Jacob Santos-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: Using eval within Wordpress for a function mixed with html

by Otto-19 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yeah, I gotta agree with Alan on this one. If you're reading a text
file and then eval()ing it, then that's basically the same as an
include.

Now, on the other hand, if you're eval()ing because you want the
output back as a string, then the short answer is that you can't do
that. eval() executes the code, and if that code makes output, then it
makes the output. The returned result of the eval() call will be
whatever that code in the string does as it's "return" statement.
Output != returned data.

You'd have to use an output buffer to grab the output from the eval().
ob_start() and such.



On Mon, Dec 1, 2008 at 9:44 PM, Alan Castonguay <alan@...> wrote:
> If you're just going to echo the result in the template, why not just
> include() the text file?
_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: Using eval within Wordpress for a function mixed with html

by scribu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Couldn't you just use get_bloginfo(), which returns the result, instead of
echoing it?

--
http://scribu.net
_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers
LightInTheBox - Buy quality products at wholesale price!