Hey, I am trying to include and include_once(''); statement in my $html.=""; variable. I need it to be something like this $html = "<link rel='stylesheet' type='text/css' href='./../style.css' media='screen' />"; $html .= "</head>"; $html .= "<?php include_once('file.php')'; ?>"; Code (markup): How can I do this using the eval()???
Try $html = "<link rel='stylesheet' type='text/css' href='./../style.css' media='screen' />"; $html .= "</head>"; $html .= "<?php include_once('file.php'); ?>"; eval("\$html = \"$html\";"); echo $html; PHP:
<?php $html = <<<HTML <link rel='stylesheet' type='text/css' href='./../style.css' media='screen' /> </head> HTML; $html2 = include_once("test.php"); eval("\$html2 = \"$html2\";"); echo $html; ?> PHP:
Great I went with Hive's and that works perfect. Now I'd like to do something like this: $html .= "<?php $var1='$var1'; ?>"; $html .= "<?php $var2='$var2'; ?>"; PHP: I'm having trouble though. Any suggestions?
Backslash your dollar signs. But are you sure you're going down a good road? What are you actually trying to achieve?
is there a security risk that I am not aware of? I am building a content automation system for building pages on the fly. All this is for my templating.
$html .= "<?php \$var1='".$var1."'; ?>"; $html .= "<?php \$var2='".$var2."'; ?>"; ... eval("\$html = \"$html\";"); $fh = fopen($file, 'w'); fwrite($fh, $html); fclose($fh); PHP: : / no luck the above outputs the actual stored data on the file I am writing to, even when I backslash like above.