?> <div id="container"> <header> <?php ModulaiseController::printPane("head"); ?> </header> <div id="main"> <?php ModulaiseController::printPane("main"); ?> </div> <footer> <?php ModulaiseController::printPane("footer"); ?> </footer> </div> <!--! end of #container --> <?php include '_foot.php';
<?php ModulaiseController::printComment("Print first HTML snippets"); ModulaiseController::printPane(PANE_HTML_FOOT_FIRST); ModulaiseController::printComment("Import FOOT JavaScript"); ModulaiseController::printPane(PANE_JS_FOOT); ModulaiseController::printComment("Print last HTML snippets"); ModulaiseController::printPane(PANE_HTML_FOOT_LAST); ?> </body> </html>
<!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]--> <!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]--> <head> <meta charset="utf-8"> <?php ModulaiseController::printComment("Always force latest IE rendering engine (even in intranet) & Chrome Frame Remove this if you use the .htaccess"); ?> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title><?php ModulaiseController::printPageTitle(); ?> </title> <meta name="description" content=""> <meta name="author" content=""> <?php ModulaiseController::printComment("Mobile viewport optimized: j.mp/bplateviewport"); ?> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <?php ModulaiseController::printComment("Import css stylesheets"); ModulaiseController::printPane(PANE_CSS); ModulaiseController::printComment("Print first HTML head snippets"); ModulaiseController::printPane(PANE_HTML_HEAD_FIRST); ModulaiseController::printComment("Import head javascript javascripts"); ModulaiseController::printPane(PANE_JS_HEAD); ModulaiseController::printComment("Print last HTML snippets"); ModulaiseController::printPane(PANE_HTML_HEAD_LAST); ?> </head> <body>
<?php include '_head.php'; ModulaiseController::printPane("head"); ModulaiseController::printPane("main"); ?> <br clear="all" /> <hr /> <h2>Footer</h2> <?php ModulaiseController::printPane("foot"); if (ModulaiseController::paneHasContent("extra")) { ?> <br clear="all" /> <div class="pane-extra"> <h2>Extra</h2> <?php ModulaiseController::printPane("extra"); ?> </div> <?php } include '_foot.php';
/** * Prints CSS pane */ private function printCSSPane() { // Start by sorting the panes $this->sortPanes(); // Prepare an empty array to hold the css $concatinated_css = array(); $debug = false; // get the pane names $paneNames = ModulaiseController::getPaneNames(); foreach ($this->content as $name => $value) { if ($debug === true) { echo "paneName=" . $name . "\n"; } $pos = strpos($name, PANE_CSS); if (!($pos === false)) { $nameArrays = explode("--", $name); if (ModulaiseController::paneHasContent($name)) { // render the pane ModulaiseController::printPane($name); } } } return true; }
/** * Concatinates CSS and JavaScript */ public static function buildCompiled() { echo "\nConcatinating CSS and JavaScript\n--------------------------------------------------------------------------------\n"; // set the PageController buildMode value to BUILD_EXPORT ModulaiseController::$buildMode = BUILD_EXPORT; // Reset global modules ModulaiseController::initialize(); // Create a page containing all modules and then in turn print js_head, js_foot and css ModulaiseController::createPage("EXPORT", "EXPORT"); // add all global modules to global modules array $allModuleNames = ModulaiseUtils::getDirectoryAsArray(ModulaiseController::$DIR_DOCUMENT_ROOT . DIRECTORY_SEPARATOR . ModulaiseController::$PATH_MODULES, ONLY_DIRECTORIES); // build a list with all non-global modules foreach ($allModuleNames as $moduleId) { echo "Compiling module : " . $moduleId . "\n"; if (substr($moduleId, 0, 1) != "0") { ModulaiseController::addModule("EXPORT", $moduleId); } } $buildTagComment = "/*\n\nBuildtag: " . ModulaiseController::$buildTag . "\n\n*/\n\n"; // Write PANE_JS_HEAD // the file to write $writeFile = ModulaiseController::$DIR_DOCUMENT_ROOT . DIRECTORY_SEPARATOR . ModulaiseController::$PATH_MODULES . DIRECTORY_SEPARATOR . FOLDER_COMPILED . DIRECTORY_SEPARATOR . "js" . DIRECTORY_SEPARATOR . "js_head.concatinated.js"; echo "Writing file : " . $writeFile . "\n"; // capture output start $captureOutput = new ModulaiseCaptureOutput(); $captureOutput->start(); echo $buildTagComment; if (ModulaiseController::paneHasContent(PANE_JS_HEAD)) { // render the pane ModulaiseController::printPane(PANE_JS_HEAD); } // capture output end $output = $captureOutput->end(); // write the output to file ModulaiseUtils::writeFile($writeFile, $output); // Write PANE_JS_FOOT // the file to write $writeFile = ModulaiseController::$DIR_DOCUMENT_ROOT . DIRECTORY_SEPARATOR . ModulaiseController::$PATH_MODULES . DIRECTORY_SEPARATOR . FOLDER_COMPILED . DIRECTORY_SEPARATOR . "js" . DIRECTORY_SEPARATOR . "js_foot.concatinated.js"; echo "Writing file : " . $writeFile . "\n"; // capture output start $captureOutput = new ModulaiseCaptureOutput(); $captureOutput->start(); echo $buildTagComment; if (ModulaiseController::paneHasContent(PANE_JS_FOOT)) { // render the pane ModulaiseController::printPane(PANE_JS_FOOT); } // capture output end $output = $captureOutput->end(); // write the output to file ModulaiseUtils::writeFile($writeFile, $output); // Write each and every PANE_CSS // Prepare an empty array to hold the css $concatinated_css = array(); $debug = false; // get the pane names $paneNames = ModulaiseController::getPaneNames(); foreach ($paneNames as $name) { if ($debug === true) { echo "paneName=" . $name . "\n"; } $pos = strpos($name, PANE_CSS); if (!($pos === false)) { $nameArrays = explode("--", $name); // leading zero $nameArrays[1] = $nameArrays[1] < 10 ? "0" . $nameArrays[1] : $nameArrays[1]; // the file to write $writeFile = ModulaiseController::$DIR_DOCUMENT_ROOT . DIRECTORY_SEPARATOR . ModulaiseController::$PATH_MODULES . DIRECTORY_SEPARATOR . FOLDER_COMPILED . DIRECTORY_SEPARATOR . "css" . DIRECTORY_SEPARATOR . $nameArrays[1] . DELIMITER . $nameArrays[2] . ".concatinated.css"; echo "Writing file : " . $writeFile . "\n"; // capture output start $captureOutput = new ModulaiseCaptureOutput(); $captureOutput->start(); echo $buildTagComment; if (ModulaiseController::paneHasContent($name)) { // render the pane ModulaiseController::printPane($name); } // capture output end $output = $captureOutput->end(); // write the output to file ModulaiseUtils::writeFile($writeFile, $output); // Remove comments and blank lines from output $output = preg_replace('!/\\*.*?\\*/!s', '', $output); //$output = preg_replace('/\n\s*\n/', '', $output); //$output = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "", $output); $output = trim($output); if ($debug === true) { echo "output=\"" . $output . "\"\n"; } // if there is something to add if ($output != "") { // also add the snippet to the concatinated array $concatinated_css[$nameArrays[1] . "--" . $nameArrays[2]][] = $output; } } } // Write everything as one big pane // the file to write $writeFile = ModulaiseController::$DIR_DOCUMENT_ROOT . DIRECTORY_SEPARATOR . ModulaiseController::$PATH_MODULES . DIRECTORY_SEPARATOR . FOLDER_COMPILED . DIRECTORY_SEPARATOR . "css" . DIRECTORY_SEPARATOR . "css.concatinated.css"; echo "Writing file : " . $writeFile . "\n"; // capture output start $captureOutput = new ModulaiseCaptureOutput(); $captureOutput->start(); echo $buildTagComment; // now use the concatinated_css array to concatinate everything into its right place foreach ($concatinated_css as $css_name => $contentsArray) { $nameArrays = explode("--", $css_name); $mediaType = ModulaiseUtils::getMediaType($nameArrays[1]); if ($mediaType != "@media all") { echo "/*!NEWLINE*/" . $mediaType . " {"; } else { echo "/*!NEWLINE*/"; } foreach ($contentsArray as $key => $content) { echo $content . "\n"; } if ($mediaType != "@media all") { echo "}"; } echo "/*!NEWLINE*/"; } // render the pane //print_r($concatinated_css); // capture output end $output = $captureOutput->end(); // write the output to file ModulaiseUtils::writeFile($writeFile, $output); if ($debug) { // write an extra output file ModulaiseUtils::writeFile($writeFile . ".text", $output); } }
<?php include '_head.php'; ?> <div class="bg"> <?php ModulaiseController::printPane("head"); ModulaiseController::printPane("main"); include '_foot.php';