Show
Ignore:
Timestamp:
08/05/05 15:51:01 (3 years ago)
Author:
schst
Message:

setRoot() may now be used to set the root for one reader (this breaks existing readers), added some documentation to the DB reader

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/patTemplate/Reader/DB.php

    r412 r413  
    4949 
    5050   /** 
    51     * read templates from any input  
     51    * read templates from the database 
     52    * 
     53    * Input may either be an SQL query or a string defining the location 
     54    * of the template using the format: 
     55    * <code> 
     56    * table[@key=value]/@templateField 
     57    * </code> 
    5258    * 
    5359    * @final 
     
    6773 
    6874   /** 
     75    * fetch the template data from the database 
    6976    * 
    70     * 
    71     * 
     77    * @access   protected 
     78    * @param    string      input to read from 
    7279    */ 
    7380    function getDataFromDb($input) 
     
    8289 
    8390        // establish connection 
    84         $db = &DB::connect($this->_options['root']); 
     91        $db = &DB::connect($this->getTemplateRoot()); 
    8592        if (PEAR::isError($db)) { 
    8693            return patErrorManager::raiseError(PATTEMPLATE_READER_DB_ERROR_NO_CONNECTION, 'Could not establish database connection: ' . $db->getMessage()); 
  • trunk/patTemplate/Reader/File.php

    r394 r413  
    117117            return $filename; 
    118118        } else { 
    119              
    120             if (!is_array($this->_options['root'])) { 
    121                 $this->_options['root'] = array($this->_options['root']); 
     119            $rootFolders = $this->getTemplateRoot(); 
     120            if (!is_array($rootFolders)) { 
     121                $rootFolders = array($rootFolders); 
    122122            } 
    123             foreach ($this->_options['root'] as $root) { 
     123            foreach ($rootFolders as $root) { 
    124124                if ($relativeTo === false) { 
    125125                    $baseDir = $root; 
  • trunk/patTemplate/Reader/IT.php

    r232 r413  
    193193    function _resolveFullPath( $filename ) 
    194194    { 
    195         $baseDir   =   $this->_options['root']
    196         $fullPath  =   $baseDir . '/' . $filename; 
     195        $baseDir  = $this->getTemplateRoot()
     196        $fullPath = $baseDir . '/' . $filename; 
    197197        return  $fullPath; 
    198198    } 
     
    207207    function _getFileContents( $file ) 
    208208    { 
    209  
    210209        if( !file_exists( $file ) || !is_readable( $file ) ) 
    211210        {