Вопрос

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
Это было полезно?

Решение

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.

Другие советы

I never referenced the block correctly.

It should be:

<option>[var.auth_user_list.login; block=option]</option>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top