Skip to content

Commit

Permalink
Move footer and header declaration to the initialize method so that c…
Browse files Browse the repository at this point in the history
…hild classes can use/override.
  • Loading branch information
johnpbloch committed Jun 2, 2012
1 parent 2f63cd6 commit 9ee8774
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Class/MenuBuddy/Base.php
Expand Up @@ -30,6 +30,11 @@ abstract class Base extends \Core\Controller
public function initialize( $method )
{
\Core\Session::start();

$headerTemplate = !empty( config( 'Layout' )->header ) ? config( 'Layout' )->header : 'MenuBuddy/Header';
$footerTemplate = !empty( config( 'Layout' )->footer ) ? config( 'Layout' )->footer : 'MenuBuddy/Footer';
$this->header = new \Core\View( $headerTemplate );
$this->footer = new \Core\View( $footerTemplate );
}

/**
Expand Down Expand Up @@ -67,11 +72,6 @@ public function send()

headers_sent() OR header( 'Content-Type: text/html; charset=utf-8' );

$headerTemplate = !empty( config( 'Layout' )->header ) ? config( 'Layout' )->header : 'MenuBuddy/Header';
$footerTemplate = !empty( config( 'Layout' )->footer ) ? config( 'Layout' )->footer : 'MenuBuddy/Footer';
$this->header = new \Core\View( $headerTemplate );
$this->footer = new \Core\View( $footerTemplate );

$layout = new \Core\View( $this->template );
$layout->set( (array)$this );
print $layout;
Expand Down

0 comments on commit 9ee8774

Please sign in to comment.