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


PHP BxDolCmts::getCommentsTableName方法代码示例

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


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

示例1: GenAnyBlockContent

    function GenAnyBlockContent($sOrder = 'last', $iProfileID = 0, $sLimit = "LIMIT 5")
    {
        global $site;
        global $short_date_format;
        $php_date_format = getParam('php_date_format');
        $iBlogLimitChars = (int) getParam("max_blog_preview");
        $sClockIcon = getTemplateIcon('clock.gif');
        $sOrderS = '';
        switch ($sOrder) {
            case 'last':
                $sOrderS = "ORDER BY `DateTime` DESC";
                break;
            case 'latest':
                $sOrderS = "ORDER BY `DateTime` DESC";
                break;
            case 'rand':
                $sOrderS = "ORDER BY RAND()";
                break;
            case 'top':
                $sOrderS = "ORDER BY `CommCount` DESC";
                break;
        }
        $sProfileS = $iProfileID > 0 ? "`ClassifiedsAdvertisements`.`IDProfile` = '{$iProfileID}'" : '1';
        $sTimeAddon = $iProfileID > 0 ? '' : "AND DATE_ADD(`ClassifiedsAdvertisements`.`DateTime` , INTERVAL `ClassifiedsAdvertisements`.`LifeTime` DAY) > NOW()";
        $oCmts = new BxDolCmts('classifieds', 0, 0);
        $sQuery = "\r\n\t\t\tSELECT DISTINCT\r\n\t\t\t`ClassifiedsAdvertisements`.`ID`,\r\n\t\t\t`ClassifiedsAdvertisements`.`Subject`,\r\n\t\t\t`ClassifiedsAdvertisements`.`EntryUri`,\r\n\t\t\t`ClassifiedsAdvertisements`.`Media`,\r\n\t\t\t`Profiles`.`NickName`,\r\n\t\t\tUNIX_TIMESTAMP( `ClassifiedsAdvertisements`.`DateTime` ) as `DateTime_f`,\r\n\t\t\t`ClassifiedsAdvertisements`.`DateTime`,\r\n\t\t\t`Classifieds`.`Name`, `Classifieds`.`CEntryUri`, `Classifieds`.`ID` AS `CatID`,\r\n\t\t\t`ClassifiedsSubs`.`NameSub`, `ClassifiedsSubs`.`SEntryUri`, `ClassifiedsSubs`.`ID` AS `SubCatID`,\r\n\t\t\t`ClassifiedsAdvertisements`.`Message`,\r\n\t\t\tCOUNT(`tc`.`cmt_id`) AS 'CommCount'\r\n\t\t\tFROM `ClassifiedsAdvertisements`\r\n\t\t\tLEFT JOIN `ClassifiedsSubs`\r\n\t\t\tON `ClassifiedsSubs`.`ID`=`ClassifiedsAdvertisements`.`IDClassifiedsSubs`\r\n\t\t\tLEFT JOIN `Classifieds`\r\n\t\t\tON `Classifieds`.`ID`=`ClassifiedsSubs`.`IDClassified`\r\n\t\t\tLEFT JOIN `Profiles` ON `Profiles`.`ID`=`ClassifiedsAdvertisements`.`IDProfile`\r\n\t\t\tLEFT JOIN `" . $oCmts->getCommentsTableName() . "` AS `tc` ON `tc`.`cmt_object_id`=`ClassifiedsAdvertisements`.`ID`\r\n\t\t\tWHERE\r\n\t\t\t{$sProfileS}\r\n\t\t\tAND `ClassifiedsAdvertisements`.`Status` = 'active'\r\n\t\t\t{$sTimeAddon}\r\n\t\t\tGROUP BY `ClassifiedsAdvertisements`.`ID`\r\n\t\t\t{$sOrderS}\r\n\t\t\t{$sLimit}\r\n\t\t";
        $rBlogs = db_res($sQuery);
        if (!mysql_num_rows($rBlogs)) {
            return '';
        }
        $sBlocks = '';
        while ($aBlog = mysql_fetch_assoc($rBlogs)) {
            if ($sOrder == 'top' && $aBlog['CommCount'] == 0) {
                continue;
            }
            $sPic = $this->getImageCode($aBlog['Media'], TRUE);
            $sGenUrl = $this->genUrl($aBlog['ID'], $aBlog['EntryUri']);
            $sGenCUrl = $this->bUseFriendlyLinks && $this->bAdminMode == false ? $site['url'] . 'ads/cat/' . $aBlog['CEntryUri'] : "{$this->sCurrBrowsedFile}?bClassifiedID={$aBlog['CatID']}";
            $sGenSCUrl = $this->bUseFriendlyLinks && $this->bAdminMode == false ? $site['url'] . 'ads/subcat/' . $aBlog['SEntryUri'] : "{$this->sCurrBrowsedFile}?bSubClassifiedID={$aBlog['SubCatID']}";
            $sLinkMore = '';
            if (strlen($aBlog['Message']) > $iBlogLimitChars) {
                $sLinkMore = "... <a href=\"{$sGenUrl}\">" . _t('_Read more') . "</a>";
            }
            $sBlogSnippet = mb_substr(strip_tags($aBlog['Message']), 0, $iBlogLimitChars) . $sLinkMore;
            $sDataTimeFormatted = date($php_date_format, $aBlog['DateTime_f']);
            $sInCatFormatted = _t('_in Category', getTemplateIcon('ad_category.gif'), $sGenCUrl, process_line_output($aBlog['Name']));
            $sSubNameF = process_line_output($aBlog['NameSub']);
            $sCommentsF = _t('_comments N', getTemplateIcon('add_comment.gif'), $aBlog['CommCount']);
            $sSubjectF = process_line_output($arr['Subject']);
            $sBlocks .= <<<EOF
<div class="blog_block">
\t<div class="icon_block">
\t\t<div class="thumbnail_block" style="float:left;">
\t\t\t<a href="{$sGenUrl}" class="bottom_text">
\t\t\t\t{$sPic}
\t\t\t</a>
\t\t</div>
\t</div>
\t<div class="blog_wrapper_n">
\t\t<div class="blog_subject_n">
\t\t\t<a href="{$sGenUrl}" class="bottom_text">
\t\t\t\t{$sSubjectF}
\t\t\t</a>
\t\t</div>
\t\t<div class="blogInfo">
\t\t\t<span><img src="{$sClockIcon}" alt="" />{$sDataTimeFormatted} </span>
\t\t\t<span>{$sInCatFormatted} / <a href="{$sGenCUrl}">{$sSubNameF}</a></span>
\t\t\t<span>{$sCommentsF}</span>
\t\t</div>
\t\t<div class="blogSnippet">
\t\t\t{$sBlogSnippet}
\t\t</div>
\t</div>
</div>
<div class="clear_both"></div>
EOF;
        }
        return $sBlocks;
    }
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:79,代码来源:BxDolClassifieds.php

示例2: GenAnyBlockContent

    function GenAnyBlockContent($sOrder = 'last', $iProfileID = 0, $sLimit = "LIMIT 5")
    {
        global $site;
        global $short_date_format;
        $php_date_format = getParam('php_date_format');
        $iBlogLimitChars = (int) getParam("max_blog_preview");
        $sClockIcon = getTemplateIcon('clock.gif');
        $sOrderS = '';
        switch ($sOrder) {
            case 'last':
                $sOrderS = "ORDER BY `BlogPosts`.`PostDate` DESC";
                break;
            case 'latest':
                $sOrderS = "ORDER BY `BlogPosts`.`PostDate` DESC";
                break;
            case 'rand':
                $sOrderS = "ORDER BY RAND()";
                break;
            case 'top':
                $sOrderS = "ORDER BY `CommentsNum` DESC";
                break;
        }
        $sProfileS = $iProfileID > 0 ? "`BlogCategories`.`OwnerID`  = '{$iProfileID}'" : '1';
        $oCmts = new BxDolCmts('blogposts', 0, 0);
        $sQuery = "\n\t\t\tSELECT DISTINCT\n\t\t\t\t`BlogPosts`.`PostID`,\n\t\t\t\t`BlogPosts`.`CategoryID`,\n\t\t\t\t`BlogCategories`.`OwnerID`,\n\t\t\t\t`BlogPosts`.`PostText`,\n\t\t\t\tUNIX_TIMESTAMP( `BlogPosts`.`PostDate` ) AS `PostDate_f`,\n\t\t\t\t`BlogPosts`.`PostCaption`,\n\t\t\t\t`BlogPosts`.`PostUri`,\n\t\t\t\t`BlogCategories`.`CategoryName`,\n\t\t\t\t`BlogCategories`.`CategoryUri`,\n\t\t\t\t`Profiles`.`ID` AS `ProfID`,\n\t\t\t\t`Profiles`.`NickName` AS `NickName`,\n\t\t\t\tCOUNT( `tc`.`cmt_id` ) AS `CommentsNum`\n\t\t\tFROM `BlogCategories`\n\t\t\tLEFT JOIN `BlogPosts`\n\t\t\t\tON `BlogPosts`.`CategoryID` = `BlogCategories`.`CategoryID`\n\t\t\tINNER JOIN `Profiles`\n\t\t\t\tON `BlogCategories`.`OwnerID` = `Profiles`.`ID`\n\t\t\tLEFT JOIN `" . $oCmts->getCommentsTableName() . "` AS `tc` ON\n\t\t\t\t`BlogPosts`.`PostID` = `tc`.`cmt_object_id`\n\t\t\tWHERE\n\t\t\t\t{$sProfileS} AND\n\t\t\t\t`BlogPosts`.`PostReadPermission` = 'public' AND\n\t\t\t\t`BlogPosts`.`PostStatus` = 'approval'\n\t\t\tGROUP BY `BlogPosts`.`PostID`\n\t\t\t{$sOrderS}\n\t\t\t{$sLimit}\n\t\t";
        $rBlogs = db_res($sQuery);
        if (!mysql_num_rows($rBlogs)) {
            return '';
        }
        $sBlocks = '';
        while ($aBlog = mysql_fetch_assoc($rBlogs)) {
            $sLinkMore = '';
            $aUser = array('Permalink' => $aBlog['NickName'], 'Link' => $aBlog['OwnerID']);
            $aPost = array('Permalink' => $aBlog['PostUri'], 'Link' => $aBlog['PostID']);
            $aCat = array('Permalink' => $aBlog['CategoryUri'], 'Link' => $aBlog['CategoryID']);
            $sLinkMoreUrl = $this->genBlogLink('show_member_post', $aUser, '', $aPost);
            $sCatLink = $this->genBlogLink('show_member_blog', $aUser, $aCat);
            if (strlen($aBlog['PostText']) > $iBlogLimitChars) {
                $sLinkMore = "... <a href=\"" . $sLinkMoreUrl . "\">" . _t('_Read more') . "</a>";
            }
            $sBlogSnippet = mb_substr(strip_tags($aBlog['PostText']), 0, $iBlogLimitChars) . $sLinkMore;
            $sDataTimeFormatted = date($php_date_format, $aBlog['PostDate_f']);
            $sCategF = _t('_in Category', getTemplateIcon('folder_small.png'), $sCatLink, $aBlog['CategoryName']);
            $sCommF = _t('_comments N', getTemplateIcon('add_comment.gif'), $aBlog['CommentsNum']);
            $sProfileF = $iProfileID > 0 ? '' : '<span>' . _t('_By Author', $aBlog['NickName'], $aBlog['NickName']) . '</span>';
            $sBlocks .= <<<EOF
<div class="blogBlock">
\t<div class="blogHead">
\t\t<a href="{$sLinkMoreUrl}" class="bottom_text">
\t\t\t{$aBlog['PostCaption']}
\t\t</a>
\t</div>
\t<div class="blogInfo">
\t\t{$sProfileF}
\t\t<span><img src="{$sClockIcon}" alt="" />{$sDataTimeFormatted}</span>
\t\t<span>{$sCategF} </span>
\t\t<span>{$sCommF}</span>
\t</div>
\t<div class="blogSnippet">
\t\t{$sBlogSnippet}
\t</div>
</div>
<div class="clear_both"></div>
EOF;
        }
        return $sBlocks;
    }
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:67,代码来源:BxDolBlogs.php


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