Rewrite main template

feature/node-rewrite
Sven Slootweg 13 years ago
parent 863707a7d9
commit 869cf61cd8

@ -14,18 +14,22 @@
$_CVM = true; $_CVM = true;
require("includes/include.base.php"); require("includes/include.base.php");
$sUserbox = ""; $sTemplateParameters = array();
$_SESSION['userid'] = 1;
if(!empty($_SESSION['userid'])) if(!empty($_SESSION['userid']))
{ {
$sUser = new User($_SESSION['userid']); $sUser = new User($_SESSION['userid']);
$sUserbox = Templater::InlineRender("userbox", $locale->strings, array( $sLoggedIn = true;
'username' => "joepie91" $sTemplateParameters = array_merge($sTemplateParameters, array(
'username' => $sUser->sUsername
)); ));
} }
else else
{ {
$sUser = new User(0); $sUser = new User(0);
$sLoggedIn = false;
} }
$sMainContents = ""; $sMainContents = "";
@ -61,11 +65,13 @@ catch (UnauthorizedException $e)
$sMainContents = "You are not authorized to view this page."; $sMainContents = "You are not authorized to view this page.";
} }
echo(Templater::InlineRender("main", $locale->strings, array( $sTemplateParameters = array_merge($sTemplateParameters, array(
'userbox' => $sUserbox, 'logged-in' => $sLoggedIn,
'title' => $sPageTitle, 'title' => $sPageTitle,
'main' => $sMainContents, 'main' => $sMainContents,
'main-class' => $sMainClass 'main-class' => $sMainClass
))); ));
echo(Templater::InlineRender("main", $locale->strings, $sTemplateParameters));
?> ?>

@ -14,7 +14,12 @@
<div class="wrapper"> <div class="wrapper">
<div class="header"> <div class="header">
<img src="/images/logo.png"> <img src="/images/logo.png">
<%?userbox> <%if logged-in == true>
<div class="userbox">
<div>You are logged in as <strong><%?username></strong>.</div>
<div><a href="/">Account overview</a> | <a href="/containers/">My VPSes</a></div>
</div>
<%/if>
</div> </div>
<div class="main <%?main-class>"> <div class="main <%?main-class>">
<%?main> <%?main>

Loading…
Cancel
Save