Gossamer Forum
Home : Gossamer Threads Inc. : Discussion :

Re: [GT Dev Team] Gossamer Links 3.0 - Template system changes

Quote Reply
Re: [GT Dev Team] Gossamer Links 3.0 - Template system changes In reply to
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.

  1. 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/



  2. 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".



  3. 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.txt
      Code:
      $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,
      }



  4. 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.


      ...


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...
Subject Author Views Date
Thread Gossamer Links 3.0 mockup GT Dev Team 18031 Dec 7, 2004, 1:24 PM
Thread Re: [GT Dev Team] Gossamer Links 3.0 mockup
DeadMan 17504 Jan 22, 2005, 5:07 PM
Post Re: [deadroot] Gossamer Links 3.0 mockup
archer 17396 Jan 25, 2005, 4:52 PM
Thread Re: [deadroot] Gossamer Links 3.0 mockup
GT Dev Team 17386 Jan 26, 2005, 4:25 PM
Thread Re: [GT Dev Team] Gossamer Links 3.0 mockup
DeadMan 17356 Jan 26, 2005, 4:34 PM
Post Re: [deadroot] Gossamer Links 3.0 mockup
GT Dev Team 17354 Jan 26, 2005, 4:35 PM
Post Re: [GT Dev Team] Gossamer Links 3.0 mockup
ManuGermany 16884 Mar 3, 2005, 2:40 AM
Thread Re: [GT Dev Team] Gossamer Links 3.0 mockup
DeadMan 17451 Jan 26, 2005, 3:19 PM
Post Re: [deadroot] Gossamer Links 3.0 mockup
GT Dev Team 17348 Jan 26, 2005, 4:29 PM
Thread Re: [GT Dev Team] Gossamer Links 3.0 - Template system changes
webmaster33 17462 Feb 4, 2005, 6:14 AM
Thread Re: [webmaster33] Gossamer Links 3.0 - Template system changes
GT Dev Team 17299 Feb 4, 2005, 12:40 PM
Thread Re: [GT Dev Team] Gossamer Links 3.0 - Template system changes
webmaster33 17255 Feb 6, 2005, 12:10 PM
Thread Re: [webmaster33] Gossamer Links 3.0 - Template system changes
GT Dev Team 17282 Feb 7, 2005, 1:45 PM
Thread Re: [GT Dev Team] Gossamer Links 3.0 - Template system changes
webmaster33 17154 Feb 7, 2005, 10:07 PM
Thread Re: [webmaster33] Gossamer Links 3.0 - Template system changes
Gmail 17149 Feb 8, 2005, 2:38 AM
Thread Re: [Gmail] Gossamer Links 3.0 - Template system changes
webmaster33 17148 Feb 8, 2005, 7:51 AM
Thread Re: [webmaster33] Gossamer Links 3.0 - Template system changes
Gmail 17167 Feb 8, 2005, 9:47 AM
Post Re: [Gmail] Gossamer Links 3.0 - Template system changes
webmaster33 17082 Feb 8, 2005, 11:06 AM
Post Re: [GT Dev Team] Gossamer Links 3.0 - Template system changes
webmaster33 17140 Feb 8, 2005, 11:21 AM
Post Re: [GT Dev Team] Gossamer Links 3.0 - Template system changes
webmaster33 17062 Feb 26, 2005, 4:43 PM
Post Re: [GT Dev Team] Gossamer Links 3.0 - Template system changes, part 2
webmaster33 17273 Feb 6, 2005, 5:48 PM
Post Re: [GT Dev Team] Gossamer Links 3.0 mockup
ericho 17036 Feb 14, 2005, 7:30 AM
Post Re: [GT Dev Team] Gossamer Links 3.0 - Admin suggestion
webmaster33 17042 Feb 17, 2005, 4:56 AM