Show
Ignore:
Timestamp:
09/17/07 19:00:18 (15 months ago)
Author:
freakerz
Message:

First pass at implementing header and footer aggregation functions.

Theme::header() and Theme::footer() are the new functions.

They call THEME_CLASS::header() and THEME_CLASS::footer, plus:

New plugin hooks: template_header, template_footer.

New Stack names: template_stylesheet, template_header_javascript and template_footer_javascript.

-

Moved the K2 header verification for jQuery to the K2 theme.php file.

Comment/Suggestions?

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/htdocs/system/classes/theme.php

    r849 r851  
    357357    } 
    358358     
     359     
     360    /** 
     361     * Aggregates and echos the additional header code by combining Plugins and Stack calls. 
     362     */ 
     363    public function header() { 
     364        Plugins::act( 'template_header' ); 
     365        if ( is_callable( array( THEME_CLASS, 'header' ) ) ) { 
     366            call_user_func( array( THEME_CLASS, 'header' ) ); 
     367        } 
     368        $header= Stack::get( 'template_stylesheet', ' <link rel="stylesheet" type="text/css"  href="%s" media="%s">'."\r\n" ); 
     369        $header.= Stack::get( 'template_header_javascript', ' <script src="%s" type="text/javascript"></script>'."\r\n" ); 
     370        if ( $header != '' ) { 
     371            echo $header; 
     372        } 
     373    } 
     374     
     375    /** 
     376     * Aggregates and echos the additional footer code by combining Plugins and Stack calls. 
     377     */ 
     378    public function footer() { 
     379        Plugins::act( 'template_footer' ); 
     380        if ( is_callable( array( THEME_CLASS, 'footer' ) ) ) { 
     381            call_user_func( array( THEME_CLASS, 'footer' ) ); 
     382        } 
     383        $footer= Stack::get( 'template_footer_javascript', ' <script src="%s" type="text/javascript"></script>'."\r\n" ); 
     384        if ( $footer != '' ) { 
     385            echo $footer; 
     386        } 
     387    } 
     388     
    359389    /**  
    360390     * Detects if a variable is assigned to the template engine for use in