Development

Changeset 7846

You must first sign up to be able to contribute.

Changeset 7846

Show
Ignore:
Timestamp:
03/12/08 23:54:04 (7 months ago)
Author:
fabien
Message:

allowed customisation of decorator directory (closes #3056 - patch from pookey)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/config/sfApplicationConfiguration.class.php

    r7828 r7846  
    342342 
    343343  /** 
     344   * Gets the decorator directories. 
     345   * 
     346   * @param  string The template file 
     347   * 
     348   * @return array  An array of the decorator directories 
     349   * 
     350   */ 
     351  public function getDecoratorDirs() 
     352  { 
     353    return array(sfConfig::get('sf_app_template_dir')); 
     354  } 
     355 
     356  /** 
     357   * Gets the decorator directory for a given template. 
     358   * 
     359   * @param  string The template file 
     360   * 
     361   * @return string A template directory 
     362   */ 
     363  public function getDecoratorDir($template) 
     364  { 
     365    foreach ($this->getDecoratorDirs() as $dir) 
     366    { 
     367      if (is_readable($dir.'/'.$template)) 
     368      { 
     369        return $dir; 
     370      } 
     371    } 
     372  } 
     373 
     374  /** 
    344375   * Gets the i18n directories to use globally. 
    345376   * 
  • branches/1.1/lib/view/sfView.class.php

    r7792 r7846  
    372372    } 
    373373 
     374    if (!strpos($template, '.')) 
     375    { 
     376      $template .= $this->getExtension(); 
     377    } 
     378 
    374379    if (sfToolkit::isPathAbsolute($template)) 
    375380    { 
     
    379384    else 
    380385    { 
     386      $this->decoratorDirectory = $this->context->getConfiguration()->getDecoratorDir($template); 
    381387      $this->decoratorTemplate = $template; 
    382     } 
    383  
    384     if (!strpos($this->decoratorTemplate, '.')) 
    385     { 
    386       $this->decoratorTemplate .= $this->getExtension(); 
    387388    } 
    388389