Typecho如何单纯输出上一篇和下一篇文章的链接和标题。
上一篇文章$this->thePrev()
下一篇文章$this->theNext()
输出中包含有a标签,应该如何获取单纯的链接地址 和 文章标题?
是需要修改系统核心还是可以有更简单的方法?
系统核心代码:
<code>public function theNext($format = '%s', $default = NULL, $custom = array()) { $content = $this->db->fetchRow($this->select()->where('table.contents.created > ? AND table.contents.created created, $this->options->gmtTime) ->where('table.contents.status = ?', 'publish') ->where('table.contents.type = ?', $this->type) ->where('table.contents.password IS NULL') ->order('table.contents.created', Typecho_Db::SORT_ASC) ->limit(1)); if ($content) { $content = $this->filter($content); $default = array( 'title' => NULL, 'tagClass' => NULL ); $custom = array_merge($default, $custom); extract($custom); $linkText = empty($title) ? $content['title'] : $title; $linkClass = empty($tagClass) ? '' : 'class="' . $tagClass . '" '; $link = '<a . title="' . $content['title'] . '">' . $linkText . '</a>'; printf($format, $link); } else { echo $default; } } public function thePrev($format = '%s', $default = NULL, $custom = array()) { $content = $this->db->fetchRow($this->select()->where('table.contents.created created) ->where('table.contents.status = ?', 'publish') ->where('table.contents.type = ?', $this->type) ->where('table.contents.password IS NULL') ->order('table.contents.created', Typecho_Db::SORT_DESC) ->limit(1)); if ($content) { $content = $this->filter($content); $default = array( 'title' => NULL, 'tagClass' => NULL ); $custom = array_merge($default, $custom); extract($custom); $linkText = empty($title) ? $content['title'] : $title; $linkClass = empty($tagClass) ? '' : 'class="' . $tagClass . '" '; $link = '<a . title="' . $content['title'] . '">' . $linkText . '</a>'; printf($format, $link); } else { echo $default; } } </code>
回复内容:
上一篇文章$this->thePrev()
下一篇文章$this->theNext()
输出中包含有a标签,应该如何获取单纯的链接地址 和 文章标题?
是需要修改系统核心还是可以有更简单的方法?
系统核心代码:
<code>public function theNext($format = '%s', $default = NULL, $custom = array()) { $content = $this->db->fetchRow($this->select()->where('table.contents.created > ? AND table.contents.created created, $this->options->gmtTime) ->where('table.contents.status = ?', 'publish') ->where('table.contents.type = ?', $this->type) ->where('table.contents.password IS NULL') ->order('table.contents.created', Typecho_Db::SORT_ASC) ->limit(1)); if ($content) { $content = $this->filter($content); $default = array( 'title' => NULL, 'tagClass' => NULL ); $custom = array_merge($default, $custom); extract($custom); $linkText = empty($title) ? $content['title'] : $title; $linkClass = empty($tagClass) ? '' : 'class="' . $tagClass . '" '; $link = '<a . title="' . $content['title'] . '">' . $linkText . '</a>'; printf($format, $link); } else { echo $default; } } public function thePrev($format = '%s', $default = NULL, $custom = array()) { $content = $this->db->fetchRow($this->select()->where('table.contents.created created) ->where('table.contents.status = ?', 'publish') ->where('table.contents.type = ?', $this->type) ->where('table.contents.password IS NULL') ->order('table.contents.created', Typecho_Db::SORT_DESC) ->limit(1)); if ($content) { $content = $this->filter($content); $default = array( 'title' => NULL, 'tagClass' => NULL ); $custom = array_merge($default, $custom); extract($custom); $linkText = empty($title) ? $content['title'] : $title; $linkClass = empty($tagClass) ? '' : 'class="' . $tagClass . '" '; $link = '<a . title="' . $content['title'] . '">' . $linkText . '</a>'; printf($format, $link); } else { echo $default; } } </code>
估计是要改的了。
实在不适合你的需求的话,可以在 functions.php 文件中重写两个代码。

ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

AI Hentai Generator
AIヘンタイを無料で生成します。

人気の記事

ホットツール

メモ帳++7.3.1
使いやすく無料のコードエディター

SublimeText3 中国語版
中国語版、とても使いやすい

ゼンドスタジオ 13.0.1
強力な PHP 統合開発環境

ドリームウィーバー CS6
ビジュアル Web 開発ツール

SublimeText3 Mac版
神レベルのコード編集ソフト(SublimeText3)

ホットトピック











PHP 8.4 では、いくつかの新機能、セキュリティの改善、パフォーマンスの改善が行われ、かなりの量の機能の非推奨と削除が行われています。 このガイドでは、Ubuntu、Debian、またはその派生版に PHP 8.4 をインストールする方法、または PHP 8.4 にアップグレードする方法について説明します。

ファイルのアップロードを行うには、フォーム ヘルパーを使用します。ここではファイルアップロードの例を示します。

CakePHP は、PHP 用のオープンソース フレームワークです。これは、アプリケーションの開発、展開、保守をより簡単にすることを目的としています。 CakePHP は、強力かつ理解しやすい MVC のようなアーキテクチャに基づいています。モデル、ビュー、コントローラー

Visual Studio Code (VS Code とも呼ばれる) は、すべての主要なオペレーティング システムで利用できる無料のソース コード エディター (統合開発環境 (IDE)) です。 多くのプログラミング言語の拡張機能の大規模なコレクションを備えた VS Code は、
