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
Post a Comment