You are here: Re: Modifiers on embedded variables « Smarty Templates Posts « IT news, forums, messages
Re: Modifiers on embedded variables

Posted by Pedro on 09/29/66 11:31

I would use {capture}

eg
{capture assign=foo}
<strong>{$bin.item_name|escape:'quotes'}</strong><br/>{$bin.item_category|escape:'quotes'}
{/capture}

then later in the template
{popup text=$foo}

have fun
Pete

A.J. Brown wrote:
> Hi All,
>
> Is there any way to use modifiers on embedded variables using backticks?
> For example, I need to escape quotes for the "text" parameter of a {popup}
> tag. There is static text combined with smarty variables inside the text
> parameter,
>
> {popup text="<strong>`$bin.item_name`</strong><br/>`$bin.item_category`"
> textsize="2" width="400"}
>
>
> What I want is something like this:
>
> {popup
> text="<strong>`$bin.item_name|escape:"quotes"`</strong><br/>`$bin.item_categ
> ory|escape:"quotes"`"}
>
>
> I've had to resort to the following:
>
>
> {assign var="popdesc"
> value="<strong>`$bin.item_name`</strong><br/>`$bin.item_category`"}
>
> {popup text=$popdesc|escape:"string"}
>
>
>
> This works fine for this application. However, I've run across similar
> situations where using {assign} was not appropriate, and I've had to resort
> to formatting the string in the business logic :(. Is there any way to use
> modifiers on `backticked` variables that I'm missing?
>
>
> Thanks!
>
> A.J. Brown,
> BitNotion Intellect

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация