You are here: Re: [SMARTY] Embedding an object method call in double quotes « Smarty Templates Posts « IT news, forums, messages
Re: [SMARTY] Embedding an object method call in double quotes

Posted by boots on 09/29/42 11:24

--- Dave Dribin <dave-ml@dribin.org> wrote:

> I'm not sure if this is possible, but I'm trying to embed an object
> method call in double quotes, for example:
>
> {include file="header.tpl" title="View for $item->name()"}
>
> But, this isn't working, as I get:
>
> <title>View for Object->name()</title>
>
> If I try to use the backticks to quote the method call, as mentioned
> in
> this page:
>
> http://smarty.php.net/manual/en/language.syntax.quotes.php
>
> like this:
>
> {include file="header.tpl" title="View for `$item->name()`"}
>
> I get this:
>
> <title>View for `Object->name()`</title>
>
> The only way I can get it to work is to assign the name to a variable
>
> without using double quotes:
>
> {assign var="name" value=$item->name()}
> {include file="header.tpl" title="View for $name"}
>
> Is this a bug? The documentation doesn't show a method call example,


You are right, that isn't supported in backticks AFAIK. You can do a
concatenation in this case:

{include file="header.tpl" title="View for "|cat:$item->name()}

HTH


> but it does say to use backticks to quote object reference. Or do I
> have the syntax wrong? I'm using Smarty version 2.6.10.
>
> Thanks!
>
> -Dave
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

 

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

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