By: Webys
Date: 2005-04-14
Time: 09:07
|
Sub-Templates - How Can I include a sub template and keep the php script with php arrays in the root template
Ex: I have a script file php file (s.php) where I load the html template (t.htm this is the big template the main, the root template)
and I wish to do an include of other template, sub-template (st.htm) and the parsing script to be the same (s.php).
It works for parsing php vars with [var.php_variable] but if I have an array let's say php_arr in my s.php it won't parse, list values in sub template st.html just variables not arrays ?!
<table>
<tr align="right" bgcolor="#FFFFFF">
<td height="18">[var.php_variable;noerr]</td>
<td>[php_arr.#;block=tr;]</td>
<td valign=top> [php_arr.name;noerr]</td>
</tr>
</table>
|
By: Webys
Date: 2005-04-14
Time: 11:01
|
Re: Sub-Templates - How Can I include a sub template and keep the php script with php arrays in the root template
TBS is a good and small template engine from what I shaw in the last 2 years but...
I'm using TBS for 8 months and this is the only thing that I can't understand how to do it with sub templates and keeping te root php script with arrays and execute, oarse the array NOT only the variables from root script in the sub template.
Thanks.
|
By: Skrol29
Date: 2005-04-14
Time: 11:44
|
Re: Sub-Templates - How Can I include a sub template and keep the php script with php arrays in the root template
Hi Webys,
Yes it should work. But take care that you call the MergeBlock() method after the sub-template is included. That is after the sub-script is called.
Var fields are merged at the end, that is when the Show() method is called.
If you want the sub-script to be called at the beginning (when the template is loaded) you can use a [onload] tag.
By the way, TBS 2.02 bring a new nice feature to manage sub-template from a sub-script or a local function. This is not in the document yet because I'm writing it.
|
By: Webys
Date: 2005-04-14
Time: 13:10
|
Re: Sub-Templates - How Can I include a sub template and keep the php script with php arrays in the root template
Thanks Skrol29 my mistake I've put onshow instead of onload ...with on load is ok....
[onshow;file='st.htm'] <-- Wrong
[onload;file='st.htm'] <-- OK
Question how many subtemplates can I make..let's say that in st.htm I put another sub template st1.htm....stn.htm....has any limit of sub-templates ?
Thanks.
|
By: Skrol29
Date: 2005-04-14
Time: 13:26
|
Re: Sub-Templates - How Can I include a sub template and keep the php script with php arrays in the root template
No limit I think. Each subtemplate is evaluated while inserted.
|
|
Posting in progress.
Please wait...
|