Re: [SMARTY] dealing with links...

From: Date: Wed, 26 Feb 2003 22:07:42 +0000
Subject: Re: [SMARTY] dealing with links...
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-8235@lists.php.net to get a copy of this message
> This might be kinda dumb, but I've always wondered how other people deal > with linking to other pages. Do you keep the data in the php script and > build the link there, or do you assign all the data to variables and > build the link inside the template?? Here's two examples of what I'm > talking about: > > <?php > > $smarty->assign('link',"http://www.blah.com?id=$id&action=$action"ñy > …Ys¾s´å;éS� ) > $smarty->display('index.html') > ?> > > Template: > > <A HREF="{$link}">click here</A> > > ---OR----- > > <?php > $smarty->assign('id',$id) > $smarty->assign('action',$action) > $smarty->display('index.html') > ?> > > Template: > > <A > HREF="http://www.blah.com?id={$id}&action={$action}">click > here</A> > > Thanks... I sometimes mix the two methods as they both have their pros > and cons. I just wanted to get a feel for what everyone else uses. Well, do you want your programmers or your designers creating the links? With the first method, the programmer decides where the link is going and the designer can't change it. This is probably the best for URLs with query strings like you've got, since the programmer will better understand what needs to go there. Generally, I just assign the URL of my site to a variable and set the page names within the .tpl file. $smarty->assign("url","http://www.mydomain.com/program"); and use <a href="{$url}/main.php">Click Here</a> in my templates. ---John Holmes...

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