在Sarty阵列中的参考指数方面遇到一些麻烦。 我认为,这是因为我使用指数时的变量是显而易见的。 我如何在模板中把这种扼杀当作一种愤怒?
感谢。
在Sarty阵列中的参考指数方面遇到一些麻烦。 我认为,这是因为我使用指数时的变量是显而易见的。 我如何在模板中把这种扼杀当作一种愤怒?
感谢。
documentation 有许多使用实例,特别是在获取阵列要素方面。
{$foo} <-- displaying a simple variable (non array/object)
{$foo[4]} <-- display the 5th element of a zero-indexed array
{$foo.bar} <-- display the "bar" key value of an array, similar to PHP $foo[ bar ]
{$foo.$bar} <-- display variable key value of an array, similar to PHP $foo[$bar]
{$foo[bar]} <-- syntax only valid in a section loop, see {section}
如果我正确理解问题,{$vari intval}
I believe that it is because the variable I am using as the index is a string
我不同意这种看法:
$arr = array( a );
$i = 0 ;
echo $arr[$i]; // echos a
我认为问题在于其他地方。 如果你有进一步的问题,你应列入你的一些法典。
如果它已经分配到变量,即美元,那么你就可以确定这样的变量类型:
{$converted = settype ($var, integer )}
你不必使用折中值,但如果你没有分配,则ool将在你的网页上展示。
既然不允许我发表评论(doh),那么就只能说,@webbiedave代码在实验室是正确的,但用粗略地说,它就是要做的。 i 仅仅花了太多时间试图说明为什么不从模板中阵列获取数据,而且发现,一阵有惯用钥匙和用于婚姻中关键参数,因此它会像预期的那样努力工作。 i 解决:
<!--{debug says}
{$item}=> Array (2)
name=> "lalala"
id => "123"
...
{$arrays} => Array (7)
123=> Array (3)
other_part_i_care=> "bebebe"
...
-->
{$arrays[$item.id].other_part_i_care} <!--this doesnt return anything-->
{assign var= item_id value=$item.id} <!--my guess here it gets interpreted as int -->
{$arrays[$item_id].other_part_i_care} <!--this return expected outcome-->
I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...
<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...
I found this script online that creates a thumbnail out of a image but the thumbnail image is created with poor quality how can I improve the quality of the image. And is there a better way to create ...
如何确认来自正确来源的数字。
Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...
I wonder there is a way to post a message to a facebook business page with cURL? thanks
I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...
How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...