PHP 索引的主题标题由hcs编辑EDITED BY ME

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP 索引的主题标题由hcs编辑EDITED BY ME相关的知识,希望对你有一定的参考价值。

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE extension SYSTEM "ext-1.0.dtd">

<!--
/**
 * @copyright topic_title_on_index Copyright (C) 2008 hcs
 * @copyright Copyright (C) 2008 PunBB, partially based on code copyright (C) 2008 FluxBB.org
 * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
 * @package topic_title_on_index
 */
-->

<extension engine="1.0">
	<id>topic_title_on_index</id>
	<title>Topic title on forum index </title>
	<version>1.0.0 Beta</version>
	<description>Replace the Last Post link on the index page for the name of the topic instead of the date format.</description>
	<author>hcs</author>

	<minversion>1.3</minversion>
	<maxtestedon>1.3.2</maxtestedon>

	<hooks>
		<hook id="in_qr_get_cats_and_forums"><![CDATA[
$query['SELECT'] .=', t.subject, u.id as poster_id';
$query['JOINS'][] = array(
    'LEFT JOIN'    => 'topics AS t',
    'ON'        => 'f.last_post_id=t.last_post_id'
);
$query['JOINS'][] = array(
    'LEFT JOIN'    => 'users AS u',
    'ON'        => 'f.last_poster=u.username'
);
		]]></hook>
		
		<hook id="in_start"><![CDATA[
function words($string, $words)
{
	return implode(" ", array_slice(explode(' ', $string), 0, $words)) . '...';
}

function relative_time($timestamp)
{
	$d = time() - $timestamp;
	if ($d < 60)
		return $d." second".(($d==1)?'':'s')." ago";
	else
	{
		$d = floor($d / 60);
		if($d < 60)
			return $d." minute".(($d==1)?'':'s')." ago";
		else
		{
			$d = floor($d / 60);
			if($d < 24)
				return $d." hour".(($d==1)?'':'s')." ago";
			else
			{
				$d = floor($d / 24);
				if($d < 7)
					return $d." day".(($d==1)?'':'s')." ago";
				else
				{
					$d = floor($d / 7);
					if($d < 4)
						return $d." week".(($d==1)?'':'s')." ago";
				}//Week
			}//Day
		}//Hour
	}//Minute
}

$words = 4;
		]]></hook>
		
		<hook id="in_normal_row_pre_display"><![CDATA[
if(strpos($forum_page['item_body']['info']['lastpost'], $lang_index['No post info']) === false && strpos($forum_page['item_body']['info']['lastpost'], $lang_common['Never']) === false)
	$forum_page['item_body']['info']['lastpost'] = '<li class="info-lastpost"><span class="label">'.$lang_index['Last post'].'</span> <strong><a href="'.forum_link($forum_url['post'], $cur_forum['last_post_id']).'">'.forum_htmlencode(words($cur_forum['subject'], $words)).'</a></strong> <cite>'.relative_time($cur_forum['last_post']).' '.sprintf($lang_index['Last poster'], '<a href="'.forum_link($forum_url['user'], $cur_forum['poster_id']).'">'.forum_htmlencode($cur_forum['last_poster']).'</a>').'</cite></li>';
		]]></hook>

	</hooks>

</extension>

以上是关于PHP 索引的主题标题由hcs编辑EDITED BY ME的主要内容,如果未能解决你的问题,请参考以下文章

hcs 的w的理解

freescale飞思卡尔 HCS12 系列单片机bootloader详解

mysql 学习 - 索引深度理解

我想在我的页脚中编辑页脚学分。我正在使用 Whitedot 主题。这是我的 footer.php 文件的代码

Laravel 5.6 上的 419 Ajax 错误 - 已编辑

WP 主题在 FF 中无法正确显示