Skip to content

Commit

Permalink
Use new placeholder layout features of Saft
Browse files Browse the repository at this point in the history
  • Loading branch information
white-gecko committed Jun 2, 2013
1 parent 3bd2420 commit 13b8b43
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 54 deletions.
23 changes: 14 additions & 9 deletions classes/Xodx/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function run() {
/**
* Prepare Template
*/
$this->_layout->setLayout('templates/layout.phtml');
$this->_layout->setLayout('layout.phtml');

$request = $bootstrap->getResource('request');

Expand Down Expand Up @@ -47,18 +47,23 @@ public function run() {

$this->_layout->username = $user->getName();
$this->_layout->notifications = $userController->getNotifications($user->getUri());
$this->_layout->addDebug($bootstrap->getResource('logger')->getLastLog());

$config = $bootstrap->getResource('config');
if (isset($config['debug']) && $config['debug'] == false) {
$this->_layout->disableDebug();
if (!isset($config['debug']) || $config['debug'] == true) {
$debug = new Saft_Template(
'debug.phtml', array('log' => $bootstrap->getResource('logger')->getLastLog())
);
$this->_layout->setPlaceholder('debug', $debug);
}
} catch (Exception $e) {
$this->_layout->setLayout('templates/errorlayout.phtml');
$this->_layout->errorType = 'Application Error';
$this->_layout->exception = $e;
$this->_layout->back = $this->getBaseUri();
$this->_layout->addContent('templates/error.phtml');
$this->_layout->setLayout('errorlayout.phtml');
$options = array(
'errorType' => 'Application Error',
'exception' => $e,
'back' => $this->getBaseUri()
);
$errorPlaceholder = new Saft_Template('error.phtml', $options);
$this->_layout->setPlaceholder('error', $errorPlaceholder);
}
$this->_layout->render();
}
Expand Down
2 changes: 1 addition & 1 deletion classes/Xodx/FeedController.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function getFeedAction($template, $uri = null, $format = null)

$nameHelper = new Xodx_NameHelper($this->_app);

$template->setLayout('templates/feed.phtml');
$template->setLayout('feed.phtml');
$template->updated = $updated;
$template->uri = $uri;
$template->feedUri = $feedUri;
Expand Down
2 changes: 1 addition & 1 deletion libraries/Saft
2 changes: 2 additions & 0 deletions templates/activity/addactivity.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h2>New Activity</h2>
A new activity has been created
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 8 additions & 5 deletions templates/debug.phtml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php
if (isset($this->debugText)) {
echo $this->debugText;
}
?>
<?php if (!empty($this->log)) : ?>
<div class="debug" id="debugConsole">
<h3>Debuglog:</h3>
<pre>
<?= $this->log ?>
</pre>
</div>
<?php endif; ?>
17 changes: 3 additions & 14 deletions templates/errorlayout.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,11 @@
</div>

<div class="container">
<?php
foreach ($this->_contentFiles as $contentFile) {
include $contentFile;
}
?>
</div>

<?php if ($this->_debug && !empty($this->_debugLog)) : ?>

<div class="debug" id="debugConsole">
<h3>Debuglog:</h3>
<pre>
<?= $this->_debugLog ?>
</pre>
<?php $this->placeholder('error'); ?>
</div>

<?php if ($this->has('debug')) : ?>
<?php $this->placeholder('debug'); ?>
<?php endif; ?>
</body>
</html>
19 changes: 4 additions & 15 deletions templates/layout.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<a class="brand"><img src="resources/img/xodx_20.png" alt="Xodx" title="[ˈɛksodʊs]" /></a>
<?php
$this->partial(
'templates/menu.phtml',
'menu.phtml',
array('username' => $this->username, 'notifications' => $this->notifications)
);
?>
Expand All @@ -40,22 +40,11 @@
</div>

<div class="container">
<?php
foreach ($this->_contentFiles as $contentFile) {
include $contentFile;
}
?>
</div>

<?php if ($this->_debug && !empty($this->_debugLog)) : ?>

<div class="debug" id="debugConsole">
<h3>Debuglog:</h3>
<pre>
<?= $this->_debugLog ?>
</pre>
<?php $this->placeholder('main.content'); ?>
</div>

<?php if ($this->has('debug')) : ?>
<?php $this->placeholder('debug'); ?>
<?php endif; ?>
</body>
</html>
7 changes: 0 additions & 7 deletions templates/newactivity.phtml

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<hr />
<?php
$this->partial(
'templates/partials/friendlist.phtml',
'friendlist.phtml',
array('personUri' => $this->profileshowPersonUri, 'knows' => $this->profileshowKnows, 'addFriend' => false)
);
?>
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion templates/usershow.phtml → templates/user/home.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
<hr />
<?php
$this->partial(
'templates/partials/friendlist.phtml',
'friendlist.phtml',
array('personUri' => $this->profileshowPersonUri, 'knows' => $this->profileshowKnows, 'addFriend' => true)
);
?>
Expand Down

0 comments on commit 13b8b43

Please sign in to comment.