Re: [SMARTY] Single string, with variable and text
| From: | Nichlas Löfdahl | Date: | Tue, 14 Jan 2003 10:37:46 +0000 |
| Subject: | Re: [SMARTY] Single string, with variable and text | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-7167@lists.php.net to get a copy of this message | ||
Hello!
Hmm, I'm not exactly sure what syntax Smarty 2.3.1 supports but with the
latest one in the CVS, you can do something like this:
foo.php
<?
...
$smarty->assign('path', '/path/to/somewhere');
$smarty->display('foo.tpl');
...
?>
foo.tpl:
{include file="$path/header.tpl"}
And in Smarty 2.3.1, I know I've used something like this (althought it
seems to be deprecated).
{include file=$path."/header.tpl"}
/Nichlas
----- Original Message -----
From: <philippe.morange@ca-indosuez.com>
To: <smarty-general@lists.php.net>
Sent: Tuesday, January 14, 2003 10:08 AM
Subject: [SMARTY] Single string, with variable and text
>
> Hi,
> I already asked this, but got no reply...
>
> I'd like to compose a single string made of a variable and some html,
right inside Smarty brackets.
>
> For example:
> I assigned a variable to the template in a PHP file:
> $path = '/usr/local/include/templates/';
> $smarty->assign('path', $path);
>
> In the template I want to do that:
> {include file="/usr/local/include/templates/header.tpl"}
> BUT I want to use the $path variable...
> In PHP I would do $path."header.tpl"
>
> How could I do that in Smarty ? I would like not to use several variables,
one for each different
> case...
>
> Thanks,
> Philippe.
>
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php