TBS 3.5 beta

26 views
Skip to first unread message

Skrol29

unread,
May 4, 2009, 8:01:07 PM5/4/09
to TinyButStrong next version
Hello,

There was a long time since the last TBS version, but here it is.
The beta is available for download here :
http://tbs-next.googlegroups.com/web/tbs_v3.05b2009-05-05.zip

The package has a "What's News" file which I paste just above:
Have nice day.

***********************

The new features are currently being benched.
The new features for PHP 5 are available for both packages "PHP 4 or
higher" and "PHP 5 E_STRICT".
Please note that the features may change before the final version.
Feel free to send report and comments.

New features:
-------------

- New parameter 'att' which move a TBS field into a XML/HTML attribute
before to be merged.
Examples:
[var.x;att=class] moves into attribute 'class' of the first tag on
the left.
[var.x;att=div#class] moves into attribute 'class' of the first
<div> on the left.
[var.x;att=+div#class] moves into attribute 'class' of the first
<div> on the right.
[var.x;att=((div))#class] moves into attribute 'class' of the second
embedding <div> on the left.
[var.x;att=table+div#class] moves into attribute 'class' of the
first <div> after the first <table> on the left.
Restriction for MergeBlock() : a TBS error occurs when move on the
right over another TBS fields.

Options that should be developed:
Parameter 'attdel' which allows to delete the attributes when the
value is empty.
Parameter 'attadd' which allows to add the value into the attribute
instead of replacing the existing value.

- MergeBlock() allows automatic sub-block. Works with new parameters
'sub1', 'sub2', 'sub3', ...
(Idea given by Olivier)
Example: [bl1.ParentName;block=tr+tr;sub1=Childs] ...
[bl1_sub1.ChildName;block=tr]
This example assumes that block 'bl1' is merged with a data source
which is an array or an object.
And that this data source has a column Childs which is itself an
array or an object.
Block 'bl1_sub1' must be embedded into 'bl1'.

- MergeField() allows to define a set of default parameters.
(Idea given by Gasper)
Example: $TBS->MergeField('mf',date('Ymd'),false,array('frm'=>'dd/mm/
yyyy'));

- Parameter 'getbody' now allows to get multiparts, and to take tags
or not.
Example: [onload;file=;getbody=(script)+(style)+body]
The main goal of this feature is to include Javascript and styles
from subtemplates.

- MergeBlock() natively supports Iterator, ArrayObject and
IteratorAggregate.
(Idea given by Olivier)

- MergeBlock() allows columns names with spaces.

- Public and Static are defined when appropriate.
Some methods are leaved public because they are a hook for some
plugins.

Fixed bugs:
-----------
- Fatal error: Call to undefined method
clsTbsDataSource::f_Misc_CheckArgLst().
- Warning of 2 undefined variables. http://tinybutstrong.com/forum.php?msg_id=9265
- http://www.tinybutstrong.com/forum.php?msg_id=9508 (fixed but not
yet tested)

***********************

TomH

unread,
May 4, 2009, 11:14:02 PM5/4/09
to TinyButStrong next version
Hello Skrol,
Thanks for all your hard work adding new features to TBS - nice!

I've tested v3.5beta against 20 of my TBS apps and got no unexpected
results. So for me backward compatibility is perfect.

I hope to begin learning to use the new 'params' and 'sub_blocks'
features next.

For automatic sub_blocks... how do you see the data coming from MySQL
query?
Or does the Childs data (sub-field) need to be already saved in db as
a php array?


ALso, I don't understand the new
> - MergeBlock() natively supports Iterator, ArrayObject and
> IteratorAggregate.
what are 'Iterator' & 'IteratorAggregate', or how to use it.
Maybe an example would help?

Thanks again for everything you do for us users,
TomH




On May 4, 8:01 pm, Skrol29 <skro...@gmail.com> wrote:
> Hello,
>
> There was a long time since the last TBS version, but ht no ere it is.
> -http://www.tinybutstrong.com/forum.php?msg_id=9508(fixed but not
> yet tested)
>
> ***********************

Skrol29

unread,
May 5, 2009, 5:13:54 AM5/5/09
to TinyButStrong next version
Hi,

I've forgot to tell about an important new feature :

- New property Assigned: allows to assign data for a futur MergeBlock
() or MergeField().
Example:
$TBS->Assigned['ass'] = array('mergeblock', &$data); // will be
merged when call $TBS->MergeBlock('ass')
$TBS->Assigned['autoass'] = array('mergeblock', &$data,
'auto'=>'onload'); // will be merged automaticall with [onload] fields
and block.
$TBS->Assigned['assfield'] = array('mergefield', date('Ymd')); //
will be merged when call $TBS->MergeField('mergefield')

The "What's News" file has been updated in the package.
Skrol29
> -http://www.tinybutstrong.com/forum.php?msg_id=9508(fixed but not
> yet tested)
>
> ***********************

Skrol29

unread,
May 5, 2009, 6:11:04 AM5/5/09
to TinyButStrong next version
Hi TomH,

Thank you very much for your tests.

> For automatic sub_blocks... how do you see the data coming from MySQL
> query? Or does the Childs data (sub-field) need to be already saved in db as
> a php array?

Yes Childs data (sub-field) need to be already saved as php array.
I don't know if it possible to save such data in db.

Automatic subblocks work only for data that can be automatically
retrieved without any new call.
This is possible only if such data are embedded into the main data.
That's why automatic subblocks work only if the data merged is a PHP
array or a PHP object.
An thus, it cannot be used with SQL statements.

> what are 'Iterator' & 'IteratorAggregate', or how to use it.
> Maybe an example would help?

Iterator and IteratorAggregate are two interfaces given in native with
PHP 5. You cannot use interfaces directly, but user classes can refer
to them. If a user class is "implemented" with the interface Iterator,
it means that this class must have methods rewind(), key(), current
(), next() and valid().

Example:
$ao = new ArrayObject();
$ao[] = array('id'=>'Iterator x12', 'name'=>'Toto');
$ao[] = array('id'=>'Iterator x13', 'name'=>'Tutu');
$ao[] = array('id'=>'Iterator x14', 'name'=>'Tata');
$ao[] = array('id'=>'Iterator x15', 'name'=>'Titi');

$TBS->MergeBlock('b', $ao); // TBS 3.5 supports ArrayObject
$TBS->MergeBlock('b', $ao->getIterator()); // TBS 3.5 supports
Iterators


I hope that will help :)
Skrol29.

TomH

unread,
May 5, 2009, 7:00:46 AM5/5/09
to tbs-...@googlegroups.com
Hi Skrol29,

Thanks for the extra information.

A question for enhancing the sub-field feature to be
possible to have it also work for a php 'list' as if the
list were an array
(a list like: 'Travel','Sports','Dancing','Fine Dining' )

MySQL has two very useful native data types ENUM() and SET()
that uses the 'list' structure for the stored data - I think
maybe being able to automatically merge that data would make
a great improvement.

Thanks again for TBS,
TomH




Skrol29 wrote:
> Hi TomH,
>
> Thank you very much fr your tests.

TomH

unread,
May 5, 2009, 7:14:33 AM5/5/09
to tbs-...@googlegroups.com
Skrol,

P.S. to previous message...

Sorry to not thinking also of the php 'serialize' function
as a candidate for auto sub block.

As you will know serialize() creates a string representation
of any php value (including array and object) that can then
be stored in a db. The string can then be unserialize()'ed
without losing their type and structure.

Perhaps that is a candidate for enhancing auto "sub block"

Thx,
TomH


------------------------------------------------------------
Hi Skrol29,

Thanks for the extra information.

A question for enhancing the sub-field feature to be
possible to have it also work for a php 'list' as if the
list were an array
(a list like: 'Travel','Sports','Dancing','Fine Dining' )

MySQL has two very useful native data types ENUM() and SET()
that uses the 'list' structure for the stored data - I think
maybe being able to automatically merge that data would make
a great improvement.

Thanks again for TBS,
TomH




Skrol29 wrote:
> Hi TomH,
>
> Thank you very much fr your tests.
Reply all
Reply to author
Forward
0 new messages