コード例 #1
0
 function __construct($path)
 {
     //set path, strip template directory from it
     $dir = array(WXP::DS(get_template_directory()), WXP::DS(get_stylesheet_directory()));
     $path = str_replace($dir, "", $path);
     $this->path = ltrim($path, "\\/");
 }
コード例 #2
0
 function render($path = null, $name = "")
 {
     $name = $name ?: $this->render_path_name;
     $path = WXP::DS($path) ?: $this->render_path;
     //if path is an alias
     $path = WXP::get_path($path);
     //get view data array with filters applied
     $data = $this->get_data();
     //if this is not the global view, extract
     //the global view vars
     // -- local view vars will overwrite any global view vars
     // -- in scope. Use view_var or __var function to access
     // -- the original global value
     if ($this->namespace !== "global") {
         $global_view_data = View::getInstance()->get_data();
         extract($global_view_data);
     }
     //extract local view data vars if not empty
     if (!empty($data)) {
         extract($data);
     }
     require $path->name($name)->dir();
 }