Menu

#47 Choosing a template

closed
nobody
None
1
2003-01-24
2002-04-16
No

This is not really a bug, but I think it will lead to bugs.

This code fragment is repeated throughout...with subtle
variations and inconsistencies:

/* Templates */

$default_template = "xxxxxx.tpl";

if( empty($tpl) ) {
$tpl = $default_template;
} elseif ( file_exists($_PSL['templatedir'] . "/" .
basename($tpl) . ".tpl") ) {
$tpl = basename($tpl) . ".tpl";
} else {
debug ( "xxxxx:Template file doesn't exist, using
default instead", $tpl);
$tpl = $default_template;
}

How about replacing it with something in function.inc,
or in a phpSlash base class?

Idally, it would look for $tpl
- in the current skin for the current language
- in the current skin for the default language
before falling back to default_template.

P

Discussion

  • Peter Cruickshank

    • priority: 5 --> 1
     
  • Joe Stewart

    Joe Stewart - 2002-04-16

    Logged In: YES
    user_id=77269

    > How about replacing it with something in function.inc,

    This sounds like an excellent idea. There is another
    inconsistency - some classes load all the templates in the
    constructor, so the above code has references to a template
    array variable.

    > Idally, it would look for $tpl
    > - in the current skin for the current language
    > - in the current skin for the default language
    > before falling back to default_template.

    excellent idea.

     
  • Joe Stewart

    Joe Stewart - 2002-05-22

    Logged In: YES
    user_id=77269

    Moved to feature request.

     
  • Joe Stewart

    Joe Stewart - 2002-05-22
    • labels: 103600 -->
    • milestone: 102083 -->
     
  • Joe Stewart

    Joe Stewart - 2003-01-24

    Logged In: YES
    user_id=77269

    Most of this code was moved into slashTemplate( set_file).
    It checks the current skin and if not found looks in the
    parent skin ( if applicable).

     
  • Joe Stewart

    Joe Stewart - 2003-01-24
    • status: open --> closed
     

Log in to post a comment.