Hi,
I have having a problem understanding how to display values of variables in PHP from using templates.
Below is the code for the template function and the template i am trying to call (with variables included). Templates are saved as HTML files iwth variables in them.
As you can see below, i've tried including the normal call to a session $_SESSION... and in a PHP statement {$_SESSION...
What is displayed on the page is exactly as below.
I have also tried to record these onto normal variables too, ie:
Code:
$userName = $_SESSION['userName'];
Thanks.
Code:
function gettemplate($template,$endung="html") {
$templatefolder = "templates/default/";
return str_replace("\"","\\\"",implode("",file($templatefolder."/".$template.".".$endung)));
}
Code:
echo gettemplate("headerInfo");
Code:
<p class='smallRight'>Welcome back, $_SESSION['userName'].You last logged in on {$_SESSION['lastLogin']}</p>
<p class='smallRight'><a href='index.php?act=logout' title='Logout'>Logout</a></p>
Last edited by feraira; 08-26-2011 at 01:56 PM..
|