[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 32[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 32[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 68[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 69[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 70[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 72[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 73[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 74[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 75[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 144[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 166[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 170[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 174[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 182[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 183[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 191[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 192[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 193[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 201[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 202[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 203[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 204[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 212[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 213[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 214[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 215[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 216[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 310[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 340[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 352[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 387[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 418[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 440[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 440[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 441[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 443[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 448[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 451[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 453[2025-05-03 15:51:59] Array and string offset access syntax with curly braces is deprecated in /home/wwwroot/blog.shyclouds.net/var/Json.php on line 456

Discuz 3.4顶部格子广告显示列数修改

楚天乐 4113 0 条

背景

一直以来都特别鄙视Discuz,Wordpress这种结构混乱的项目。平心而论,十多年前的代码,功能强大,运行稳定自然是没得说的。但是代码质量就不敢恭维了。所以一直以来都不愿意去碰这类项目,然而,人生不如意十之八九,偏偏就有这类项目飞脸上来。有钱不赚非君子,干吧

问题描述

为discuz安装插件,添加了顶部格子广告位。广告位默认一行显示5张广告图,然而客户要求一行3张。

解决方法

位置:source/class/adv/adv_text.php

这段代码,把两个5都改成3即可
$advcount = count($adids);
if($advcount > 5) {
    $minfillpercent = 0;
    for($cols = 5; $cols >= 3; $cols--) {
        if(($remainder = $advcount % $cols) == 0) {
            $advcols = $cols;
            break;
        } elseif($remainder / $cols > $minfillpercent)  {
            $minfillpercent = $remainder / $cols;
            $advcols = $cols;
        }
    }
} else {
    $advcols = $advcount;
}
$adcode = \'\';
for($i = 0; $i < $advcols * ceil($advcount / $advcols); $i++) {
    $adcode .= (($i + 1) % $advcols == 1 || $advcols == 1 ? \'<tr>\' : \'\').
        \'<td width="\'.intval(100 / $advcols).\'%">\'.(isset($codes[$adids[$i]]) ? $codes[$adids[$i]] : \'&nbsp;\').\'</td>\'.
        (($i + 1) % $advcols == 0 ? "</tr>\n" : \'\');
}
$adcode = \'<table cellpadding="0" cellspacing="1">\'.$adcode.\'</table>\';

打赏

微信打赏

支付宝打赏



与本文相关的文章

发表我的评论
昵称 (必填)
邮箱 (必填)
网址
执行时间: 48.408031463623 毫秒