Example #1
0
$arrOutLink = array();
$arrOutLink[] = '<a href="http://' . $indexCache->baseUrl . '">' . $indexCache->key . '</a>';
//上层链接
$arrOutLink[] = '1';
$arrOutLink[] = '2';
$arrOutLink[] = '3';
$arrOutLink[] = '';
$outLink = implode('|', $arrOutLink);
$db->close();
//--------------------生成外链完毕--------------------------------------------
$randArticle = new randArticle($cfg->isMemcached);
$randArticle->SetKey($indexCache->key);
$randArticle->SetKeys($indexCache->keys);
$randArticle->SetStroyPath($cfg->storyPath);
$randArticle->SetOutLink($outLink);
$randArticle->InitFeature($indexCache->baseUrl . $viewID);
$randArticle->GenerateTitle();
$randArticle->GenerateBody();
//--------------------生成上下页--------------------------------------------
$dayAfterCreate = (int) ((time() - $createTime) / 86400) + 1;
$maxRandArticleId = $dayAfterCreate + 3;
$nextLink = '<p><a href="./read-' . ($viewID + 1) . '.html">下一篇</a></p>';
$lastLink = '<p><a href="./read-' . ($viewID - 1) . '.html">上一篇</a></p>';
if ($viewID >= $maxRandArticleId) {
    $nextLink = '';
}
if ($viewID <= 1) {
    $lastLink = '';
}
$randLink = '<p><a href="./read-' . rand(1, $maxRandArticleId) . '.html">推荐文章</a></p>';
$additionLinks = $lastLink . $nextLink . $randLink;
Example #2
0
    if ($baidu->isUp) {
        $sqlUpBaidu .= ',`baidu' . $v . "`='" . addslashes($baidu->GetSerializeCache()) . "' ";
    }
    $baidu = NULL;
    unset($baidu);
}
//--------------------更新随机文章-----------------------------------------
$dayAfterCreate = (int) ((time() - $indexContent->createTime) / 86400);
$arrRandArticleViewId = array($dayAfterCreate + 1, $dayAfterCreate + 2, $dayAfterCreate + 3);
$indexContent->CleanRandArticleArray();
foreach ($arrRandArticleViewId as $v) {
    $randArticle = new randArticle($cfg->isMemcached);
    $randArticle->SetKey($indexContent->key);
    $randArticle->SetKeys($indexContent->keys);
    $randArticle->SetStroyPath($cfg->storyPath);
    $randArticle->InitFeature($indexContent->baseUrl . $v);
    $randArticle->GenerateTitle();
    $randArticle->GenerateDescription();
    $indexContent->SetRandArticle($v, $randArticle->title, $randArticle->descriptions);
    $randArticle = NULL;
    unset($randArticle);
}
//--------------------更新TAG----------------------------------------------
$indexContent->UpDateTagKey($db);
//--------------------更新数据库-------------------------------------------
$sqlUpdate = 'UPDATE `' . $indexContent->dbPrefix . "cat` SET `index`='" . addslashes($indexContent->GetSerializeCache()) . "' ";
$sqlUpdate .= $sqlUpBaidu;
$sqlUpdate .= ' WHERE `cid`=' . $indexContent->cid;
$db->query($sqlUpdate);
$db->close();
$indexContent->Show($cfg->isMemcached, $memcached);