dongpang1898 2013-12-09 16:42
浏览 51
已采纳

使用TinyButStrong,如何将结果加载到选项标签中?

Environment: Apache/2.4.4 (Win32) OpenSSL/0.9.8y PHP/5.4.19

I'm new to using TinyButStrong.

Got results back from MYSQL stored Procedure, data looks like this:

vardump($auth_user_list); 
//example of output
array(10)
{ 
  [0]=> array(2) 
  { 
    ["id"]=> string(1) "1" 
    ["login"]=> string(5) "User1" 
  } 
  [1]=> array(2) 
  { 
    ["id"]=> string(1) "2" 
    ["login"]=> string(5) "User2" 
  }
...
 } 

Using TinyButStrong I merge the results

$TBS->MergeBlock('auth_user_list',$auth_user_list);

On the loading page:

<select id="user_list" name="user_list" onchange="$('#username').val(this.options[this.selectedIndex].text)">
      <option>Select user<option>    
      <option>[var.auth_user_list.login; block=opt]</option>                                
 </select> 

The options in the results are not loading in my select list. What am I doing incorrectly - I have followed the templates.

I also get this notice since I have my error_reporting set to E_ALL that

Notice: Array to string conversion in C:\xampp\htdocs\Landells\classes\tbs_class_php5.php on line 1253
  • 写回答

2条回答 默认 最新

  • duanaigua4033 2013-12-09 21:29
    关注

    Since your are merging a block named auth_user_list, your template should be:

    <option>[auth_user_list.login;block=option]</option>
    

    var is a prefix for merging tags embedded in some parameters such as if/then/else/script/... In older TBS version it was also used to merge automatic fields, but not blocks.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 springboot 3.0 实现Security 6.x版本集成
  • ¥15 PHP-8.1 镜像无法用dockerfile里的CMD命令启动 只能进入容器启动,如何解决?(操作系统-ubuntu)
  • ¥15 请帮我解决一下下面六个代码
  • ¥15 关于资源监视工具的e-care有知道的嘛
  • ¥35 MIMO天线稀疏阵列排布问题
  • ¥60 用visual studio编写程序,利用间接平差求解水准网
  • ¥15 Llama如何调用shell或者Python
  • ¥20 谁能帮我挨个解读这个php语言编的代码什么意思?
  • ¥15 win10权限管理,限制普通用户使用删除功能
  • ¥15 minnio内存占用过大,内存没被回收(Windows环境)