public static function get_init_code()
    {
        if (self::is_publishing()) {
            $code = "";

            // if objects have set up initialization code, add that in
            foreach (self::$init_code as $block) {
                $block = trim($block);
                if (strlen($block) == 0) {
                    continue;
                }
                if (substr($block, 0, 5) != '<?php') {
                    $code .= '<?php ';
                }
                $code .= $block;
                if (substr($block, -2) != '?>') {
                    $code .= ' ?>';
                }
                $code .= "\n";
            }
            
            // if there are variables to initialize, add that in
            if (count(self::$vars) > 0) {
                $code .= "\n<?php\n";
                foreach (self::$vars as $var => $valCode) {
                    if ($valCode === true) {
                        continue;
                    } // this means it was already set in the initialization
                    $code .= '$' . $var . ' = ' . $valCode . ";\n";
                }
                $code .= "\n?>\n";
            }
            
            return $code;
        }
    }
public static function get_init_code()
    {
        if (self::is_publishing()) {
            $code = "";

            // if objects have set up initialization code, add that in
            foreach (self::$init_code as $block) {
                $block = trim($block);
                if (strlen($block) == 0) {
                    continue;
                }
                if (substr($block, 0, 5) != '<?php') {
                    $code .= '<?php ';
                }
                $code .= $block;
                if (substr($block, -2) != '?>') {
                    $code .= ' ?>';
                }
                $code .= "\n";
            }
            
            // if there are variables to initialize, add that in
            if (count(self::$vars) > 0) {
                $code .= "\n<?php\n";
                foreach (self::$vars as $var => $valCode) {
                    if ($valCode === true) {
                        continue;
                    } // this means it was already set in the initialization
                    $code .= '$' . $var . ' = ' . $valCode . ";\n";
                }
                $code .= "\n?>\n";
            }
            
            return $code;
        }
    }
public static function get_init_code ( ) { if ( self :: is_publishing ( ) ) { $ code = "" ; // if objects have set up initialization code, add that in foreach ( self :: $ init_code as $ block ) { $ block = trim ( $ block ) ; if ( strlen ( $ block ) == 0 ) { continue ; } if ( substr ( $ block , 0 , 5 ) != '<?php' ) { $ code .= '<?php ' ; } $ code .= $ block ; if ( substr ( $ block , - 2 ) != '?>' ) { $ code .= ' ?>' ; } $ code .= "\n" ; } // if there are variables to initialize, add that in if ( count ( self :: $ vars ) > 0 ) { $ code .= "\n<?php\n" ; foreach ( self :: $ vars as $ var => $ valCode ) { if ( $ valCode === true ) { continue ; } // this means it was already set in the initialization $ code .= '$' . $ var . ' = ' . $ valCode . ";\n" ; } $ code .= "\n?>\n" ; } return $ code ; } }
Outputs the static config code if needed. This should be placed in a function in Page_Controller and called from template.
Outputs the static config code if needed . This should be placed in a function in Page_Controller and called from template .