国内最全IT社区平台 联系我们 | 收藏本站
华晨云阿里云优惠2
您当前位置:首页 > php开源 > Discuz > PHPWind门户模式中不同栏目定义不同头部的方法

PHPWind门户模式中不同栏目定义不同头部的方法

来源:程序员人生   发布时间:2013-11-27 11:06:36 阅读次数:2396次

PHPWind门户模式中不同栏目定义不同头部的方法

先看pw common.php的代码

function getAreaSrcTpl($template,$EXT='htm'){
global $db_tplstyle,$area_indextpl;
if ($template=='header' || $template=='footer') {
$srcTpl = M_P."themes/$area_indextpl/$template.$EXT";
} else {
$srcTpl = M_P."themes/$db_tplstyle/$template.$EXT";
}
if (!file_exists($srcTpl)) { //liehuo.net
global $area_indextpl;
if ($area_indextpl!='default' && file_exists(M_P."themes/$area_indextpl/$template.$EXT")) {
$srcTpl = M_P."themes/$area_indextpl/$template.$EXT";
} else {
$srcTpl = M_P."themes/default/$template.$EXT";
}
}
return $srcTpl;
}

由于使用了

知道你要采集,www.liehuo。net

if ($template=='header' || $template=='footer') {
$srcTpl = M_P."themes/$area_indextpl/$template.$EXT";
} else {

所以统一了头部和底部,但是很多情况希望每个频道头部不一样,更改方法为:

将cate.php中

require_once(M_P.'require/header.php');

改成

require_once(M_P.'require/header_cate.php');

然后复制一个header.php改名为header_cate.php;

更改require_once PrintEot('header');

为require_once PrintEot('header_cate');

然后在每个风格目录中加上header_cate.htm,这样就可以为每个频道制定不同头部了。在风格模板中

生活不易,码农辛苦
如果您觉得本网站对您的学习有所帮助,可以手机扫描二维码进行捐赠
程序员人生
------分隔线----------------------------
分享到:
------分隔线----------------------------
关闭
程序员人生