Embedding PHP include statements within a string that gets echoed -


i've been trying clean site defining site structure php string variables , echoing variables out. condenses of site structure down 5 lines article in between echo statements. page looks this:

<?php
include('modules/moddefault.php'); //link site structure set variables
$title = "example page"; // define page title. inserted embedded title statement.

echo "$modtop"; // declaration, head, title etc.
echo "$precontent"; // pre-content structure
?>

<h1>web content goes here</h1>
<p>article content nice , uncluttered.</p>

<?php echo "$postcontent"; // post-content structure
?>

i'm wondering how can embed css includes inside of php string variable. php includes don't register because php has processed page. include statements being printed screen instead of getting processed php statement.

here sample of 1 of variables echo in previous code block:

$precontent = "<body>";
$precontent .= "<div id='wrapper'>";
$precontent .= "<div id='header'>";
$precontent .= "<div>";
$precontent .= "include 'modules/header.inc'"; //this i'm having trouble
$precontent .= "</div>";
$precontent .= "</div>";
$precontent .= "<div id='navtop'>";
$precontent .= "<div>";
$precontent .= "include('modules/topnav.inc');"; // i'm having trouble
$precontent .= "</div>";
$precontent .= "</div>";
$precontent .= "<div id='centerbox'>";
$precontent .= "<div id='article'>";
$precontent .= "<div id='innerarticle'>";
$precontent .= "<div>";

i tried embedding php statement within string,

$precontent .= "<?php include('modules/topnav.inc';?>"; didn't work.

i have tried ssi format, php seems ignore statements because written inside ignore statement.

any great.

have tried $precontent.=file_get_contents('modules/header.inc');


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -