Skip to content

Commit

Permalink
Remove index rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
Toxantron committed Nov 19, 2018
1 parent d4854a5 commit 056ad68
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 25 deletions.
10 changes: 2 additions & 8 deletions src/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@

// Find all templates with their own navigation item
$navItems = [];
$indexPage;
foreach($templates as $index=>$template)
{
if ($template->isNavigation)
$navItems[$index] = $template;
if ($template->isIndex)
$indexPage = $template;
}
?>
<!doctype html>
Expand Down Expand Up @@ -75,10 +72,7 @@
</nav>

<!-- Add your site or application content here -->
<div class="container-fluid main" ng-view>
<!-- Render index page in here for instand display -->
<?php $indexPage->render(false) ?>
</div>
<div class="container-fluid main" ng-view></div>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
Expand All @@ -104,7 +98,7 @@
<?php
foreach($templates as $template)
{
$template->render(true);
$template->render();
}
?>
</body>
Expand Down
19 changes: 2 additions & 17 deletions src/templates/templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ class Template
{
public $isNavigation = false;

public $isIndex = false;

public $navigationTag;

public $link;
Expand All @@ -29,20 +27,8 @@ function __construct($name, $path, $navigationTag = null)
}
}

public function asIndex()
{
$this->isIndex = true;
return $this;
}

public function render($inTag)
public function render()
{
if (!$inTag)
{
include $this->path;
return;
}

?>
<script type="text/ng-template" id="<?= $this->name ?>">
<?php include $this->path; ?>
Expand All @@ -52,9 +38,8 @@ public function render($inTag)

public static function getAll()
{
$indexPage = new Template("home.html", "templates/home.php");
$templates = [
$indexPage = $indexPage->asIndex(),
new Template("home.html", "templates/home.php"),
new Template("join.html", "templates/join.php"),
new Template("list.html", "templates/list.html", "Sessions"),
new Template("master.html", "templates/master.php"),
Expand Down

0 comments on commit 056ad68

Please sign in to comment.