|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
lsemel Smarty Rookie
Joined: 18 Aug 2003 Posts: 5
|
Posted: Wed Aug 27, 2003 9:26 pm Post subject: Multiple templates in one file |
|
|
My project uses lots of small templates, for different parts and components of the pages. This results an an explosion of template files, and I'd like to make it a bit easier to manage. Is it possible to combine multiple templates in one file?
i.e. something like this. Inside "file.tpl", there would be:
{template name="first"}
... regular smarty template here
{/template}
{template name="second"}
... another template
{/template}
$smarty->display("file.tpl","first"); |
|
Back to top |
|
ptonev Smarty Rookie
Joined: 21 Apr 2003 Posts: 13 Location: Bulgaria, Sofia
|
Posted: Thu Aug 28, 2003 6:41 am Post subject: |
|
|
Yes, it is possible. That I make error f() in my site.
In Error.tpl:
Code: |
{capture name=UNKNOWN_ERROR}
UNKNOWN_ERROR text ot html
{/capture}
{capture name=DB_TXML_NOT_FOUND}
DB_TXML_NOT_FOUND text ot html
{/capture}
{capture name=TABLE_NOT_FOUND}
TABLE_NOT_FOUND
{/capture}
{if $smarty.capture.$ERROR_ID ne ""}{else}{assign var="ERROR_ID" value="UNKNOWN_ERROR"}{/if}
<table border="0" cellpadding="0" cellspacing="0" width="760">
<tr>
.....
{$smarty.capture.$ERROR_ID}</b>
.....
</tr>
</table>
|
In Error.php
Code: |
$smarty->assign("ERROR_ID", $error_id);
$smarty->display('error.tpl');
|
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|