The first problem in the GT template system, that GT template is using FLAT template set.
Using my suggestions you can keep compatibility with old template sets, while adding features like inheritance, directories, template variable files, template set config variables.
Inheritance and directory features may cause a little speed decrease, but instead you get an easier modifiable template system, where you can do 1 change, that will affect all your sites, cobranded sites, or just a content part. Inheritance will make our life easier...
There will be no need to use inheritance or directories (you can turn off these features), but those who want to make their life easier, will have the ability to use these features.
The "Variable files" part is unfinished.
I have to go now, so I will work on it later, and will post an update with changes.
Until the ideas are finished your comments are welcome...
Best regards,
Webmaster33
Paid Support from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Using my suggestions you can keep compatibility with old template sets, while adding features like inheritance, directories, template variable files, template set config variables.
Inheritance and directory features may cause a little speed decrease, but instead you get an easier modifiable template system, where you can do 1 change, that will affect all your sites, cobranded sites, or just a content part. Inheritance will make our life easier...
There will be no need to use inheritance or directories (you can turn off these features), but those who want to make their life easier, will have the ability to use these features.
- Directories: You should add the vertical thinking into GT template system.
- I mean, there should be directories available in each template set, which inherits content from default templates.
- Directories will help us to group the site content easier. E.g. with directories contents, menus, javascripts, css, etc.
- There will be only 3 special directories: _config, _compiled and _local directories.
- The _config is the only new type, and will contain config file(s) which will control the template features, and the inheritance.
- Default (general) templates are placed into the "default" template set.
Example:
template set main folder is: /cgi-bin/gt/templates/
template sets are:
/cgi-bin/gt/templates/admin/
/cgi-bin/gt/templates/default/
/cgi-bin/gt/templates/mysite/
/cgi-bin/gt/templates/mysite_light/
/cgi-bin/gt/templates/mysite_dark/
/cgi-bin/gt/templates/mysite_nojava/
/cgi-bin/gt/templates/mysite_framed/
/cgi-bin/gt/templates/mypartnersite/
/cgi-bin/gt/templates/othersite/
- I mean, there should be directories available in each template set, which inherits content from default templates.
- Inheritance:
- There will be a special folder, named "default", which gaves us the skeleton of our site lookouts.
- Content of this "default" set is inherited in each template set, where a file is used (except, if it is turned off in in global config, turned off in default template set, or turned off in config of target tempate set).
- There will be possible to turn on/off the template inheritance using template config variables (explained later).
Example:
<%include /mypartnersite/menu/content.html%>- A file is included from "mypartnersite" set, "menu" dir.
- If /cgi-bin/gt/templates/mypartnersite/menu/content.html is missing => /cgi-bin/gt/templates/mypartnersite/content.html will be used instead (a debug level 2 warning should be noted).
- If /cgi-bin/gt/templates/mypartnersite/content.html is missing, then /cgi-bin/gt/templates/default/menu/content.html will be used instead (a debug level 2 warning should be noted).
- If /cgi-bin/gt/templates/default/menu/content.html is missing, then /cgi-bin/gt/templates/default/content.html will be used instead (a debug level 2 warning should be noted).
- If /cgi-bin/gt/templates/default/content.html is also missing, then fatal debug error will happen: "content.html is missing".
- A file is included from "mypartnersite" set, "menu" dir.
- There will be a special folder, named "default", which gaves us the skeleton of our site lookouts.
- Template set config:
- Each template set will have a config.
- Config file will be placed into "_config" dir.
- Config file will be named "config.txt".
- If config file is missing, config values are inherited from "default" template set, "_config" dir.
- If config file is missing from "default" template set, "_config" dir, template related config values are inherited from global config.
Example config file: /cgi-bin/gt/templates/mypartnersite/_config/config.txtCode:$CFG_template_set = {
{ 'mypartnersite' =>
# template_set_disabled: used for quickly disabling a template set.
# Default template set will be displayed, if disabled.
'template_set_disabled' => 1,
# inherit_from_template_set: name of template we are inherit from.
# if missing, "default" template set is used
'inherit_from_template_set' => 'mysite',
# template_set_inheritance:
# allows to inherit templates and directories from default template set
'template_set_inheritance' => 1,
# template_set_directories: allows to use directories in the template set
'template_set_directories' => 1,
# template_set_variable_files: allows to use variable files in the template set
'template_set_variable_files' => 1
}
}; - The globals.txt and language.txt should be placed into "_config" directory.
/cgi-bin/gt/templates/mypartnersite/_config/globals.txt
/cgi-bin/gt/templates/mypartnersite/_config/language.txt - if globals.txt or language.txt is missing from "/mypartnersite/_config/" directory, will look in "/mypartnersite/" template set (a debug level 2 warning should be noted).
- if globals.txt or language.txt is missing from "/default/_config/" directory, will look in "/default/_config/" template set (a debug level 2 warning should be noted).
- if globals.txt or language.txt is missing from "/default/" directory, then fatal debug error will happen: "globals.txt is missing".
- Since the globals.txt, language.txt, config.txt are perl evaluated (globals.txt especially), therefore this can be a potential security hole, IF we allow our cooperative partners to access these files. Therefore content of _config directories should be NOT editable by the partners. Need more thinking on risks of this.
- Also we should have some globals, what do we allow to be inherited for use in partner's site.
For security reasons, we should have full control over which globals we allow to inherit, and which not. In global config we should have a variable, where we are listing, which template sets are allowed to inherit, which global variables.
Editing of any globals (inhernited or not inherited) should be NOT allowed for Editors.
Admin should be able to give TRUSTED Editors to give a right to edit inherited AND/OR not inherited globals.
Example:Code:'allowed_globals_variable_inherit' => {
'default' => 1, # we allow full globals inheritance
'mysite' => 1, # we allow full globals inheritance
# array means the list of globals allowed to inherit
'mypartnersite' => [ 'cobrand_text', 'date', 'time', 'list_categories' ],
'other_cobrandsite' => [ 'cobrand_text', 'date', 'time' ],
'simple_partner' => 0,
}
- Each template set will have a config.
- Variable files (unfinished): Also variable files needed to be implemented.
- These variable files will have .var extension, and placed into the template set or inside a directory, where we want to change an inherited content.
- inherited content change can be done through these .var files.
- home.var will affect home.* templates, which are inherited from selected template set
- New variables: Some new variables should be used like: $source_path, $source_template_set, etc...
$source_template_set: the template set, from where we inherited this template: = "mypartner" or "default" or ""
$source_filename: the filename from where we inherited this template: = content.html
$source_dir: the dirname, from where we inherited this template. "dirname" or ""
$source_path: the path from where we inherited this template: = /$source_template_set/$source_dir
$source_filepath: the filepath from where we inherited this template: = /$source_template_set/$source_dir/$source_filename
$current_template_set: the template set we are currently in: = "mypartner"
$current_filename: the filename of this template: = "content.html"
$current_dir: the dirname, where we currently are: = "sidebar"
$current_path: the path we currently are: = /$source_template_set/$current_dir
$current_filepath: the path we currently are: = /$source_template_set/$current_dir/$current_filename
- Security warning: include should DENY usage of path, which is not beginning with $inherited_path path (espedially those which are pointing out outside of the template root)! Also should DENY $inherited_path/_compiled, $inherited_path/_config paths.
...
- These variable files will have .var extension, and placed into the template set or inside a directory, where we want to change an inherited content.
The "Variable files" part is unfinished.
I have to go now, so I will work on it later, and will post an update with changes.
Until the ideas are finished your comments are welcome...
Best regards,
Webmaster33
Paid Support from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...