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

From: Date: Tue, 14 Jan 2003 10:27:51 +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-7166@lists.php.net to get a copy of this message
I can't use #var# because the variable comes from a PHP script, and so I can't use a config file... With a config file, I **could** have written {include file=#path#/header.tpl} because the "path" variable has ## surrounding it. But with a regular variable coming from a PHP script, I cannot write {include file =$path/header.tpl}, because Smarty will now think I want to use a variable called $path/header.tpl, and not $path ... If I were not inside brackets, I could have written file={$path}/header.tpl , but I am already inside brackets. I read the manual, but did not find anything on this. Any idea? Philippe Morange. Pieter Van Winckel <pvw@aqs-carcontrol.be> le 14/01/2003 10:57:41 Veuillez répondre à pvw@aqs-carcontrol.be Pour : Smarty mailing list <smarty-general@lists.php.net> cc : (ccc : Philippe MORANGE/EST/DOSI/BANQUE_INDOSUEZ/FR) Objet : Re: [SMARTY] Single string, with variable and text -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday 14 January 2003 10:08, you wrote about [SMARTY] Single string, with variable and text to philippe.morange@ca-indosuez.com: > Hi, > I already asked this, but got no reply... Then you had more time to read the man(or not?) > > 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" So you would like something like? {include file=#path#/header.tpl} If you wan't something like this read about "config files" But, i think I don't completly understand your problem, maybe if you say what you are actually (in words) trying what you wan't to do, maybe others could help too > > How could I do that in Smarty ? I would like not to use several variables, > one for each different case... > > Thanks, > Philippe. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE+I98XqI9/Du1wgKQRAqLCAJ4ubJyQ2TdGooNYp0C1MU4HY6eUCQCfeTGt wKQYAOeCUCPlc4y22jkdwmE= =9Pg1 -----END PGP SIGNATURE----- -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

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