|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Meekro Smarty n00b
Joined: 03 Dec 2020 Posts: 2
|
Posted: Thu Dec 03, 2020 1:00 am Post subject: Shorthand attributes in custom functions |
|
|
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 |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Fri Dec 11, 2020 9:44 pm Post subject: |
|
|
The problem is - ? |
|
Back to top |
|
Meekro Smarty n00b
Joined: 03 Dec 2020 Posts: 2
|
Posted: Wed Dec 23, 2020 8:31 pm Post subject: |
|
|
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 |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Thu Dec 24, 2020 2:05 pm Post subject: |
|
|
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 |
|
|
|
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
|