Smarty replace the string and use another variable instead of that -


i have form in smarty this

 <div class="psmd_content">     <div class="psmd_text">       <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 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>       <div class="psmd-clear"></div>     </div>   </div> 

to capture made code

{capture name=psmd_form}   <div class="psmd_content">     <div class="psmd_text">       <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 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>       <div class="psmd-clear"></div>     </div>   </div> {/capture} 

and used this

{$smarty.capture.psmd_form} 

this working fine

but have variable {$content} when using variable showing me values this

enter email  {psmd_form} know our exclusive items, new catalogs , special promotions 

now want replace {psmd_form} form. did this

str_replace({psmd_form}, {$smarty.capture.psmd_form}, {$content}); not working. can tell me how rslve this? , suggestions appreciable. thanks

this worked me

{$popup_content|replace:'{psmd_form}': {$smarty.capture.psmd_form} } 

Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -