當前位置: 首頁>>代碼示例>>PHP>>正文


PHP post::numComments方法代碼示例

本文整理匯總了PHP中post::numComments方法的典型用法代碼示例。如果您正苦於以下問題:PHP post::numComments方法的具體用法?PHP post::numComments怎麽用?PHP post::numComments使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在post的用法示例。


在下文中一共展示了post::numComments方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: explode

 $D->idpostShared = $D->idpost;
 $D->isShare = 0;
 if ($D->typepost == 'share') {
     $infop = explode(':', $D->valueattach);
     $D->idpostShared = $infop[0];
     $D->isShare = 1;
 }
 // see if the favorite is for the observer
 $D->liketoUser = 0;
 if ($D->is_logged == 1) {
     if ($onePost->likeOfUser($this->user->id) > 0) {
         $D->liketoUser = 1;
     }
 }
 $D->htmlcommentspost = '';
 $D->totalcomments = $onePost->numComments();
 $allcommentspost = $onePost->getComments(0, $C->NUM_COMMENTS_PER_POST);
 $D->numcomments = count($allcommentspost);
 $allcommentspost = array_reverse($allcommentspost);
 foreach ($allcommentspost as $onecomment) {
     $D->o_comment = stripslashes($onecomment->comment);
     $D->o_username = stripslashes($onecomment->username);
     $D->o_firstname = stripslashes($onecomment->firstname);
     $D->o_lastname = stripslashes($onecomment->lastname);
     $D->o_ucode = $onecomment->ucode;
     $D->o_nameUser = empty($D->o_firstname) || empty($D->o_lastname) ? stripslashes($D->o_username) : stripslashes($D->o_firstname) . ' ' . stripslashes($D->o_lastname);
     $D->o_whendate = $onecomment->whendate;
     $D->o_avatar = empty($onecomment->avatar) ? $C->AVATAR_DEFAULT : $onecomment->avatar;
     $D->o_idcomment = $onecomment->idcomment;
     $D->o_idUser = $onecomment->iduser;
     $D->o_idpost = $D->idpost;
開發者ID:waqasraza123,項目名稱:social_network_in_php_frenzy,代碼行數:31,代碼來源:posts.php

示例2: post

    $numitems = $this->db1->e($_POST["ni"]);
}
if (empty($codepost)) {
    $errored = 1;
    $txterror .= 'Error. ';
}
if (!is_numeric($numitems) || $numitems <= 0) {
    $errored = 1;
    $txterror .= 'Error. ';
}
if ($errored == 1) {
    echo '0: ' . $txterror;
} else {
    $onePost = new post($codepost);
    $htmlResults = '';
    $totalitems = $onePost->numComments();
    $allcommentspost = $onePost->getComments($numitems, $C->NUM_COMMENTS_PER_POST);
    $numitemsnow = count($allcommentspost);
    $allcommentspost = array_reverse($allcommentspost);
    foreach ($allcommentspost as $onecomment) {
        ob_start();
        $D->o_comment = stripslashes($onecomment->comment);
        $D->o_username = stripslashes($onecomment->username);
        $D->o_firstname = stripslashes($onecomment->firstname);
        $D->o_lastname = stripslashes($onecomment->lastname);
        $D->o_ucode = $onecomment->ucode;
        $D->o_nameUser = empty($D->o_firstname) || empty($D->o_lastname) ? stripslashes($D->o_username) : stripslashes($D->o_firstname) . ' ' . stripslashes($D->o_lastname);
        $D->o_whendate = $onecomment->whendate;
        $D->o_avatar = empty($onecomment->avatar) ? $C->AVATAR_DEFAULT : $onecomment->avatar;
        $D->o_idcomment = $onecomment->idcomment;
        $D->o_idUser = $onecomment->iduser;
開發者ID:waqasraza123,項目名稱:social_network_in_php_frenzy,代碼行數:31,代碼來源:ajax_reload-comments-post.php


注:本文中的post::numComments方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。