/** * created the absolute address to the template folder * @return string url to template folder */ public static function templatePath($custom = false) { if ($custom == true) { return \HMC\Config::SITE_URL() . 'app/templates/' . $custom . '/'; } else { return \HMC\Config::SITE_URL() . 'app/templates/' . \HMC\Config::SITE_TEMPLATE() . '/'; } }
<?php use HMC\Config; use HMC\Language; ?> <div class="page-header"> <h1><?php echo $data['title']; ?> </h1> </div> <p><?php echo $data['welcome_message']; ?> </p> <a class="btn btn-md btn-success" href="<?php echo Config::SITE_URL(); ?> /subpage"> <?php echo Language::tr('open_subpage'); ?> </a>
/** * Output optimized stylesheet. * This function will combine multiple stylesheets into a single sheet. * It will also perform some basic optimizations to reduce download size. * @param $files - array of files to include * @param $outputdir - where to store generated file(s), default is typically adequate. */ public static function combine_css($files, $outputdir = 'static/generated/') { if (\HMC\Config::SITE_ENVIRONMENT() == 'development') { Assets::css($files); return; } $ofiles = is_array($files) ? $files : array($files); $hashFileName = md5(join($ofiles)); $dirty = false; if (file_exists($outputdir . $hashFileName . '.css')) { $hfntime = filemtime($outputdir . $hashFileName . '.css'); foreach ($ofiles as $vfile) { $file = str_replace(\HMC\Config::SITE_URL(), \HMC\Config::SITE_PATH(), $vfile); if (!$dirty) { $fmtime = filemtime($file); if ($fmtime > $hfntime) { $dirty = true; } } } } else { $dirty = true; } if ($dirty) { $buffer = ""; foreach ($ofiles as $vfile) { $cssFile = str_replace(\HMC\Config::SITE_URL(), \HMC\Config::SITE_PATH(), $vfile); $buffer .= "\n" . file_get_contents($cssFile); } // Remove comments $buffer = preg_replace('!/\\*[^*]*\\*+([^/][^*]*\\*+)*/!', '', $buffer); // Remove space after colons $buffer = str_replace(': ', ':', $buffer); // Remove whitespace $buffer = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $buffer); ob_start(); // Write everything out echo $buffer; $fc = ob_get_clean(); file_put_contents(\HMC\Config::SITE_PATH() . $outputdir . $hashFileName . '.css', $fc); } static::resource(str_replace(':||', '://', str_replace('//', '/', str_replace('://', ':||', \HMC\Config::SITE_URL() . $outputdir . $hashFileName . '.css'))), 'css'); }