Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Dedicated server web hosting provided by Guru-host.eu.
callable modifier

 
Post new topic   Reply to topic    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
bimal
Smarty Elite


Joined: 19 Apr 2007
Posts: 345
Location: Kathmandu, Nepal

PostPosted: Sun Jul 04, 2010 11:11 am    Post subject: callable modifier Reply with quote

I have problems using below codes:
Code:
{'http://www.smarty.net'|print}

The callables (print, echo) were probably working in older versions of Smarty, and now, not.

Unfortunately, print_r works. Please note that I am using immediate, hard quoted values, like in this example, 'http://www.smarty.net' instead of a variable like $domain. (I needed this to avoid dreamweaver downloading the images from a real website, in my case.)

In the error message, I see:
Code:
unknown modifier "print"'


Any help?
_________________
Project Manager and Senior Programmer (Bimal Poudel)
Smarty Framework - use it now
Sanjaal Corps, Organized freelancing provider

Hire me in oDesk immediately | Professional support | Personal URL
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 2318
Location: Hamburg / Germany

PostPosted: Sun Jul 04, 2010 7:57 pm    Post subject: Reply with quote

I think print and echo did never work as modifier as they are language constructs and no real function. is_callable() does return false for print and echo.

It did not work with Snarty2 either.
Back to top
View user's profile Send private message
bimal
Smarty Elite


Joined: 19 Apr 2007
Posts: 345
Location: Kathmandu, Nepal

PostPosted: Sun Jul 04, 2010 8:18 pm    Post subject: It did not work earlier. Reply with quote

They may not work in the earlier version. But I found a solution with:

Code:
{assign var='domain' value='http://www.domain.com'}
...style="background-image:url({$domain}/data/thumbnails/{$thumbs[t].cat_id}/{$thumbs[t].image_code}.jpg)"...


just instead of:

Code:
...style="background-image:url({'http://www.domain.com'|print}/data/thumbnails/{$thumbs[t].cat_id}/{$thumbs[t].image_code}.jpg)"...


There is no real need for this work. But when I switch to the design mode, Dreamwever tries to download the real images from the server. And using this small tweak, it fails - saving the download time.
_________________
Project Manager and Senior Programmer (Bimal Poudel)
Smarty Framework - use it now
Sanjaal Corps, Organized freelancing provider

Hire me in oDesk immediately | Professional support | Personal URL
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 2318
Location: Hamburg / Germany

PostPosted: Sun Jul 04, 2010 8:28 pm    Post subject: Reply with quote

Why do you need {'http://www.domain.com'|print} at all and not simply {'http://www.domain.com'} ?
Back to top
View user's profile Send private message
bimal
Smarty Elite


Joined: 19 Apr 2007
Posts: 345
Location: Kathmandu, Nepal

PostPosted: Sun Jul 04, 2010 9:08 pm    Post subject: Yes, even shorter Reply with quote

Yes - thanks for the reminder.
Now the code is even shorter, and as exactly as what I wanted for.

Smile
_________________
Project Manager and Senior Programmer (Bimal Poudel)
Smarty Framework - use it now
Sanjaal Corps, Organized freelancing provider

Hire me in oDesk immediately | Professional support | Personal URL
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP