Changeset 1449

Show
Ignore:
Timestamp:
01/01/07 19:49:23 (2 years ago)
Author:
david
Message:

more renderer cleanup

Location:
branches/david-execution_flow/src/renderer
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/david-execution_flow/src/renderer/AgaviPhpRenderer.class.php

    r1448 r1449  
    3434   */ 
    3535  protected $extension = '.php'; 
    36  
    37   /** 
    38    * Loop through all template slots and fill them in with the results of 
    39    * presentation data. 
    40    * 
    41    * @param      string A chunk of decorator content. 
    42    * 
    43    * @return     string A decorated template. 
    44    * 
    45    * @author     Sean Kerr <skerr@mojavi.org> 
    46    * @since      0.11.0 
    47    */ 
    48   public function decorate($content) 
    49   { 
    50     // call our parent decorate() method 
    51     parent::decorate($content); 
    52  
    53     // DO NOT USE VARIABLES IN HERE, THEY MIGHT INTERFERE WITH TEMPLATE VARS 
    54  
    55     if($this->extractVars) { 
    56       extract($this->view->getAttributes(), EXTR_REFS | EXTR_PREFIX_INVALID, '_'); 
    57     } else { 
    58       ${$this->varName} =& $this->view->getAttributes(); 
    59     } 
    60  
    61     $collisions = array_intersect(array_keys($this->assigns), $this->view->getAttributeNames()); 
    62     if(count($collisions)) { 
    63       throw new AgaviException('Could not import system objects due to variable name collisions ("' . implode('", "', $collisions) . '" already in use).'); 
    64     } 
    65     extract($this->assigns); 
    66  
    67     // render the decorator template and return the result 
    68     ob_start(); 
    69  
    70     require($this->view->getDecoratorDirectory() . '/' . $this->buildTemplateName($this->view->getDecoratorTemplate())); 
    71  
    72     $retval = ob_get_contents(); 
    73     ob_end_clean(); 
    74  
    75     return $retval; 
    76   } 
    7736 
    7837  /** 
     
    13089  } 
    13190} 
     91 
     92?> 
  • branches/david-execution_flow/src/renderer/AgaviRenderer.class.php

    r1448 r1449  
    4141   
    4242  /** 
    43    * @var        AgaviView The View instance that belongs to this Renderer. 
    44    */ 
    45   protected $view = null; 
    46    
    47   /** 
    4843   * @var        string The name of the array that contains the template vars. 
    4944   */ 
     
    160155  } 
    161156 
    162   /** 
    163    * Set the View instance that belongs to this Renderer instance. 
    164    * 
    165    * @param      AgaviView An AgaviView instance 
    166    * 
    167    * @author     David Zuelke <dz@bitxtender.com> 
    168    * @since      0.11.0 
    169    */ 
    170   public function setView($view) 
    171   { 
    172     $this->view = $view; 
    173   } 
    174    
    175   /** 
    176    * Retrieve the View instance that belongs to this Renderer instance. 
    177    * 
    178    * @return     AgaviView An AgaviView instance 
    179    * 
    180    * @author     David Zuelke <dz@bitxtender.com> 
    181    * @since      0.11.0 
    182    */ 
    183   public function getView() 
    184   { 
    185     return $this->view; 
    186   } 
    187    
    188157  /** 
    189158   * Build a template name based on "literal" flag in the template info.