top-image

OLDER ARTICLES

  • 列表页中调用(嵌套在pboot:list标签中):
    html
     
    {pboot:tags id=[list:id]}
    [tags:text]
    {/pboot:tags}
  • 内容页中调用:
    html
     
    {pboot:tags id={content:id}}
    [tags:text]
    {/pboot:tags}
  • 全站tag调用:
    html
     
    {pboot:tags}
    [tags:text]
    {/pboot:tags}
  • tags.html调用列表:
    html
     
    {pboot:list num=10 scode=* page=1}
    {/pboot:list}
  • 默认404页面

    • 宝塔面板新建站点时默认包含一个404页面,路径为“/www/wwwroot/网站目录/404.html”。
  • 使用模板自带404页面

    1. 登录宝塔后台
      • 打开左侧导航栏中的“网站”。
    2. 修改配置文件
      • 找到要修改的网站,点击“设置”–“配置文件”,删除相关404配置代码(仅适用于Nginx环境)。
  • 函数位置

    • zblogphp.php文件,第3312行。
  • 函数参数

    • $name:字符串类型,分类名称,必须项。
    • $type:字符串类型,排序类型,选填项。
  • 函数输出

    • 输出一个对象,对象内容为指定分类的所有值。
  • 示例

    $category = $zbp->GetCategoryByName('产品');
    echo $category->Alias; // 输出分类的别名

     

[e:loop={'select * from phome_enewstags limit 100',32,24,0}]
<li><a href="<?=$public_r[newsurl]?>e/tags/?tagid=<?=$bqr['tagid']?>"><?=$bqr['tagname']?></a></li>
[/e:loop]

 

  1. 自定义函数

    • 在 /e/class/userfun.php 文件中添加以下代码:
    function moban5_time($tm, $num) {
        if ($num == 1) {
            $tm = strtotime($tm);
        }
        $cur_tm = time();
        $dif = $cur_tm - $tm;
        $pds = array('秒', '分钟', '小时', '天', '周', '个月', '年');
        $lngh = array(1, 60, 3600, 86400, 604800, 2630880, 31570560);
        for ($v = sizeof($lngh) - 1; ($v >= 0) && (($no = $dif / $lngh[$v]) <= 1); $v--) {
            if ($v < 0) $v = 0;
        }
        $_tm = $cur_tm - ($dif % $lngh[$v]);
        $no = floor($no);
        $x = sprintf("%d%s", $no, $pds[$v]);
        return $x . "前";
    }

    列表内容页调用

  2. '.moban5_time($r[newstime], 0).'
  3. 内容模板调用

    <?=moban5_time($navinfor[newstime], 0)?>

     

  1. 调用栏目名称

     
     
    <?=$class_r[$GLOBALS[navclassid]][classname]?>
  2. 调用栏目URL

     
     
    <?=$public_r[newsurl].$class_r[$GLOBALS[navclassid]][classpath]?>
  3. 调用栏目别名

     
     
    <?=$class_r[$GLOBALS[navclassid]][bname]?>
  • 问题:如何在帝国CMS中修改当前位置面包屑导航条中的“首页”字样的文字?
  • 答案:修改语言文件中的相应内容。
    1. 在目录 e/data/language/gb/pub/ 中找到 fun.php 文件。
    2. 打开该文件,找到第91行(如果之前没有修改过该文件)。
    3. 将 'index'=>'首页' 修改为 'index'=>'MoBan5源码'
    'index' => 'MoBan5源码',

    根据需要修改,如果怕改错可以先备份文件再改。

  • 问题:如何在帝国CMS模板中判断当前页面是否为首页进行高亮?
  • 答案:使用PHP判断语句。
    <li<?php if($GLOBALS[navclassid]) { ?>class="hover"<?php } else { ?>class="on"<?php } ?>>

 

  1. 修改文件

    • 打开e/admin/ecmseditor/editorfun.php文件。
  2. 修改代码

    • 找到并修改以下代码:
       
       
      $pic = "<a href='" . $bimgurl . "' target='_blank'><img src='" . $imgurl . "' border='" . $r['imgborder'] . $width . $height . "'></a>";
      return $pic;
    • 修改为:
       
       
      $pic = "<img src='" . $imgurl . "'>";
      return $pic;
  1. 修改HTML代码

    • 将点击数显示部分修改为:
      <em class="clickcount" data-class="[!--classid--]" data-id="[!--id--]">[!--onclick--]</em>
  2. 添加JS代码

    • 在模板页面尾部加入以下JS代码:
      <script>
      window.onload = function() {
          $('.clickcount').each(function(i) {
              var url = "[!--news.url--]e/public/ViewClick?&down=0&nojs=1&classid=" + $(this).attr("data-class") + "&id=" + $(this).attr("data-id");
              $(this).load(url);
          });
      }
      </script>
  3. 修改系统文件

    • 找到e/public/ViewClick/index.php文件,找到以下代码:
      echo "document.write('" . $shownum . "');";
    • 修改为:
      if ($_GET['nojs'] == 1) {
          echo $shownum;
      } else {
          echo "document.write('" . $shownum . "');";
      }

以上是针对帝国CMS常见问题的解决方案,希望对您有所帮助。

Page 568 of 1049:« First« 565 566 567 568 569 570 571 »Last »
bottom-img