当前位置: 首页>>代码示例>>PHP>>正文


PHP misc::date_words方法代码示例

本文整理汇总了PHP中misc::date_words方法的典型用法代码示例。如果您正苦于以下问题:PHP misc::date_words方法的具体用法?PHP misc::date_words怎么用?PHP misc::date_words使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在misc的用法示例。


在下文中一共展示了misc::date_words方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: COUNT

$query = "SELECT COUNT(*) FROM {$forum_post_table} WHERE topic_id='{$id}'";
$result = $db->query($query);
$row = $result->fetch_assoc();
$numrows = $row['COUNT(*)'];
$result->free_result();
if ($numrows == 0) {
    header("Location: index.php?page=forum&s=list");
    exit;
}
$pg = "forum2";
require "includes/header.php";
$query = "SELECT t1.id, t1.title, t1.post, t1.author, t1.creation_date, t2.creation_post FROM {$forum_post_table}  AS t1 JOIN {$forum_topic_table} AS t2 ON t2.id=t1.topic_id WHERE t1.topic_id='{$id}' ORDER BY id LIMIT {$page}, {$limit}";
$result = $db->query($query) or die(mysql_error());
print '<div style="margin-left: 15px; margin-right: 15px;"><div id="forum" class="response-list">';
while ($row = $result->fetch_assoc()) {
    $date_made = $misc->date_words($row['creation_date']);
    print '<div class="post"><div class="author">
		<h6 class="author"><a name="' . $row['id'] . '"></a><a href="index.php?page=account_profile&amp;uname=' . $row['author'] . '" style="font-size: 14px;">' . $row['author'] . '</a></h6>
		<span class="date">' . $date_made . ' </span>
		</div><div class="content">
		<h6 class="response-title">' . $row['title'] . '</h6>
		<div class="body">' . $misc->short_url($misc->swap_bbs_tags($misc->linebreaks($row['post']))) . '</div>
		<div class="footer">';
    if ($uname == $row['author'] || $user->gotpermission('edit_forum_posts')) {
        echo '<a href="#" onclick="showHide(\'c' . $row['id'] . '\'); return false;">edit</a> |';
    } else {
        echo '<a href="">edit</a> |';
    }
    echo ' <a href="#" onclick="javascript:document.getElementById(\'reply_box\').value=document.getElementById(\'reply_box\').value+\'[quote]' . $row['author'] . ' said:\\r\\n' . str_replace("'", "\\'", str_replace("\r\n", '\\r\\n', str_replace('&#039;', "'", $row['post']))) . '[/quote]\'; return false;">quote</a> ';
    if ($user->gotpermission('delete_forum_posts') && $row['id'] != $row['creation_post']) {
        print ' | <a href="index.php?page=forum&amp;s=remove&amp;pid=' . $id . '&amp;cid=' . $row['id'] . '">remove</a><br />';
开发者ID:xfirespeed,项目名称:TyP-Gallery,代码行数:31,代码来源:forum_view.php

示例2: ON

if ($search != "") {
    $query = "SELECT t1.id, t1.topic, t1.last_updated, t1.priority, t1.author FROM {$forum_topic_table} AS t1 JOIN {$forum_post_table} AS t2 ON (MATCH(t2.post) AGAINST({$search})>0.5) ORDER BY t1.priority DESC, t1.last_updated DESC LIMIT {$page}, {$limit}";
} else {
    $query = "SELECT id, topic, last_updated, author, locked, priority FROM {$forum_topic_table}  ORDER BY priority DESC, last_updated DESC LIMIT {$page}, {$limit}";
}
$result = $db->query($query) or die($db->error());
if ($user->gotpermission('delete_forum_topics') || $user->gotpermission('pin_forum_topics')) {
    print '<th width="10%">Tools</th>';
}
echo '</tr>';
while ($row = $result->fetch_assoc()) {
    $que = "SELECT COUNT(*) FROM {$forum_post_table} WHERE topic_id='" . $row['id'] . "'";
    $res = $db->query($que) or die($db->error());
    $ret = $res->fetch_assoc();
    $replies = $ret['COUNT(*)'] - 1;
    $date_now = $misc->date_words($row['last_updated']);
    $sticky = "";
    $locked = "";
    if ($row['priority'] == "1") {
        $sticky = "Sticky: ";
    }
    if ($row['locked'] == "1") {
        $locked = ' <span class="locked-topic">(locked)</span>';
    }
    print '<tr>';
    print '<td>' . $sticky . '<a href="?page=forum&amp;s=view&amp;id=' . $row['id'] . '">' . $row['topic'] . '</a>' . $locked . '</td><td>' . $row['author'] . '</td><td>' . $date_now . '</td><td>' . $replies . '</td>';
    if ($row['priority'] == 0) {
        if ($user->gotpermission('pin_forum_topics')) {
            print '<td><a href="index.php?page=forum&amp;s=edit&amp;pin=1&amp;id=' . $row['id'] . '&amp;pid=' . $page . '">Pin</a> | ';
        }
    } else {
开发者ID:xfirespeed,项目名称:TyP-Gallery,代码行数:31,代码来源:forum_list.php


注:本文中的misc::date_words方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。