Categories > TinyButStrong general >

trying top run external script

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Jorge
Date: 2004-02-19
Time: 23:37

trying top run external script

Hi ,

I do a SQL query where a get row data

PHP side:
$query = "SELECT id, name, date1, date2, date3 from mydatabase";

$RecCnt = $TBS->MergeBlock('blk1',$cnx_id,$query,$PageSize,$PageNum,$RecCnt) ;
$TBS->MergeNavigationBar('nv',7,$PageNum,$RecCnt,$PageSize) ;

I'm trying to "order" and only show the greater date from date1, date2 and date3

so I add a small function

function lastactive($NomBloc,&$CurrRec,&$DetailSrc,$RecNum){
// Calcul ONLINE / OFFLINE
$x[] = $CurrRec['date1'];
$x[] = $CurrRec['date2'];
$x[] = $CurrRec['date3'];
rsort($x);
$CurrRec['lastactivedate'] = $x[0];
}
to get the right date..

The problem is that now...i'm just trying to dsiplay the result...and there's where it comes bad for me:

I've tryed on template side:

[blk1.id]
[blk1.name]
[blk1.lastactivedate]

or even,

[blk1.id;onsection=lastactive]
[blk1.name]
[blk1.lastactivedate]

but nothing works... :(

Where am I wrong?

Thanks
By: Skrol29
Date: 2004-02-20
Time: 14:10

Re: trying top run external script


Did you think of putting the parameter 'onsection=lastactive' ? into the block tag ?

Just another remark:
$CurrRec['lastactivedate'] = min($CurrRec['date1'],$CurrRec['date2'],$CurrRec['date3']) ;
should be more simple for your lastactive() function.
By: Jorge
Date: 2004-02-23
Time: 01:16

Re: trying top run external script

Did you think of putting the parameter 'onsection=lastactive' ? into the block tag ?

What do you mean about it?
I already put "onsection=lastactive", didn't I? or is it wrong placed on my code?

Can you provide an example?

Thanks
By: Jorge
Date: 2004-02-23
Time: 03:57

Re: trying top run external script

Sorry, forget to post the HTML code...



[blk1.date1;onsection=lastactive]


Where date1 is a date comming from my SQL request (exist or =0)

Can't i put a new variable that doesn't exist from my database, and affect a value with my fonction? (even without defining it into my PHP code?)

by the way , i used 'date1' so I don't get errors.


and PHP:

function lastactive($FieldName,&$CurrRec,&$DetailSrc,$RecNum) {
$CurrRec['date1'] = min($CurrRec['date1'],$CurrRec['date2'],$CurrRec['date3']) ;
}


And it doesn't work... :(

trying to understand...where am I wrong?  Thanks for your help