|
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 |
SlowFox Smarty Regular
Joined: 02 Oct 2006 Posts: 55
|
Posted: Sun Aug 04, 2013 4:15 pm Post subject: Access custom block from custom function |
|
|
I have a template like:
Code: | {inputform layout=Layout::Table}
{formfield field=$field layout=Layout::Table}
{/inputform} |
which does pretty much the obvious (i.e. creates an HTML form with a single input field according to the object $field and with a table layout).
Now the "layout" Parameter for smarty_function_formfield() - which adds some <tr><td></td></tr> - could be omitted, as it is content must always identical to the one used for smarty_block_inputform() - which creates a <table></table> infrastructure. The question is: how can I access the value of the surrounding block functions parameter from within the custom function? Is this possible at all? Up to now I only found the _tag_stack, which tells me the name of the surronding block, but this alone does not help. |
|
Back to top |
|
SlowFox Smarty Regular
Joined: 02 Oct 2006 Posts: 55
|
Posted: Wed Aug 14, 2013 9:07 am Post subject: |
|
|
Hm. Stupid question? Stupid problem? Stupid else? |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Wed Aug 14, 2013 8:01 pm Post subject: |
|
|
It is not possible to get access to attributes of the surounding block in a direct way.
The {inputform} plugin could assign the layout attribute to a Smarty variable $layout.
{formfield} could read it with getTemplateVars()
See http://www.smarty.net/docs/en/api.get.template.vars.tpl |
|
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
|