dongyan2267 2014-11-18 20:50
浏览 30

如何调用指定的smarty变量

Good evening,

I am using a smarty cms and I am trying to display the "proucts_quantity" but it does not work. I have already tried all possible and used cases which are already present in the template but it will not show.
The variable "products_quantity" is an assigned variable and visibly through {debug}

--> Template

   <!--             
  {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}

--> Debug
http://www.pic-upload.de/view-25300549/Untitled2.jpg.html

The Variable "products_quantity" is not present in the php file so I assume that it is included in some array. Unfortunately the file is to long to post it here and I am not sure whish sniped is important.
http://www.file-upload.net/download-9867993/checkout_confirmation.zip.html

I would appreciate if anyone could help me out, how to call the variable or how to find it out.

  • 写回答

1条回答 默认 最新

  • dskld5423 2014-11-18 22:18
    关注

    Data which You are looging is in $content_data variable.

    So to display 'quantity', try

     {foreach from=$content_data.products_data item=product}
          {$product.quantity}
     {/foreach}
    

    ($content_data.products_data is an array)

    Good way to debuging in smarty is using var_dump like:

     <pre>{$content_data|@var_dump}</pre>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入