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