TinyButStrong - the PHP Template Engine
Categories > TBS next version >

Different Design Sets

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

By: Mra
Date: 2008-02-05
Time: 05:52

Different Design Sets

Hi,

first of all, I have to tell you that TinyButStrong is a great template engine and it convinced me instantly to use it for my next project.

However, I tried to put it in and it could not serve all needs for my project.

Most popular websites have different design sets.  I also want to add different design sets to my website.  But I do not want to choose the design set with PHP.  Therefore, I would like to have a method to define a special style-set.

In my old template engine, I could choose a design set first of all just by saying:

$templates = new Templates ( $styleset );

I had a folder templates with all my templates in it.  If there was a folder with the name $styleset, this was assigned as the folder where to find all template files.  E.g., if I displayed a file called "template.tpl", and it was automatically opened from styles/$styleset/template.tpl.

There was also one standard folder, which was called standard.  If $styleset was undefined or there was not such a folder, it automatically assigned "standard" as the design set.  It also opened a template from that folder if the requested template did not exist in the $styleset-folder.  This had the advantage that I did not have to copy all files from one design set to the other if they were the same.

I think that is a really good idea.  Unfortunately, the other parts of the engine suck, which is why I switched to TinyButStrong.

I know that a lot of people want to use templates different or with relative URLs.  But if you make all that stuff optional, it would be no harm to anybody.  It just makes the engine better for those like me who want to use design sets that way.

What do you think?

Thank you for your attention.
By: Skrol29
Date: 2008-02-06
Time: 00:08

Re: Different Design Sets

Hi Mra,

This is not a built-in feature. It could be the purpose for a plug-in, but you can also cook it in your application with few code.

For example you can store the key of your styleset in a global variable $styleset. This key can be the name of a directroy, then you just have to use $styleset in LoadTemplate() ans use [var.styleset] in parameters "script" and "file" for subtemplates.

This is the same if your key is just a part of the file names.

And TBS has a feature to search a subtemplate in the last directory used by TBS. This can also be an idea for style set.