本文整理汇总了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);
}
}
}
}