4月 14

⒈配置文件
每个模块的配置文件均保存在模块目录下的 common/config.jtbc,在此配置文件中,可设置当前模块使用的头尾模板,数据库表,以及各种模式等(对相关字母表示意思不了解的不妨尝试进入后台的配置管理进行对照),其中最主要的是 nuninstall ,此项配置关系到如何完整的卸载掉此模块,其配置值通常是这样的 “1|1|1”,以“|”相隔的1或者0的配置值分别代表 是否有数据库表,是否有类别数据,是否有上传文件的数据。按照模块的自身情况对此做出正确的配置即可。
注意事项:
主要数据库表配置为 ndatabase,假如一个模块出现两个数据库表,对数据库表以及字段前缀等都必须以 ndatabase_*,nidfield_*,nfpre_* 形式出现。
⒉引导文件
每个模块的后台引导文件均保存在模块目录下的 common/guide.jtbc,这个文件用来对后台的管理菜单进行引导输出,相应更改即可,涉及类别模板等的特殊权限参见标准模块中的引导文件。
⒊语言文件
语言文件保存在模块目录下的 language 目录下,对特定模块中的语言进行修改即可。
改”文章内容分页标签”输出为带上页、1,2,3、下页样式
🙂 找到:common/incfiles/common.inc.php
找到以下代码块:

function mm_cutepage_content_page_sel($strers, $vars, $ct_strers) { ..... }

🙂 🙂 替换为:

function mm_cutepage_content_page_sel($strers, $vars, $ct_strers)
{
  global $nurltype;
  $tcp_note = ii_get_num(ii_get_strvalue($vars, 'cp_note'));
  $tcp_mode = ii_get_num(ii_get_strvalue($vars, 'cp_mode'));
  $tcp_type = ii_get_num(ii_get_strvalue($vars, 'cp_type'));
  $tcp_num = ii_get_num(ii_get_strvalue($vars, 'cp_num'));
  $tpage = ii_get_num($_GET['page']);
  $tpagenum = mm_cutepage_content_page($strers, 'cp_note=' . $tcp_note . ';cp_mode=' . $tcp_mode . ';cp_type=' . $tcp_type . ';cp_num=' . $tcp_num);
  if ($tpage == 0) $tpage = 1;
  if ($tpage > $tpagenum) $tpage = $tpagenum;
  if ($tpagenum != 0)
  {
    $tpagelng = ii_itake('global.lng_cutepage.npage', 'lng');
    $ttpl_a_href_self = ii_itake('global.tpl_config.a_href_self', 'tpl');
    if ($tpagenum < 1) $tpagenum = 1;
    $tmpstr = '';
    if ($tpage == 1)
    {
        $tmpstr .= '' . ii_itake('global.lng_cutepage.prepage', 'lng') . '';
}
else
{
        $tmpstr .= '' . $ttpl_a_href_self . '';
        $tmpstr = str_replace('{$explain}', ii_itake('global.lng_cutepage.prepage', 'lng'), $tmpstr);
        $tmpstr = str_replace('{$value}', ii_iurl('cutepage', $tpage - 1, $nurltype, $ct_strers), $tmpstr);
}
    for ($i = 1; $i <= $tpagenum; $i ++)
    {
  if ($i == $tpage)
  {
        $tmpstr .= '

‘ . $i . ‘

';
  }
  else
  {
        $tmpstr .= $ttpl_a_href_self;
        $tmpstr = str_replace('{$explain}', $i, $tmpstr);
        $tmpstr = str_replace('{$value}', ii_iurl('cutepage', $i, $nurltype, $ct_strers), $tmpstr);
  }
      if ($i != $tpagenum) $tmpstr .= ' ';
    }
    if (($tpagenum - $tpage) == 0)
    {
        $tmpstr .= '' . ii_itake('global.lng_cutepage.nextpage', 'lng') . '';
}
else
{
        $tmpstr .= '' . $ttpl_a_href_self . '';
        $tmpstr = str_replace('{$explain}', ii_itake('global.lng_cutepage.nextpage', 'lng'), $tmpstr);
        $tmpstr = str_replace('{$value}', ii_iurl('cutepage', $tpage - 1, $nurltype, $ct_strers), $tmpstr);
}
    return $tmpstr;
  }
}

实现文章摘要功能代码,过滤HTML代码的涵数
🙂 把以下代码添加到: common/incfiles/function.inc.php

function ii_removeHTML($str)
{
  $a = strip_tags($str);
  if (!ii_isnull($a)){
  $a = str_replace(VbCrLf, "", $a);
  $a = str_replace(vbNewLine, "", $a);
  $a = str_replace(" ", "", $a);
  $a = str_replace(" ", "", $a);
  $a = str_replace(" ", "", $a);
  $a = str_replace(chr(13), "", $a);
  $a = str_replace(chr(10), "", $a);
  $a = str_replace(" ", "", $a);   }
  return $a;
}

如:
建立模板:homenewsright

    {@}

  • {$=ii_left(ii_RemoveHTML(mm_encode_content($GLOBALS[‘RST_content’], ‘{$cttype}’)), 100)}
  • {@}


其中mm_encode_content($GLOBALS[‘RST_content’], ‘{$cttype}’)负责提取内容,ii_removeHTML负责去处HTML标记(如空格,换行等等)
常用变量和函数

{$=mm_web_head($GLOBALS['nhead'])} 头部代码
{$=mm_web_foot($GLOBALS['nfoot'])} 底部代码
{$=mm_web_base()} 页面BASE
{$=mm_get_sorttext('{$baseurl}', 'chinese', '{$class}')} 获得当前栏目名称
{$=vv_inavigation('{$genre}', 'classid={$classid};strers=module;strurl={$genre}')} 完整当前位置
{$=vv_isort('{$genre}', 'tpl=sort')} 获取类别导航
{$=#global_images_route} 目录: /common/images/
{$=ii_iurl('detail', {$id}, $GLOBALS['nurltype'], 'folder=' . $GLOBALS['ncreatefolder'] . ';filetype=' . $GLOBALS['ncreatefiletype'] . ';time={$time}')} 新闻地址
{$topic} 新闻标题
{$classid} 栏目ID
{$genre} 模块名
{$time} 时间
{$=ii_format_date('{$time}', 0)} 20081022111263
{$=ii_format_date('{$time}', 1)} 2008-10-22
{$=ii_format_date('{$time}', 2)} 2008/10/22
{$=ii_format_date('{$time}', 3)} 2008.10.22
{$count} 栏目列表页-文章点击数
{$cpagestr} 分页
{$=ii_itake('classid.list_{$classid}','lng')} 栏目名称(自己新建语言节点调用栏目名称)
{$=ii_itake('global.module.web_title','lng')} 网站名称
{@recurrence_ida} 循环标题 ( 开始/结束 )
{$=vv_itransfer('top', '1', 'topx=8;genre=article')} 自定义调用文章列表的样式
{$=ii_itake('classid.list_{$classid}','lng')} 获取节点内容的样式
{$=vv_isort('{$genre}', 'tpl=sort')} 文章类别样式
{$=vv_inavigation('{$genre}', 'classid={$class};strers=module;strurl={$genre}')}
{$=mm_encode_content(mm_cutepage_content($GLOBALS['RS_content'], 'cp_note={$cp_note};cp_mode={$cp_mode};cp_type={$cp_type};cp_num={$cp_num};cp_page={$page}'), '{$cttype}')} 详细页内容
{$=mm_cutepage_content_page_sel($GLOBALS['RS_content'], 'cp_note={$cp_note};cp_mode={$cp_mode};cp_type={$cp_type};cp_num={$cp_num}', 'folder=' . $GLOBALS['ncreatefolder'] . ';filetype=' . $GLOBALS['ncreatefiletype'] . ';cutekey={$id};time={$time}')}
{$=ii_left("{$daodu}", 4)} 限制输出文字
【

打印

】【

关闭

0 内容页--显示点击数
更新数据库点击数:

written by panhezeng \\ tags:

©panhezeng for 阿潘道, 2006-2023. 原文地址:https://apsay.com/2011/04/14/jtbc-cms/
本文遵循署名-非商业性使用共享协议,转载请注明。

Leave a Reply

Me

点这和我talk,panhezeng@gmail.com