Categories > TinyButStrong general >

script=somescript.php with action=something

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: TomH
Date: 2007-12-17
Time: 14:46

script=somescript.php with action=something

Skrol29,
Form your post in http://www.tinybutstrong.com/forum.php?msg_id=8486#

This seems extremely valuable if it passes a name=value pair to the subscript , but I am not able to find any example/documentation about the "action=menu" custom parameter you mentioned above.

Can you please say more about it?

What triggers TBS to recognize and pass the parameter, is it that it is being in conjunction with the "script=" direction?

Does this custom parameter trick work in other situations?

You frequently uncover little jewels like this in the forum - we must all read every post ;)


Thanks a lot for TBS,
TomH
By: Skrol29
Date: 2007-12-17
Time: 18:19

Re: script=somescript.php with action=something

Hi TomH,

http://www.tinybutstrong.com/manual.php#html_field_prm_script
TBS gives to you predefined local variables that can be used in your script:
- $CurrVal refers to the current value of the field. It can be modified.
- $CurrPrm refers to the array of field's parameters.
- $this refers to the current TBS instance. (See parameter subtpl for good usage)
Thus you can retrieve action=something using the local variable $CurrPrm['action'].
By: TomH
Date: 2007-12-18
Time: 03:34

Re: script=somescript.php with action=something

Thx Skrol29,
Actually I did see that info in the doc's - I simply was not able to see the connection in the CurrPrm[] aspect.

I tested a little and now see how it works for TBS value passed from the main script to the subscript - but so far I cannot pass a parameter when doing a TBS Block merge(with parameter added in the block definition) in the subscript. The $CurrPrm (in the subscript) does not  seem to exist and the $CurrRec array does not include the parameter/value pair.

Is that the expected behavior -or- am I missing something?

Thanks for TBS,
TomH
By: mgb
Date: 2007-12-19
Time: 10:23

Re: script=somescript.php with action=something

Hi TomH
When you say Subscript do you mean subtpl?
if so the same variables should be present as under a normal script
---snip---
[var.file;script=specialbox.php;subtpl]
<?php
  echo('* Here include a subtemplate *');
  $this->LoadTemplate($CurrVal);
  $this->MergeBlock('blk1',$GLOBALS['conn_id'],'SELECT * FROM table1');
  $this->Show();
?>
$CurrVal is a local variable provided by TBS when using parameter script ; this variable is a reference to the value of the field currently merged. In the example above, $CurrVal has the value of the global variable $file. You can replace it, for example, by the name of the subtemplate to load (for example: 'mysubtpl.htm'). See parameter script for more information.

---/snip---
By: mgb
Date: 2007-12-19
Time: 10:47

Re: script=somescript.php with action=something

Hi Skrol29
On a side note. How much overheat, if noticable, is subtpl compared to script= without?
Have any benchmarking been done on this?

Anyways I guess I have to use it if I want to have subcaching.
Also, are there any documentation on how to write plug-ins?
Or do I have to do code-browsing on existing plug-ins to learn? And finally you mentioned that the subcaching has already been brainstormed. Are there any possibility for me to get hold of any thoughts written down on the subject?
Then I will attempt to do a contribution to tbs in the near future.
By: Skrol29
Date: 2007-12-20
Time: 01:27

Re: script=somescript.php with action=something

Hi Mgb,

> How much overheat, if noticable, is subtpl compared to script= without?

There is no bench but you cannot insert content without parameter "subtpl". Witout it, the subscript is run, but nothing is inserted. If any output is provided by the subscript, it will be output anywhere in the final page (probably at the beginning).

>are there any documentation on how to write plug-ins?
No a good doc, but you have a skeleton provided with other plug-ins. This skeleton has lot of comments.

> the subcaching has already been brainstormed. Are there any
> possibility for me to get hold of any thoughts written down on the
> subject?

Not so easy. It is not a documented work.
By: mgb
Date: 2007-12-20
Time: 13:15

Re: script=somescript.php with action=something

Hi Skrol29

> There is no bench but you cannot insert content without parameter "subtpl". Witout it, the subscript is run, but nothing is inserted. If any output is provided by the subscript, it will be output anywhere in the final page (probably at the beginning).

How about this:
<html>
...
[subtpl;script=dosomething.php]
...
</html>

dosomething.php
$tbs = '[var.msg][blk....]';
$this->MergeBlock('subtpl','text',$tbs);
$array = array(...);
$this->MergeBlock('blk',$array);

I am not really sure about the '$this->' but alternately you could get
it from GLOBALS?
Of course this wont help with the subcaching issues.


---
About the benchmarks I guess its not really anything to care about,
since it would require a quite heave load on the server before the
overheat will be noticeable :)
I just read somewhere (I think it was the mailing-list) that you have
done extensive benchmarking on tbs while developing and was wondering if
this where a part you had also been looking at.

Any chance your benchmark results could be made public on the website or
somewhere else?