/** * page method * @param string $current * */ public function page($current = 'index') { $file = ROOT . 'assets/js/site/' . $current . '.js'; if (file_exists($file)) { Asset::add('js', 'site/' . $current); } $this->withVars(array('page' => 'pages/' . $current))->renderView('layouts/content'); }
<?php $styleFiles = \System\Core\Asset::getAssets('css'); for ($i = 0; $i < sizeof($styleFiles); $i++) { ?> <?php $styleFile = $styleFiles[$i]; ?> <link rel="stylesheet" href="<?php echo TEMPLATE . $styleFile; ?> "> <?php }
<?php $scriptFiles = \System\Core\Asset::getAssets('js'); for ($i = 0; $i < sizeof($scriptFiles); $i++) { ?> <?php $scriptFile = $scriptFiles[$i]; ?> <script language="JavaScript" type="text/javascript" src="<?php echo TEMPLATE . $scriptFile; ?> "></script> <?php }