Page 1 of 1

PHP within a PHP variable

Posted: Thu Jan 24, 2008 3:43 pm
by dscovil
Hi I'm very new to PHP. I am just trying to nest PHP in a variable. On my inside.php page I have the following code where a sidebar is supposed to be.

Code: Select all

<? echo "$insidesidebar"; ?>
Then on the interior page I have the following php not just put a string in the variable but to include another bit of php for a sidebar blog.

Code: Select all

$insidesidebar = '<?php echo $sideData; ?>';
Of course this isn't working. Please let me know a better way.

Re: PHP within a PHP variable

Posted: Thu Jan 24, 2008 3:46 pm
by markusn00b
Why would you want to nest it inside?

Just echo it out like normal..

Re: PHP within a PHP variable

Posted: Thu Jan 24, 2008 3:54 pm
by Christopher
Where is the other "bit of php for a sidebar blog" located. Do you generate it as a sting or is it in a separate file?