|
[SMARTY] Re: How to pass a variable inside a section loop: msg#00409php.smarty.general
Look at http://smarty.incutio.com/?page=SmartyFrequentlyAskedQuestions I think most of your questions will be answered there. For your current problem just search the page for the "concat" plugin. Then you can use the following code in your template {ahref string=$ArrayOfBookmarks[bookmarks]->Name url="http://www.mypage.com/edit_boomark?bookmarkid="|concat:$ArrayOfBookmark s[bookmarks]->Id} bye, André "Mike Potter" <mikep@xxxxxxxxx> schrieb im Newsbeitrag news:20030128161646.89126.qmail@xxxxxxxxxxxxxxx > OK, I have found that I can just do > {ahref string=$ArrayOfBookmarks[bookmarks]->Name} and that will work, > but now I'm having problems with the URL... What I really want is > something that combines text and variables, so I have something like this: > {ahref string=$ArrayOfBookmarks[bookmarks]->Name > url="http://www.mypage.com/edit_boomark?bookmarkid=".$ArrayOfBookmarks[bookm arks]->Id} > Is it possible to do that? > Thanks, > Mike > > Mike Potter wrote: > > Hi all: > > I'd like to pass a variable to a function inside of a section loop, > > but I'm just starting out with smarty, and don't know how to do it. > > The {ahref} function is one that I downloaded from the extensions > > directory. > > I have an array of bookmark objects that I'm passing to my template. I'd > > like to customize the links that get printed out, but I can't figure out > > how to get the following to work: > > > > {section name=bookmarks loop=$ArrayOfBookmarks} > > {ahref string="{$ArrayOfBookmarks[bookmarks]->Name}" > > url="http://www.oeone.com"} > > {/section} > > > > The above will give an error, since it finds the } at the end of the > > variable. > > Any help is appreciated. > > Thanks, > > Mike > > > -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: [SMARTY] Delete all cached files for a template file: 00409, Aliba Sora |
|---|---|
| Next by Date: | Re: [SMARTY] PHPDoc and Smarty: 00409, Katana |
| Previous by Thread: | [SMARTY] Re: How to pass a variable inside a section loopi: 00409, Mike Potter |
| Next by Thread: | [SMARTY] All sorts of errors on Smarty 2.3.1: 00409, Didier McGillis |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |