Re: [SMARTY] passing URL to template
| From: | Bob Powers | Date: | Wed, 19 Mar 2003 22:16:05 +0000 |
| Subject: | Re: [SMARTY] passing URL to template | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-8760@lists.php.net to get a copy of this message | ||
Hi: thanks for the response.....quoting the parameters 'does work'......but
very strangely.......I've tried this and what occurs is that the 'Correct'
url gets printed out at the top of the resulting page....just above the page
header...instead of in the template 'tag' location.....if I view the source
for the resulting page.....it looks like this......
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
</body>
</html>
http://localhost/shop_NEW/?login=1&page=shop/index<html>
<head>
<title>mytitle</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<---cut out section..unrelated-->
<area shape="poly" coords="170,30,252,30,252,48,170,48,170,30"
href="***URL
should be here***
">
</map>
</td></tr>
</table>
Thanks
Bobp
"Haber Janos" <boci@coder.hu> wrote in message
news:20030319230835.38bf779a.boci@coder.hu...
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