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

Shorthand attributes in custom functions

 
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 -> Feature Requests
View previous topic :: View next topic  
Author Message
Meekro
Smarty n00b


Joined: 03 Dec 2020
Posts: 2

PostPosted: Thu Dec 03, 2020 1:00 am    Post subject: Shorthand attributes in custom functions Reply with quote

I've been a Smarty user for nearly 15 years, it's been pretty great to see this project evolve! Since Smarty is so extensible, there's been only one missing feature that's affected my development. I'd like to be able to make a custom function with one or more shorthand attributes.

So for example: {foo "bar"}
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Fri Dec 11, 2020 9:44 pm    Post subject: Reply with quote

The problem is - ?
Back to top
View user's profile Send private message
Meekro
Smarty n00b


Joined: 03 Dec 2020
Posts: 2

PostPosted: Wed Dec 23, 2020 8:31 pm    Post subject: Reply with quote

The problem is that Smarty doesn't support creating custom functions with shorthand attributes. Smarty custom functions must have parameters in the key="value" format.

So currently you must do: {foo key="value"} and there's no way to have {foo "value"}
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Thu Dec 24, 2020 2:05 pm    Post subject: Reply with quote

This is due to internal API specifics, but then you could specify parameters in any order, which is a large bonus for templating language.
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 -> Feature Requests 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