Categories > TinyButStrong general >

a new way to use TBS for all

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Mankiy
Date: 2003-07-19
Time: 06:44

a new way to use TBS for all

i found that sometimes, I need some extra information added at the end of a block, but then i would have to add that extra tag just to get it there......

the solution is this:
create your own tags

it has worked for me, and it gave me that extra flexibility I needed...

It also allows you to nest the blocks without having to extend it
so, bye bye to that extend thing :P

ex:
say you are blocking the table tag, but you want a white space between each table, but dont want to add an extra table row to do so, it would be excess code slowing down your page little by little.......


do this:
<mainblock>
<table>
<tr><td>
[main.name;block=mainblock]
</td></tr>
<tr><td>
[main.email]
</td></tr>
<tr><td>
[main.url]
</td></tr>
</table>
<br>
<br>
</mainblock>

Skrol, you should think about adding this to the documentation, adds a whole new lvl of flexibility to the coding, jsut for that extra stuff you might need or want, or just to help designers with understanding how the code works.....



I hope this helps anyone who needs that extra little thing to make your template perfect. :)
By: Skrol29
Date: 2003-07-19
Time: 11:35

Re: a new way to use TBS for all

Hello Mankiy,

That's a very good trip.
How didn't I think about it before !!??

I gonna add it in the manual, but I'm currently rewriting it so it may be take some times.
By: Mankiy
Date: 2003-07-19
Time: 19:12

Re: a new way to use TBS for all

k, good :)

glad u like it :)
By: mielem
Date: 2003-07-20
Time: 12:50

a possible initialize PHP var solution (see revious post)

Dear Skrol29,

I made some experiment abaut the question of PHP var initializing and I found a solution making a little change in the tbs_Merge_PhpVar function.
I introduced a 'novar' parameter to switch off the var existence control.
It appears to work but I haven't analyzed every line of your class code and, of course, YOU are the author of TBS.
So I present it here.

This is the last part of the tbs_Merge_PhpVar function:

                if (array_key_exists($x,$_tbs_PhpVarLst)) {
                    if ($Key===False) {
                        $Pos = tbs_Locator_Replace($Txt,$Loc,$GLOBALS[$_tbs_PhpVarLst[$x]],$HtmlConv) ;
                    } else {
                        $Pos = tbs_Locator_Replace($Txt,$Loc,$GLOBALS[$_tbs_PhpVarLst[$x]][$Key],$HtmlConv) ;
                    }
                } else {               
                    if (!array_key_exists('novar',$Loc->PrmLst)) { // if 'novar' parameter is not set
                        tbs_Misc_Alert('Warning','Merge PhpVar','The field ['.$FieldName.'.'.$Loc->SubName.'] can not be merged because there is no corresponding PHP variable.') ;
                    } else { // if 'novar' parameter is set
                        $Pos = tbs_Locator_Replace($Txt,$Loc,$GLOBALS[$_tbs_PhpVarLst['']],$HtmlConv) ;
                    }               
                }
            }
        }
    } while ($Loc!==False) ;
}

What do you thonk about it?