本文整理汇总了PHP中comments::get方法的典型用法代码示例。如果您正苦于以下问题:PHP comments::get方法的具体用法?PHP comments::get怎么用?PHP comments::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类comments
的用法示例。
在下文中一共展示了comments::get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
function index()
{
if (isset($this->args[0]) && $this->args[0] != "index") {
system::setParam("page", "layout");
$cacheID = $this->args[0] . "|ARTICLE";
$this->smarty->setCacheID($cacheID);
if (isset($_POST["contentID"]) && $_POST["contentID"]) {
comments::add(intval($_POST["contentID"]));
}
$this->smarty->assign("isFav", blog::isFavorite($this->args[0]));
if (!$this->smarty->isCached()) {
$sqlData = blog::getOnePost($this->args[0], "article")->fetch();
if ($sqlData) {
$this->smarty->assign("comments", comments::get(intval($sqlData["contentID"])));
$this->smarty->assign("post", $sqlData);
}
}
} else {
$offset = 1;
system::setParam("page", "list");
if (isset($this->get["offset"])) {
$offset = intval($this->get["offset"]);
}
$cacheID = "ARTICLES|artoffset_{$offset}";
$this->smarty->setCacheID($cacheID);
if (!$this->smarty->isCached()) {
$allCount = $this->db->query("SELECT COUNT(*) as cnt FROM `content` WHERE `type`='article'")->fetch();
$this->smarty->assign("posts", news::getPosts(core::pagination($allCount["cnt"], $offset), "article")->fetchAll());
}
}
}
示例2: change_rateAction
public function change_rateAction()
{
if (!isset($_SESSION['comments_rate'][system::url(2)])) {
if ($comment = comments::get(system::url(2))) {
if (system::url(3) == 'up') {
$comment->rateUp();
} else {
$comment->rateDown();
}
$_SESSION['comments_rate'][$comment->id()] = 1;
$comment->save();
}
}
system::stop();
}
示例3: index
function index()
{
system::setParam("page", "post");
if ($this->args[0] != "blog") {
$cacheID = $this->args[0] . "|POST";
$this->smarty->setCacheID($cacheID);
if (isset($_POST["SLUG"]) && isset($_POST["comment"])) {
blog::addCommentBySLUG($_POST["SLUG"]);
}
if (!$this->smarty->isCached()) {
$sqlData = blog::getOnePost($this->args[0])->fetchAll();
if ($sqlData) {
$sqlData = array_shift($sqlData);
$comments = comments::get($sqlData["contentID"]);
$this->smarty->assign("comments", $comments);
blog::highlightCode($sqlData["body"]);
$this->smarty->assign("item", $sqlData);
}
}
} else {
system::redirect("/");
}
}
示例4: view
/**
* @return HTML
* @param int $comment_id - ID комментария
* @param string $templ_name - Шаблон оформления комментария
* @desc МАКРОС: Выводит информацию об указанном комментарии
*/
public function view($comment_id, $templ_name = 'tree')
{
$templ_file = '/comments/' . $templ_name . '.tpl';
$TEMPLATE = page::getTemplate($templ_file);
if (!is_array($TEMPLATE)) {
return page::errorNotFound('comments.view', $templ_file);
}
if ($comment = comments::get($comment_id)) {
if ($comment->isActive() || reg::getKey('/comments/show_noactive')) {
page::assign('obj.id', $comment->id());
page::assign('obj.parent_id', $comment->getParentId());
page::assign('obj.user_id', $comment->getUserId());
page::assign('obj.publ_date', $comment->getPublDate());
page::assign('obj.username', $comment->getUserName());
page::assign('obj.email', $comment->getEmail());
page::assign('obj.text', $comment->getText());
page::assign('obj.rate', $comment->getRate());
if (isset($_SESSION['comments_rate'][$comment->id()])) {
page::fParse('rate', $TEMPLATE['rate_change']);
} else {
page::fParse('rate', $TEMPLATE['rate']);
}
page::assign('list', '');
return page::parse($TEMPLATE['list']);
}
}
}
示例5: act
public function act()
{
if (system::issetUrl(2) && is_numeric(system::url(2))) {
if ($obj = comments::get(system::url(2))) {
$obj->setActive(!$obj->isActive());
$obj->save();
echo $obj->isActive() ? 'active' : 'no_active';
}
} else {
if (isset($_POST['objects'])) {
while (list($id, $val) = each($_POST['objects'])) {
if ($obj = comments::get($val)) {
$obj->setActive(!$obj->isActive());
$obj->save();
}
}
echo 'invert';
}
}
system::stop();
}
示例6: comments
<?php
// +----------------------------------------------------------------------
// | Demila [ Beautiful Digital Content Trading System ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
_setView(__FILE__);
$commentID = get_id(2);
$commentsClass = new comments();
$comment = $commentsClass->get($commentID);
if (!is_array($comment)) {
addErrorMessage($langArray['wrong_comment'], '', 'error');
} else {
abr('show_form', 'yes');
abr('comment', $comment);
}