Location: PHPKode > projects > Blackwolf CMF > projectBlackWolf/lib/Output/TemplateWrap.class.php
<?php
/* Please see the README and LICENSE files. */

/**
 * Wraps a header and footer, from a template, around the current contents
 * 
 * @uses Template_Subsystem
 */

// This is the header to use
define("TEMPLATE_WRAP_HEADER","html/header");

// This is the footer to use
define("TEMPLATE_WRAP_FOOTER","html/footer");


class Output_TemplateWrap {

    /**
     * Wrap the header and footer around the contents of the output manager
     * 
     * @param Output_Manager $output_manager The object to wrap around
     * @return Output_Manager
     */
    public static function wrap($output_manager) {
        if (is_callable(array($output_manager, "publish"))) {
            $output_manager->queue_jump(Template_Subsystem::parse_file(TEMPLATE_WRAP_HEADER/* ,TODO (Get variables for the site header from the Template_Subsystem) */));
            $output_manager->queue(Template_Subsystem::parse_file(TEMPLATE_WRAP_FOOTER/* ,TODO (Get variables for the site footer from the Template_Subsystem) */));
        } else {
            trigger_error("The output manger is missing or broken", E_USER_ERROR);
        }
        return $output_manager;
    }
    
    /**
     * Same as wrap() except publishes after wrapping
     * 
     * @param Output_Manager $output_manager The object to wrap around
     */
    public static function end_wrap($output_manager){
        if(!$output_manager->disabled()){
            $headers_sent = headers_sent($file, $line);
            $output_manager = self::wrap($output_manager);        
            $output_manager->end_publish();
        }   
    }

}

?>
Return current item: Blackwolf CMF