protected function get(string $new_child_file, array $new_child_vars = [], string $new_child_dir = ''): string
    {
        $new_child_parents     = array_merge($this->parents, [$this->file]);
        $new_child_parent_vars = array_merge($this->parent_vars, [$this->file => &$this->vars]);
        $new_child_Template    = $this->c::getTemplate($new_child_file, $new_child_dir, [
            'parents'     => $new_child_parents,
            'parent_vars' => $new_child_parent_vars,
            'Route'       => $this->Route,
        ]);
        // Variables from the closest ancestors take precedence over further/older ancestors.
        // File-specific variables in those ancestors take precedence over those that aren't file-specific.

        foreach (array_reverse($new_child_parent_vars, true) as $_parent_file => $_parent_vars) {
            if (isset($_parent_vars[$new_child_file]) && is_array($_parent_vars[$new_child_file])) {
                $new_child_vars = array_replace_recursive($_parent_vars[$new_child_file], $new_child_vars);
            }
            $_parent_vars_not_file_specific = array_diff_key($_parent_vars, $new_child_parent_vars + [$new_child_file => 0]);
            $new_child_vars                 = array_replace_recursive($_parent_vars_not_file_specific, $new_child_vars);
        } // unset($_parent_file, $_parent_vars, $_parent_vars_not_file_specific); // Housekeeping.

        return $new_child_Template->parse($new_child_vars);
    }
protected function get(string $new_child_file, array $new_child_vars = [], string $new_child_dir = ''): string
    {
        $new_child_parents     = array_merge($this->parents, [$this->file]);
        $new_child_parent_vars = array_merge($this->parent_vars, [$this->file => &$this->vars]);
        $new_child_Template    = $this->c::getTemplate($new_child_file, $new_child_dir, [
            'parents'     => $new_child_parents,
            'parent_vars' => $new_child_parent_vars,
            'Route'       => $this->Route,
        ]);
        // Variables from the closest ancestors take precedence over further/older ancestors.
        // File-specific variables in those ancestors take precedence over those that aren't file-specific.

        foreach (array_reverse($new_child_parent_vars, true) as $_parent_file => $_parent_vars) {
            if (isset($_parent_vars[$new_child_file]) && is_array($_parent_vars[$new_child_file])) {
                $new_child_vars = array_replace_recursive($_parent_vars[$new_child_file], $new_child_vars);
            }
            $_parent_vars_not_file_specific = array_diff_key($_parent_vars, $new_child_parent_vars + [$new_child_file => 0]);
            $new_child_vars                 = array_replace_recursive($_parent_vars_not_file_specific, $new_child_vars);
        } // unset($_parent_file, $_parent_vars, $_parent_vars_not_file_specific); // Housekeeping.

        return $new_child_Template->parse($new_child_vars);
    }
protected function get ( string $ new_child_file , array $ new_child_vars = [ ] , string $ new_child_dir = '' ) : string { $ new_child_parents = array_merge ( $ this -> parents , [ $ this -> file ] ) ; $ new_child_parent_vars = array_merge ( $ this -> parent_vars , [ $ this -> file => & $ this -> vars ] ) ; $ new_child_Template = $ this -> c :: getTemplate ( $ new_child_file , $ new_child_dir , [ 'parents' => $ new_child_parents , 'parent_vars' => $ new_child_parent_vars , 'Route' => $ this -> Route , ] ) ; // Variables from the closest ancestors take precedence over further/older ancestors. // File-specific variables in those ancestors take precedence over those that aren't file-specific. foreach ( array_reverse ( $ new_child_parent_vars , true ) as $ _parent_file => $ _parent_vars ) { if ( isset ( $ _parent_vars [ $ new_child_file ] ) && is_array ( $ _parent_vars [ $ new_child_file ] ) ) { $ new_child_vars = array_replace_recursive ( $ _parent_vars [ $ new_child_file ] , $ new_child_vars ) ; } $ _parent_vars_not_file_specific = array_diff_key ( $ _parent_vars , $ new_child_parent_vars + [ $ new_child_file => 0 ] ) ; $ new_child_vars = array_replace_recursive ( $ _parent_vars_not_file_specific , $ new_child_vars ) ; } // unset($_parent_file, $_parent_vars, $_parent_vars_not_file_specific); // Housekeeping. return $ new_child_Template -> parse ( $ new_child_vars ) ; }
Get a child template.

@since 150424 Initial release.

@param string $new_child_file Relative to templates dir.
@param array  $new_child_vars Template vars for the include.
@param string $new_child_dir  From a specific directory?

@return string Parsed template contents for child template.
Get a child template .