/[cvs]/nfo/php/libs/org.netfrag.glib/DesignPattern/Loader.php
ViewVC logotype

Diff of /nfo/php/libs/org.netfrag.glib/DesignPattern/Loader.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by joko, Mon Feb 3 14:44:35 2003 UTC revision 1.2 by joko, Tue Feb 4 08:20:34 2003 UTC
# Line 3  Line 3 
3  //    $Id$  //    $Id$
4  //    -------------------------------------------------------------------------  //    -------------------------------------------------------------------------
5  //    $Log$  //    $Log$
6    //    Revision 1.2  2003/02/04 08:20:34  joko
7    //    + should now be independent from former encapsulation inside the 'Site'-object
8    //
9  //    Revision 1.1  2003/02/03 14:44:35  joko  //    Revision 1.1  2003/02/03 14:44:35  joko
10  //    + initial commit  //    + initial commit
11  //    + refactored from flib/Site/Loader.php  //    + refactored from flib/Site/Loader.php
# Line 26  Line 29 
29    
30  class DesignPattern_Loader extends DesignPattern_Logger {  class DesignPattern_Loader extends DesignPattern_Logger {
31    
32      var $parent;
33    
34    function includeFile($filename, $args = array()) {    function includeFile($filename, $args = array()) {
35      $this->log( get_class($this) . "->includeFile( filename $filename )", LOG_DEBUG);      $this->log( get_class($this) . "->includeFile( filename $filename )", LOG_DEBUG);
36        // TODO: capture errors (e.g. via an eval) here?
37      if (include($filename)) {      if (include($filename)) {
38        return 1;        return 1;
39      }      }
# Line 38  class DesignPattern_Loader extends Desig Line 44  class DesignPattern_Loader extends Desig
44      $postfix = "";      $postfix = "";
45      $this->log( get_class($this) . "->loadComponent( name $name, type $type )", LOG_DEBUG);      $this->log( get_class($this) . "->loadComponent( name $name, type $type )", LOG_DEBUG);
46            
47        $parent = $this->parent;
48        
49      // TODO: croak somewhere (STDOUT?, logger?) if unknown type gets used here      // TODO: croak somewhere (STDOUT?, logger?) if unknown type gets used here
50      switch ($type) {      switch ($type) {
51    
52        case "handler":        case "handler":
53          $prefix = $this->site->config[path][base] . 'core/handler/';          $prefix = $this->$parent->config[path][handler];
54          //$postfix = ".handler.php";          //$postfix = ".handler.php";
55          $postfix = ".php";          $postfix = ".php";
56          $includefile = "$prefix$name$postfix";          $includefile = "$prefix$name$postfix";
# Line 50  class DesignPattern_Loader extends Desig Line 58  class DesignPattern_Loader extends Desig
58          break;          break;
59    
60        case "page":        case "page":
61          $prefix = $this->site->config[path][base] . 'core/pages/';          $prefix = $this->$parent->config[path][pages];
62          $postfix = ".page";          $postfix = ".page";
63          $includefile = "$prefix$name$postfix";          $includefile = "$prefix$name$postfix";
64          return $this->includeFile($includefile, $arguments );          return $this->includeFile($includefile, $arguments );
# Line 58  class DesignPattern_Loader extends Desig Line 66  class DesignPattern_Loader extends Desig
66    
67        case "template":        case "template":
68          // TODO: re-activate this (unset smarty's default directory or handle differently (generic))          // TODO: re-activate this (unset smarty's default directory or handle differently (generic))
69          //$prefix = $this->site->config[path][base] . 'core/templates/';          //$prefix = $this->$parent->config[path][base] . 'core/templates/';
70          $prefix = '';          $prefix = '';
71          $postfix = ".html";          $postfix = ".html";
72          $includefile = "$prefix$name$postfix";          $includefile = "$prefix$name$postfix";
73          //return $this->includeFile($includefile);          //return $this->includeFile($includefile);
74          return $this->site->template->display($includefile, array(          return $this->$parent->template->display($includefile, array(
75            'cache_key' => $arguments[cache_key],            'cache_key' => $arguments[cache_key],
76            'interpolate' => $arguments['vars'],            'interpolate' => $arguments['vars'],
77            'return' => $arguments['return']            'return' => $arguments['return']

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed