设置插件管理界面的导航
主题配置内容太多,如何拆分成多个页面 多个配置页面,导航一键管理,减少重复工作量
原主题配置内容写法
<divclass="SubMenu"> <ahref="./main.php"><spanclass="m-left">插件说明</span></a> <ahref="./seo.php"><spanclass="m-leftm-now">插件配置</span></a> </div>
统一化管理后的方法
在插件或主题的include.php页面添加函数
functionytecn_SubMenu($action){
$array=array(
array('action'=>'show','url'=>'show.php','target'=>'_self','float'=>'left','title'=>'插件说明'),
array('action'=>'lv','url'=>'lv.php','target'=>'_self','float'=>'left','title'=>'单价设置'),
array('action'=>'web','url'=>'web.php','target'=>'_self','float'=>'left','title'=>'分发站点'),
);
$str='';
$template='<ahref="$url"target="$target"><spanclass="m-$float$light">$title</span></a>';
for($i=0;$i<count($array);$i++){
$str.=$template;
$str=str_replace('$url',$array[$i]['url'],$str);
$str=str_replace('$target',$array[$i]['target'],$str);
$str=str_replace('$float',$array[$i]['float'],$str);
$str=str_replace('$title',$array[$i]['title'],$str);
$str=str_replace('$light',($action==$array[$i]['action']?'m-now':''),$str);
}
return$str;
}在配置页面如main.php的SubMenu位置添加调用代码
<divclass="SubMenu"><?phpechoytecn_SubMenu('show');?></div> 




