Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Images in popup plugin

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Plugins
View previous topic :: View next topic  
Author Message
cyber_wolf
Smarty n00b


Joined: 15 Feb 2004
Posts: 2

PostPosted: Sun Feb 15, 2004 10:28 am    Post subject: Images in popup plugin Reply with quote

How can I display an image in a popup if the image url is in a variable.

popup text="<img src='image.gif'>" works but popup text="<img src=$variable>" doesn't. I've tried src="$variable" src='variable' which give errors.

I've also tried background=$variable, fgbackground=$variable, bgbackground=$variable and all give me errors as long as the image url is in a variable.

Thanks,
cyber_wolf
Back to top
View user's profile Send private message Visit poster's website
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Sun Feb 15, 2004 4:03 pm    Post subject: Reply with quote

you have to escape quotes inside quotes with a \, just like in php:
{popup text="<img src=\"$variable>\""}
Back to top
View user's profile Send private message Send e-mail Visit poster's website
cyber_wolf
Smarty n00b


Joined: 15 Feb 2004
Posts: 2

PostPosted: Sun Feb 15, 2004 4:50 pm    Post subject: Reply with quote

messju wrote:
you have to escape quotes inside quotes with a \, just like in php:
{popup text="<img src=\"$variable>\""}


Thanks messju.

It seems my problem wasn't in the formatting of the code, but that the popup plugin doesn't like arrays. The vaiable I was using was $product[product].image and the generated source code was Array.image.

I fixed it by assigning $product[product].image to another variable and using the new variable as the image src which worked.

Thanks,
cyber_wolf
Back to top
View user's profile Send private message Visit poster's website
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Sun Feb 15, 2004 6:15 pm    Post subject: Reply with quote

just FYI: with backticks you can embed an array-element directly in the double-quoted string:
see: http://smarty.php.net/manual/en/language.syntax.quotes.php
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Plugins 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