By: Guido
Date: 2005-10-21
Time: 18:00
|
TBSOOo complexity of single textsHello,
First of all I'd like to say I appreciate your TBSOOo package very much as does exactly what I need. However I have a question about a very simple thing. I want to merge a single variable in a template, but it seems I have to make a complex construction to achieve this: $valuearray = array(array("key" => "value")); $OOo->MergeBlock("content", $valuearray); And in the template I have to insert: [content.key] Instead it would be more easy to be able to write: $OOo->MergeBlock("key", "value"); and in the template: [key] Is there any possibility to simplify the calls to TBSOOo like this except for writing my own wrapper? |
By: Skrol29
Date: 2005-10-21
Time: 18:13
|
Re: TBSOOo complexity of single textsHello Guido,
Method MergeField() is done for that. In one shot you merge several fields, and you can merges all sub keys of the array with it. Examples: ----------------------- PHP: $OOo->MergeField('f1',$value) Html: [f1] ----------------------- PHP: $arr = array('name'=>'boby'); $OOo->MergeField('f2',$value) Html: [f2.name] ----------------------- And so one... |
By: Skrol29
Date: 2005-10-23
Time: 09:40
|
Re: TBSOOo complexity of single textsAnd by the way, you can use a Var Field, which is automatically merged:
[var.valuearray.0.key] |
By: Guido
Date: 2005-11-02
Time: 00:02
|
Re: TBSOOo complexity of single textsThanks, that cleared up a lot!!
One other question, is it posible to disable the automatic merging of variables (like [var.x])? This feature could be a security problem when users of a system are free to specify their own document templates and they start using them to reveal variables like database passwords. |
By: Skrol29
Date: 2005-11-02
Time: 19:56
|
Re: TBSOOo complexity of single textsHello,
You cannot stop htem all, but you can define a security prefix for allowed global variables. This is explain here: http://www.tinybutstrong.com/manual.php#html_field_var |