Hi,

"macros" are used to achive nested templates in phptal.
Read the chapter "metal" in the phptal documentation at 
http://phptal.org/manual/en/split/metal.html

It's well explained and yes, you'll get nested templates with automatically 
passed variables!

Kind regards,
Per

 

-----Ursprüngliche Nachricht-----
Von: phptal-boun...@lists.motion-twin.com 
[mailto:phptal-boun...@lists.motion-twin.com] Im Auftrag von Julian B.
Gesendet: Dienstag, 27. Juli 2010 09:26
An: phptal@lists.motion-twin.com
Betreff: [PHPTAL] Including other Templates inside a Template

Hello everybody,

I want to switch the template/view production of my project to phptal.
Currently it is done via plain php (normal "CodeIgniter" style).

The problem is, i do not have one big template in which i output my variables, 
but instead a nested set of fragments.

For example:
There is a main page that does nothing but define the basic html structure with 
head and body. Inside this file multiple other files are loaded and embedded.

So i have something like this:
<html>
  <head>
    <? $this->load->view('page/includes.php')?>
  </head>
  <? $this->load->view('page/topnav.php')?>
....

In the includes.php there are routines to embed all required css and js files.
topnav.php defines the top navigation.
(These "$this->load..." statements are codeigniter statements to load a view) 
Now the problem is:
When loading the topnav.php some variables are passed to it (in fact they are 
passed to the main page, but when loading another template in this page, they 
are also available there).
I need those variables to determine wether the user is an admin (and display 
some admin-only links etc), greet the user by name etc.

Now the question is:
can this be done via phptal as well?

I want: nested templates with automatically passed variables.

I googled it (even tough i was not sure about my query string) and read through 
the archives but could not find a solution to my problem.

Thanks for your time,
Julian B.

_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to