doulangbizhan5160 2011-12-11 21:55 采纳率: 100%
浏览 41
已采纳

输入字段的奇怪Smarty变量行为

I am encountering some odd behavior with Smarty but I believe solution is fairly simple. I am admittedly not an expert w/ Smarty but I still find this rather strange.

Some background, $PF_SHOP_CART_GIFTS is an integer, either 0 if no gifts are in cart or a positive number if gifts do exist in the cart.

I have a section loop defined as the following:

{if $PF_SHOP_CART_GIFTS}
<input type="text" name="iGifts" value="{$PF_SHOP_CART_GIFTS}" />
{section name="gift_memberships" loop=$PF_SHOP_CART_GIFTS}
 // A bunch of stuff happens here but it isn't related to my question
{/section}
{/if}

The problem is that the value of the input field "iGifts" always ends up being NULL (value="" when I view source) which is weird because if I just output the smarty variable:

{$PF_SHOP_CART_GIFTS}

I see the correct integer value that it is set to. Is there something that prevents me from using smarty variables in the context of input field values?

  • 写回答

1条回答 默认 最新

  • douan6931 2011-12-14 17:00
    关注

    I ended up rewriting part of the controller that inits the form. All data is now accessible (in a logical fashion) and life is good. /phew

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?