Welcome Guest, Not a member yet? Register   Sign In
Template Engine / Easier View Library
#4

[eluser]wiredesignz[/eluser]
Usage: Rendering different page parts in different Controller methods.

Autoload library template.php

Code:
function index()
      {
        $indexView = new Template('index');
        $indexView->assign( array(
        "blogtitle"       => $this->blogTitle,
        "blogdescription" => $this->blogDescription,
        "categories"      => $this->categories,
        "pages"           => $this->pages,
        "blogroll"        => $this->blogroll,
        "posts"           => $this->posts,
        "page"            => $this->page,
        "numpages"        => $this->mdl_posts->numpages,
        "prevpage"        => $this->prevpage,
        "nextpage"        => $this->nextpage,
        "nav"             => $this->nav
        ));

        $this->_final_out($indexView);
      }
    

      function _final_out($contentView)
      {
         $this->template->assign_tpl( array(
         'header'         => 'header',
         'sidebar'        => 'sidebar',
         'content'        => 'content',
         'footer'         => 'footer',
         ));        

         $this->template->assign('content', $contentView);    // re-assign the content part
         $this->template->assign_global($contentView->data); // assign as global data
         $this->template->assign_global('directory', $directoryName); // add template directory

         $this->template->render();
       }


Messages In This Thread
Template Engine / Easier View Library - by El Forum - 12-13-2007, 04:44 PM
Template Engine / Easier View Library - by El Forum - 12-13-2007, 04:51 PM
Template Engine / Easier View Library - by El Forum - 12-13-2007, 05:15 PM
Template Engine / Easier View Library - by El Forum - 12-13-2007, 06:15 PM
Template Engine / Easier View Library - by El Forum - 12-14-2007, 12:07 AM
Template Engine / Easier View Library - by El Forum - 12-14-2007, 08:08 AM
Template Engine / Easier View Library - by El Forum - 12-14-2007, 11:15 AM



Theme © iAndrew 2016 - Forum software by © MyBB