Categories > TinyButStrong general >

ONDATA problem

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Andrew4fr
Date: 2006-01-09
Time: 16:12

ONDATA problem

I have following code in PHP script
function ulist($BlockName,&$CurrRec,$RecNum) {
$tmp=$CurrRec['camera_desc'];
//some operation with $tmp
$CurrRec['camera_desc']=$tmp;
}
$TBS->MergeBlock('camblk',$GLOBALS['db_connection'],'SELECT firm_id, camera_desc FROM pbn_camera WHERE camera_id='.$_GET['camera']);
and following field in template
[camblk.camera_desk;ondata=ulist;htmlconv=no]
camera_desc is simple text with "newline" characters. But before merging I need make <ul> list from camera_desc. It's makes function ulist(), but method ONDATA not work. I need some help! Please!
By: Skrol29
Date: 2006-01-09
Time: 16:23

Re: ONDATA problem

Hello Andrew,

Your parameter 'ondata' is simply ignored beacause it's a Block parameter , and your block is defined in another Tag. Block parameter should be defined in the same tag that contain parameter "block=..." .
By: Andrew4fr
Date: 2006-01-09
Time: 16:28

Re: ONDATA problem

<p>[camblk.camera_feature;ondata=ulist;htmlconv=no;block=p]</p>
Not work too! But if i change "onload" to "onformat" - function ulist work. But in $CurrRec['camera_desc'] only first symbol of first line.
By: Skrol29
Date: 2006-01-09
Time: 17:03

Re: ONDATA problem

"block=p" is maybe ignored in this one if you've let another "block=" in a previous "camblk" tag which is considered first.
By: Andrew4fr
Date: 2006-01-09
Time: 18:01

Re: ONDATA problem

Yes. You are right. ONDATA work only if no more "camblk;block=" in template.
By: Andrew4fr
Date: 2006-01-10
Time: 12:17

Re: ONDATA problem

<p style="font-size:0.8em;">[feature.camera_feature;ondata=ulist;htmlconv=no;block=p;magnet=div]</p>
Function "ulist" is calling from template, but $CurrRec['camera_future']= $rez.'</ul>'; not work. Value don't change.
(example http://andrew.gtk.su/photonews/develop/index.php?camera=39)
function ulist($BlockName,&$CurrRec,$RecNum) {
$tmp = split("\n",$CurrRec['camera_feature']);
$rez='<ul>';
$size = count($tmp);
for($i=0; $i < $size ; $i++)
{
if(trim($tmp[$i]) != "")
$rez.="<li>$tmp[$i]</li>";
}
$CurrRec['camera_future']= $rez.'</ul>';
echo $rez.'</ul>';
}

By: Skrol29
Date: 2006-01-10
Time: 13:16

Re: ONDATA problem

You set "camera_future" and display "camera_feature".
Is that normal that they are two diffrent names?
By: Andrew4fr
Date: 2006-01-10
Time: 13:26

Re: ONDATA problem

Oh, I am sorry. It's my fault. All works OK!
And thaks again for support.