|
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 |
kshirod Smarty n00b
Joined: 10 Jun 2015 Posts: 1
|
Posted: Wed Jun 10, 2015 12:19 pm Post subject: assign total form variable and show |
|
|
Hi,
I have a form in smarty like this
Code: | <form class="psmd-form psmd_">
<div class="psmd-fields">
{if {$display_fields} == 1 || {$display_fields} == 2 }
<input type="text" placeholder="Enter first name" name="psmd_fname" class="psmd_fname">
{/if}
{if {$display_fields} == 2}
<input type="text" placeholder="Enter last name" name="psmd_lname" class="psmd_lname">
{/if}
<input type="text" placeholder="Enter your email" name="psmd_email" class="psmd_email">
</div>
<div class="psmd-btn-cont">
<button class="psmd-btn">{$submit_button_text}</button>
</div>
<div class="psmd-clear"></div>
<div class="psmd-validation"></div>
{$popup_content}
</form> |
Now I want something like store the total form in a variable and when I will use that variable like
then this total form should be visible. So can someone tell me how to do this only in smarty. Any help and suggestions will be really appreciable. Thanks |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Thu Jun 11, 2015 7:19 pm Post subject: |
|
|
This is not recommended.
Your template variable $form would contain Smarty tags. Template variables are normally not parsed for Smarty tags.
It could be done with the help of the {eval} tag.
See http://www.smarty.net/docs/en/language.function.eval.tpl and it's notes.
But it has a larger performance impact.
Why did you intend to do it at all? |
|
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
|