Changeset 117

Show
Ignore:
Timestamp:
05/14/08 15:05:33 (3 months ago)
Author:
felix
Message:

support to load components config from yaml files

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/rapyd/components/component.php

    r113 r117  
    1919  public function __construct($config = array()) 
    2020  { 
     21    if (is_string($config)) 
     22    { 
     23      $ext = end(explode('.', $config)); 
     24      switch($ext) 
     25      { 
     26        case "php": 
     27            include($config); 
     28          break; 
     29 
     30        case "yaml": 
     31            rpd::load_library('vendors/spyc'); 
     32            $config = Spyc::YAMLLoad($config); 
     33          break; 
     34        default: 
     35          $config = array(); 
     36      } 
     37    } 
    2138    if (count($config) > 0) 
    2239    { 
     
    275292    else 
    276293    { 
    277       $action = "javascript:window.location='".$config['url']."'";   
     294      $action = "javascript:window.location='".$config['url']."'"; 
    278295    } 
    279296    $position = (isset($config['position'])) ? $config['position'] : "TR"; 
     
    281298    $this->button("btn_act", $caption, $action, $position, $class); 
    282299  } 
    283    
     300 
    284301 
    285302  // --------------------------------------------------------------------