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


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:

<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

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:


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?

图片转代码服务由CSDN问答提供 功能建议

我遇到了一些与Smarty的奇怪行为,但我相信解决方案相当简单。 我当然不是专家和Smarty,但我仍觉得这很奇怪。

有些背景, $ PF_SHOP_CART_GIFTS 是一个整数,如果没有礼物就是0 如果购物车中存在礼品,则在购物车中或正数。


&lt; input type =“text”name =“iGifts”value =“{$ PF_SHOP_CART_GIFTS}”/&gt; 
 {section name =“gift_memberships”loop = $ PF_SHOP_CART_GIFTS} 
 //一堆 东西发生在这里,但它与我的问题无关
 {/ section} 
 {/ if} 

问题在于输入的值 字段“iGifts”总是最终为NULL(当我查看源时值=“”)这很奇怪,因为如果我只输出smarty变量:

  {$ PF_SHOP_CART_GIFTS} \  n   

我看到它设置的正确整数值。 有什么东西阻止我在输入字段值的上下文中使用smarty变量吗?

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

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

    解决 无用
    打赏 举报

相关推荐 更多相似问题