简体   繁体   English

空smarty变量?

[英]Empty smarty variable?

Why smarty variable doesn't have value in my code when I tested on /nl/nl/ address? 在/ nl / nl /地址上测试时,为什么smarty变量在我的代码中没有值?

Code: 码:

{php}
  global $country; global $lang;
  $this->assign('curLang',$lang);
  $this->assign('curCountry',$country);
{/php}
{if $curLang == "nl" && ($curCountry == "nl" || $curCountry == "be")}
  {literal}
   javascript code
  {/literal}
  {assign name="test" value="1"}
{/if}
{$curCountry} <!-- nl -->
{$curLang} <!-- nl -->
{$test} <!-- Empty value  -->
{assign name="test" value="1"}

nope, 不,

{assign var="test" value="1"}

{$test}

Use name= like this http://www.smarty.net/docs/en/language.function.assign.tpl 像这样使用name = http://www.smarty.net/docs/en/language.function.assign.tpl

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM