Re: help with eval problems...
| From: | Paul Roberts | Date: | Sat, 06 Jul 2002 07:56:37 +0000 |
| Subject: | Re: help with eval problems... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-105839@lists.php.net to get a copy of this message | ||
On Fri, 5 Jul 2002, Kelly Meeks wrote:
> If I had this information stored in a database field,
> <img src="<? echo $content_output["site_logo"]; ?>">
>
> how could I assign it to a variable and output it?
you have to ?> first to leave php mode so you can do
$content_output = "logo.gig";
$code = "<img src='<?php echo $content_output; ?>'>";
eval("?>$code");
which will echo the outut
or catch it with output buffering
$content_output = "logo.gig";
$code = "<img src='<?php echo $content_output; ?>'>";
ob_start();
eval("?>$code");
$evaled_code = ob_get_contents();
ob_end_clean();
I have used arrays in evals before you have to watch the quotes.
Paul Roberts
roberts_paul@bigfoot.com
++++++++++++++++++++++++