multiple templates

10 years ago

quasiperfect
Member | 1
+
0
-

is possible to load multiple templates per presenter ? how ?

i tried (i'm using the skeleton)

$page_header  = new  Template;
$page_header ->setFile('Common/page_header.phtml');
$page_header ->hello = 'Hello header';
$page_menu  = new  Template;
$page_menu ->setFile('Common/page_menu.phtml');
$page_menu ->hello = 'Hello menu';

10 years ago

Jan Tvrdík
Nette guru | 2556
+
0
-

Why you need to load multiple templates?

Maybe it would be better to use Control instead.

<?php
class MyControl extends Control
{
  public function render()
  {
    $template = parent::createTemplate();
    $template->setFile(dirname(__FILE__) . '/MyControl.phtml');

    // ...

    $template->render();
  }
}

Last edited by Jan Tvrdík (2009-07-09 11:22)