本文整理匯總了PHP中zmf::readDir方法的典型用法代碼示例。如果您正苦於以下問題:PHP zmf::readDir方法的具體用法?PHP zmf::readDir怎麽用?PHP zmf::readDir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類zmf
的用法示例。
在下文中一共展示了zmf::readDir方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: loadCssJs
public function loadCssJs($type = 'web', $action = '')
{
if (YII_DEBUG) {
$staticUrl = Yii::app()->baseUrl . '/';
} else {
$_staticUrl = zmf::config('cssJsStaticUrl');
$staticUrl = $_staticUrl ? $_staticUrl : zmf::config('baseurl');
}
$cs = Yii::app()->clientScript;
$c = Yii::app()->getController()->id;
$a = Yii::app()->getController()->getAction()->id;
$cssDir = Yii::app()->basePath . '/../common/css';
$jsDir = Yii::app()->basePath . '/../common/js';
$cssArr = array();
$jsArr = array();
if ($type == 'web') {
$cssArr = array('bootstrap', 'font-awesome', 'zmf');
$jsArr = array('bootstrap', 'zmf');
$cs->registerCoreScript('jquery');
} elseif ($type == 'mobile') {
$cssArr = array('frozen', 'font-awesome');
$jsArr = array('zepto', 'frozen');
$cssArr[] = 'mobile';
$jsArr[] = 'mobile';
} elseif ($type == 'admin') {
$cssArr = array('frozen');
$jsArr = array('zepto', 'frozen');
$cssArr[] = 'mobile';
$jsArr[] = 'mobile';
}
$cssDirArr = zmf::readDir($cssDir, false);
$jsDirArr = zmf::readDir($jsDir, false);
foreach ($cssArr as $cssFileName) {
foreach ($cssDirArr as $cssfile) {
if (strpos($cssfile, $type . '-' . $cssFileName) !== false) {
$cs->registerCssFile($staticUrl . 'common/css/' . $cssfile);
}
}
}
foreach ($jsArr as $jsFileName) {
foreach ($jsDirArr as $jsfile) {
if (strpos($jsfile, $type . '-' . $jsFileName) !== false) {
if (strpos($jsfile, 'head') !== false) {
$pos = CClientScript::POS_HEAD;
} else {
$pos = CClientScript::POS_END;
}
$cs->registerScriptFile($staticUrl . 'common/js/' . $jsfile, $pos);
}
}
}
}