Re: [SMARTY] passing URL to template
| From: | Haber Janos | Date: | Wed, 19 Mar 2003 22:08:35 +0000 |
| Subject: | Re: [SMARTY] passing URL to template | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-8759@lists.php.net to get a copy of this message | ||
Hi!
> require (the necessary setup file)
>
> $smarty = new Smarty_Smarty_newapp;
> $smarty->caching = true;
> $smarty->force_compile = true;
> $smarty->debugging = true;
> $smarty->php_handling = SMARTY_PHP_ALLOW ;
> $smarty->assign('title','mytitle');
>
> $smarty->assign('loginURL' ,'$sess->purl(URL .
> ?login=1&page=shop/index');
>
> $smarty->display('header.tpl');
>
>
> ***header.tpl***
>
> <area shape="poly" coords="170,30,252,30,252,48,170,48,170,30" href=
> {$loginURL}>
>
>
> The first part of the URL ($sess->purl(URL .) doesn't get executed as php in
> the template.....
>
> I tried {php}{$loginURL}{/php} in template file ....still didn't work..
Hi. First. Why use '' for $sess->purl... ? It´s a command, not a string.
Second: {php}{$loginURL}{/php} -> that´s false, You assigned the value into $loginURL. the
smarty work´s with class, all the template data work in a class, so you can´t use into the
{php}{/php} section the $loginURL. n the firs´t version is the good. but the $sess->purl not a
string, so use this:
> $smarty->assign('loginURL' ,$sess->purl(URL . ?login=1&page=shop/index);
Cow