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

Hyphenated function parameters

 
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 -> Smarty 3
View previous topic :: View next topic  
Author Message
eithe
Smarty Rookie


Joined: 15 Oct 2010
Posts: 6

PostPosted: Wed Nov 06, 2013 12:39 pm    Post subject: Hyphenated function parameters Reply with quote

Hi there,

Recently I need to add hyphenated parameters to my function arguments, ie: for function displayImage, which is used like this:

Code:
{displayImage src="[url_to_img]" alt="[alternate_text]"}


that outputs:

Code:
<img src="[url_to_img]" alt="[alternate_text]"/>


Unfortunately this approach won't work with parameters that have hyphens in them, like HTML5 data- attributes (or I've not found a way to do it). At best I'd like to do something like:

Code:
{displayImage src="[url_to_img]" "data-number"=5}


which would output:

Code:
<img src="[url_to_img]" data-number="5"/>


Thanks for help!
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Thu Nov 07, 2013 1:18 am    Post subject: Reply with quote

This is supported since Smarty 3.1.9.

The following should work (no quotes at the attribute name]
Code:
{displayImage src="[url_to_img]" data-number=5}
Back to top
View user's profile Send private message
eithe
Smarty Rookie


Joined: 15 Oct 2010
Posts: 6

PostPosted: Fri Nov 08, 2013 8:30 am    Post subject: Reply with quote

Oh, cheers! I'm using version 3.0.7, so there's the reason for it not working. Good to know there's a solution - now it's only the matter of convincing higher-ups to upgrade smarty version Wink
Back to top
View user's profile Send private message
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 -> Smarty 3 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