Réf. : Re: [SMARTY] Single string, with variable and text

From: Date: Tue, 14 Jan 2003 13:18:17 +0000
Subject: Réf. : Re: [SMARTY] Single string, with variable and text
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-7169@lists.php.net to get a copy of this message
Ok thanks, this works: {include file=$path."header.tpl"} Same as in PHP, I don't know why I didn't try this... I thought that Smarty would just take stuff between ""... Obviously I was wrong. Thanks again, Philippe. Nichlas Löfdahl <crotalus@acc.umu.se> le 14/01/2003 11:37:46 Pour : <smarty-general@lists.php.net>, Philippe MORANGE/EST/DOSI/BANQUE_INDOSUEZ/FR@BANQUE INDOSUEZ cc : (ccc : Philippe MORANGE/EST/DOSI/BANQUE_INDOSUEZ/FR) Objet : Re: [SMARTY] Single string, with variable and text 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 -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.smarty.general (#7169) next »