Smarty 替换字符串并使用另一个变量代替

Smarty replace the string and use another variable instead of that

我有一个像这样的 smarty 表格

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

为了捕获这个,我编写了类似

的代码
{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 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>
      <div class="psmd-clear"></div>
    </div>
  </div>
{/capture}

并像这样使用它

{$smarty.capture.PSMD_FORM}

这工作正常

但我有一个变量 {$content} 当我使用这个变量时,它显示了这样的值

ENTER YOUR EMAIL 
{PSMD_FORM}
know about our exclusive items, New catalogs and special promotions

现在我想用我的表单替换 {PSMD_FORM}。所以我喜欢这个

str_replace({PSMD_FORM}, {$smarty.capture.PSMD_FORM}, {$content}); 但它不工作。那么有人可以告诉我如何解决这个问题吗?任何帮助和建议都将非常感激。谢谢

这对我有用

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