By: wspras
Date: 2011-02-22
Time: 16:09
|
Warning Scalar Value in MergeBlock with event functionHi ,
I have error PHP <code>Warning: Cannot use a scalar value as an array in \wspras\questions\simulasi.php on line 167</code> HTML Script is: <code> <table> <tr><td> <div style="text-align:justify;">[mb.TEACHER;ondata=event_modul;block=tr;htmlconv=no]</div> </td> </tr> <tr> <td ><strong>[+sb.NOMOR;htmlconv=no+].</strong> </td> <td >[+sb.SCHOOL;block=tr;p1=[+mb.$+];htmlconv=no+]</td> </tr> <tr> <td><strong>[+sb.NOMOR;htmlconv=no+].</strong> </td> <td >[+sb.SCHOOL;block=tr;htmlconv=no+]</td> </tr> </table> </code> PHP Script is: <code> //merger block $TBS->MergeBlock('mb','array','ByTeacher'); $TBS->MergeBlock('sb','array','ByTeacher[%p1%][HISTORY]'); //on event function merge block function event_modul($BlockName,&$CurrRec,$RecNum){ $CurrRec['TEACHER'] = htmlNormal($CurrRec['TEACHER']); //htmlNormal fixed some string and this LINE 167 } </code> How solution for this problem ? Thanks. Regard, wspras |
||||
By: Skrol29
Date: 2011-02-22
Time: 22:56
|
Re: Warning Scalar Value in MergeBlock with event functionHi,
It seams that $CurrRec in event_modul() is not always an array as you expect. $CurrRec is the item exctracted by TBS from the global variable $ByTeacher. You can check the contents of $ByTeacher with the code:
You should also check the $CurrRec variable in event_modul() in order to catch when it is not an array. By the way, I've noticed in your HTML template that the main block "mb" is not embedding the sub-block "sb" as we could guess. It is also strange that you've defined the "sb" block with two sections while the second one seems quite the same as the first one. |
||||
By: wspras
Date: 2011-02-23
Time: 00:48
|
Re: Warning Scalar Value in MergeBlock with event functionHi ,
Result array $ByTeacher :
Yes, i am changed HTML
Then, i am tested this without use event_modul()
OK, TBS can display my data with very good. But, when i am trying uncomment LINE 167 ,
Can help again? Regard, wspras |
||||
By: Skrol29
Date: 2011-02-23
Time: 01:20
|
Re: Warning Scalar Value in MergeBlock with event functionI don't think it comes from TBS. Can you try the following for debugging ?
|
||||
By: wspras
Date: 2011-02-23
Time: 02:21
|
Re: Warning Scalar Value in MergeBlock with event functionHi Skrol,
After this
Result :
$CurrRec type is Boolean? by the way. for readable HTML little fixed
Oy, this $ByTeacher
Full code : http://www.4shared.com/file/GI1sIK0a/test-tbs-teacher.html I have started from Example of subblocks in TBS, then i modified example when added event_function (in dynamic HTML) , same error show up. How about this problem? Thanks again. |
||||
By: Skrol29
Date: 2011-02-23
Time: 10:48
|
Re: Warning Scalar Value in MergeBlock with event functionHi,
Thank you very much for your snippet download for reproducing the problem. You've pointed on a bug. I'll fix it soon, but here is a workaround: replace
|
||||
By: wspras
Date: 2011-02-23
Time: 16:44
|
Re: Warning Scalar Value in MergeBlock with event functionThanks for solution,
I am using Automatic subbloks now. Cause of u & TBS my programs implemented more efficient regard. wspras. |