惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Hugging Face - Blog
Hugging Face - Blog
Jina AI
Jina AI
宝玉的分享
宝玉的分享
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
人人都是产品经理
人人都是产品经理
博客园 - 聂微东
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
J
Java Code Geeks
博客园 - 【当耐特】
小众软件
小众软件
博客园 - Franky
S
SegmentFault 最新的问题
WordPress大学
WordPress大学
雷峰网
雷峰网
The Cloudflare Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
量子位
Last Week in AI
Last Week in AI
博客园_首页
月光博客
月光博客
IT之家
IT之家
阮一峰的网络日志
阮一峰的网络日志
Webroot Blog
Webroot Blog
Stack Overflow Blog
Stack Overflow Blog
腾讯CDC
云风的 BLOG
云风的 BLOG
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
Recent Commits to openclaw:main
Recent Commits to openclaw:main
D
Docker
The Last Watchdog
The Last Watchdog
有赞技术团队
有赞技术团队
Hacker News - Newest:
Hacker News - Newest: "LLM"
D
DataBreaches.Net
S
Security @ Cisco Blogs
Blog — PlanetScale
Blog — PlanetScale
GbyAI
GbyAI
TaoSecurity Blog
TaoSecurity Blog
S
Security Affairs
Y
Y Combinator Blog
O
OpenAI News
罗磊的独立博客
MongoDB | Blog
MongoDB | Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Forbes - Security
Forbes - Security
P
Palo Alto Networks Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
K
Kaspersky official blog
Cloudbric
Cloudbric

博客园 - fogwu

解决js每次刷新都需要实时从服务端获取的方法 powerdesinger 生成数据库结构表图并导出pdf iis 应用程序池通过钉钉机器人进行监控 windows 系统查看文件或文件夹被哪个进程占用并解除的方法 windows server 2022 通过命令行更改远程端口 sqlsever 2008 全文索引的使用 uni-app 开发微信小程序 onLaunch后再执行页面onLoad ASP.NET ”未显示页面,因为请求实体过大“的问题处理 ubutu 安装雷池waf 宝塔 nginx 安装 免费防护墙ModSecurity 模块 laravel postman api 请求, 表单验证不通过,不返回错误信息的json 而是返回302重定向 Windows Server 下 IIS 申请部署 Let's Encrypt 证书实现 免费 HTTPS h5 自适应页面背景图无法自动适应的问题 iis 部署SSL 出现错误的处理方法推荐 think\db\Raw could not be converted to string 错误的处理方式 - fogwu 解决使用js 打印当前页面时会多出一页空白纸张的问题 windiows 显卡安装指定旧版驱动 mysql 5.6 升级到 5.7 教程 winows 下iis+nginx +php 部署 windows cmd 命令中使用grep 查找
mediawiki 调用外站内容方法
fogwu · 2022-12-22 · via 博客园 - fogwu

我使用的skin是 Timeless。在TimelessTemplate.php文件中做了修改

一、加入以下代码,读取远程接口api内容后进行处理

    private  function  handleNews($cateId=0)
    {
        $content=file_get_contents('http://szxw/index.php?s=article&c=search&cateId='.$cateId.'&api_call_function=module_list&appid=1&appsecret=ABDf');
        if(strpos($content,'code'))
        {
          $jscontent=json_decode($content,true);
           $strs='';
            foreach ($jscontent['data'] as $item) {
                $strs.="<li><a target='_blank' href=".$item['url'].">".$item['title']."</a></li>";
            }
            return "<ul>$strs</ul>";
        }
    }

使用以上代码生成了ul内容列表

二、修改方法 getContentBlock 加入了以下内容

protected function getContentBlock() {
        $templateData = $this->getSkin()->getTemplateData();
        $content=$this->get( 'bodytext' );
        if(preg_match('/\$catid(\d+)\$/',$content, $matches ) && $_GET['action']!='edit')
        {
            $content=str_replace($matches[0],$this->handleNews($matches[1]),$content);
        }
...................

    Html::rawElement( 'div', [ 'id' => 'bodyContent' ],
                    $this->getContentSub() .
                    $content.
                    $this->getClear()
                )
            )
        );

        return Html::rawElement( 'div', [ 'id' => 'mw-content' ], $html);
    }

第三步,在创建词条时,加入如下使用

  其中传入参数59为需要处理的目录ID