I have a form in smarty like this
<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 {$form}
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
You can use the
{capture}
built-in Smarty function to prepare a block of text:It is not rendered into the page but saved in an internal Smarty variable.
You can use it later in the template like this: