XOOPS HACK


内容列表


XOOPS多布景体系的HACK
作者:bbchen

//--修改根目录下的两个文件header.php与footer.php.--//

分别找到


      
      
$xoopsTpl->display($xoopsConfig['theme_set'].'/theme.html');


替换为:

       
       
if (empty($xoopsModule)){
$xoopsTpl->display($xoopsConfig['theme_set'].'/theme.html');
}
else {
$modThemeSel=$xoopsModule->getVar('dirname');
switch($modThemeSel){
case "newbb":
$xoopsTpl->display($xoopsConfig['theme_set'].'/newbb.html');
break;
case "news":
$xoopsTpl->display($xoopsConfig['theme_set'].'/news.html');
break;
default:
$xoopsTpl->display($xoopsConfig['theme_set'].'/theme.html');
break;
}
}


其中switch语句中的case “模组目录名” ,相应的布景主文件也为 模组名.html,因此,必须在新建一个新的模组名.html文件,那么可定制性就很强了,可以采用不同的内容编排以及css。

注意header.php与footer。php都要修改。
 
新闻首页列表方法显示
第一步:
打开modules/news/xoops_version.php文件,找到:


// Templates
$modversion['templates'][1]['file'] = 'news_archive.html';
$modversion['templates'][1]['description'] = '';
$modversion['templates'][2]['file'] = 'news_article.html';
$modversion['templates'][2]['description'] = '';
$modversion['templates'][3]['file'] = 'news_index.html';
$modversion['templates'][3]['description'] = '';
$modversion['templates'][4]['file'] = 'news_item.html';
$modversion['templates'][4]['description'] = '';


再其后添加


$modversion['templates'][5]['file'] = 'news_list.html';
$modversion['templates'][5]['description'] = '';


第二步
打开modules/news/templates/文件夹,复制news_item.html并命名为news_list.html,用任何网页编辑软件编辑删除你不想显示的内容,建议留下以下几样(标题、日期、点击、阅读数)


<{$story.title}> <{$story.posttime}> <{$story.hits}> <{$lang_reads}>



但要注意在CSS重定义一下该页的样式,或者保留原有样式也可(如果你完全不了解CSS,你也可以直接通过HTML来定义,但要注意统一性)。

第三步
更新模组,并生成模板!

当你更新模组之后,再进入模板时,会发现在NEWS组中多出了一个文件 news_list.html,并且有一个生成按钮在边上,点击他以生成模板!

第四步
在模板中选中“index.html”点击编辑,将其中的

<{include file="db:news_item.html" story=$stories[i]}>



改为

<{include file="db:news_list.html" story=$stories[i]}>

然后点保存(如果没有保存按钮,说明你正工作在默认模板下,请复制一个模板,并在系统设置中将其设定为默认模板然后重复第三步后的动作)

第五步
如果你已经关闭了系统设置中的 引文:
从/themes/yourtheme/templates目录更新模组的模板.html文件?
则你需要清空 主目录/templates_c文件夹中的文件,否则可免。

OK完成HACK

 
Smarty变量列表
Smarty变量

下面是官方的XOOPS Smarty变量,请在此核对并更新,当XOOPS 2更改变量时更改或增加之。

Theme变量

<{$xoops_meta_keywords}>
从Meta/Footer设置中插入关键字列表
(meta 标签信息)

<{$xoops_meta_description}>
插入站点的描述到meta 标签

<{$meta_copyright}>
插入copyright文本到 meta 标签

<{$meta_robots}>
插入W3C robot信息到meta标签

<{$meta_rating}>
插入等级信息到meta 标签

<{$xoops_sitename}>
插入站点名字

<{$xoops_pagetitle}>
插入页面的title

<{$xoops_themecss}>
插入 style.css

(注:上述变量的任何组合均用于插入您喜好的信息到meta标签)

<{$xoops_url}>
插入站点的URL

<{$xoops_js}>
插入XOOPS javascript 代码

<{$xoops_banner}>
显示 banners条

<{foreach item=block from=$xoops_lblocks}>
<{$block}>
<{/foreach}>
显示左边区块(block)的代码段

<{if $xoops_showcblock == 1}>
用于显示中间区块的系统测试

<{foreach item=block from=$xoops_ccblocks}>
<{$block}>
<{/foreach}>
显示中间区块的代码段

<{foreach item=block from=$xoops_clblocks}>
<{$block}>
<{/foreach}>
显示中间区块-左的代码段

<{foreach item=block from=$xoops_crblocks}>
<{$block}>
<{/foreach}>
显示中间区块-右的代码段Code snippet to show the center-right blocks

<{$xoops_contents}>
显示新闻和其他内容

<{if $xoops_showcblock == 1}>
显示中间区块的测试

<{if $xoops_showrblock == 1}>
显示右边区块的测试

<{foreach item=block from=$xoops_rblocks}>
<{$block}>
<{/foreach}>
显示右边区块的代码段

<{$xoops_footer}>
显示页脚(footer)

<{$xoops_isadmin}>
如果访问者是管理员,则为True

<{$xoops_isuser}>
如果访问者是注册用户,则为True

<{$xoops_userid}>
成员的用户 ID

<{$xoops_uname}>
成员的用户名
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值