Php 如何调用指定的smarty变量

Php 如何调用指定的smarty变量,php,smarty,Php,Smarty,晚上好, 我使用的是smarty cms,我试图显示产品数量,但不起作用。我已经尝试了模板中已经存在的所有可能的用例,但它不会显示。 变量products_quantity是一个指定的变量,通过{debug}可见 ->模板 <!-- {if $products_item_array.shipping_time} <br />{$info.text_shipping_time}: {$products_item_array.sh

晚上好,

我使用的是smarty cms,我试图显示产品数量,但不起作用。我已经尝试了模板中已经存在的所有可能的用例,但它不会显示。 变量products_quantity是一个指定的变量,通过{debug}可见

->模板

   <!--             
  {if $products_item_array.shipping_time}
        <br />{$info.text_shipping_time}: {$products_item_array.shipping_time}
   {/if}
   -->
    <br />{$info.text_shipping_time}: {$products_item_array.products_quantity}
 <pre>{$content_data|@var_dump}</pre>
->调试

php文件中没有变量products_quantity,因此我假设它包含在某个数组中。不幸的是,这个文件太长了,我不知道剪什么是重要的。


如果有人能帮助我,我将不胜感激,如何调用变量或如何找到它。

您正在丢失的数据位于$content\u数据变量中

因此,要显示“数量”,请尝试

 {foreach from=$content_data.products_data item=product}
      {$product.quantity}
 {/foreach}
$content\u data.products\u数据是一个数组

在smarty中调试的好方法是使用var_dump,如:


我想使用可变产品的数量。变量是1或0,我不知道他们为什么这样做。我将尝试按照您告诉我的那样调试,meI必须使用“>DATA\u array<-”中的{$products\u item\u array.DATA\u array.products\u quantity}粗体字母-谢谢您的帮助