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

assign total form variable and show

 
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 -> General
View previous topic :: View next topic  
Author Message
kshirod
Smarty n00b


Joined: 10 Jun 2015
Posts: 1

PostPosted: Wed Jun 10, 2015 12:19 pm    Post subject: assign total form variable and show Reply with quote

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
Code:
{$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
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Thu Jun 11, 2015 7:19 pm    Post subject: Reply with quote

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
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 -> General 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