Categories > TinyButStrong general >

can i use %p1% as parameter for a function?

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: PsiTrax
Date: 2004-07-22
Time: 01:28

can i use %p1% as parameter for a function?

Hi,
i have a Function which handles the MySQL-Query for me and returns a Array which a wanna Merge as Sub-Block but the parameter
$a -> MergeBlock("subblk","array",MyFunktion("%p1%");
want get replaced by its value.

i think its not possible or is it?
By: Skrol29
Date: 2004-07-22
Time: 17:49

Re: can i use %p1% as parameter for a function?

Hi,

%p1% works only for query writen with a text string.
Your function will be called only one time.

But you can do what you want with a custom data function.
Here is an example of what you can do:
$a->MergeBlock("subblk","xxx","%p1%);


function tbsdb_xxx_open(&$Source,&$Query) {
  return MyFunktion($Query); //return an array depending to the parameter passed through variable $Query
}
function tbsdb_xxx_fetch(&$Rs,$Nbr) {
  if ($Nbr>count($Rs)) {
    return false;
  } else {
    return $Rs[$Nbr];
  }
}
function tbsdb_xxx_close(&$Rs) {
  //array doesn't need to be closed
}
By: PsiTrax
Date: 2004-07-22
Time: 18:04

Re: can i use %p1% as parameter for a function?

oh good idea
thx a lot
By: Condutiarii
Date: 2004-07-22
Time: 22:10

Re: can i use %p1% as parameter for a function?

Skrol29, it's not the first time you give us a good tip with TBS. Why do you not build a tip section to pool them ? A knowledge base style !

By: Skrol29
Date: 2004-07-23
Time: 08:28

Re: can i use %p1% as parameter for a function?

That's a good idea.
I will prepare a tip section.