Пример #1
0
 function loadart($row, $typearr)
 {
     global $cache, $mac;
     //if (!is_array($this->page_typearr)){ $this->page_typearr = getValueByArray($cache[1], "t_id", $mac["arttypeid"]); }
     $this->page_typearr = $typearr;
     $mac["arttypepid"] = $this->page_typearr["t_pid"];
     $cacheName = "art_" . $mac["arttypeid"];
     $cachetemplatename = "template_art";
     $templatepath = root . "template/" . app_templatedir . "/" . app_htmldir . "/" . $this->page_typearr["t_arttemplate"];
     if (chkCache($cacheName)) {
         $this->html = getCache($cacheName);
     } else {
         $this->html = getFileByCache($cachetemplatename, $templatepath);
         setCache($cacheName, $this->html, 0);
     }
     $this->html = replaceStr($this->html, "[artinfo:page]", $mac["page"]);
     $this->page_type = "art";
     $contentarr = explode("[artinfo:page]", $row["a_content"]);
     if ($mac["page"] <= count($contentarr)) {
         $this->page_content = $contentarr[$mac["page"] - 1];
     }
     $this->page = $mac["page"];
     $this->page_id = $row["a_id"];
     $this->page_name = $row["a_title"];
     $this->page_enname = $row["a_entitle"];
     $this->page_size = 1;
     $this->data_count = count($contentarr);
     $this->page_count = count($contentarr);
     $this->pageshow();
     unset($contentarr);
     $slink = $this->getArtLink($row["a_id"], $row["a_title"], $row["a_entitle"], $this->page_typearr["t_id"], $this->page_typearr["t_name"], $this->page_typearr["t_enname"], true);
     $this->html = replaceStr($this->html, "[artinfo:hits]", "<span id=\"hit\">加载中</span><script>getHit('art','" . $row["a_id"] . "')</script>");
     $this->html = replaceStr($this->html, "[artinfo:fav]", "<a href=\"javascript:void(0)\" onclick=\"sitefav('http://" . app_siteurl . $slink . "','" . $row["a_title"] . "');return false;\"/>我要收藏</a>");
     $this->html = replaceStr($this->html, "[artinfo:share]", "<a href=\"javascript:void(0)\" onclick=\"copyData(document.title +'   ' + window.location.href);return false;\"/>我要分享</a>");
     if (indexOf($this->html, "[artinfo:textlink]")) {
         $typeLink = $this->getArtTypeLink($this->page_typearr["t_id"], $this->page_typearr["t_name"], $this->page_typearr["t_enname"], true);
         $this->html = replaceStr($this->html, "[artinfo:textlink]", $this->getTypeText($mac["arttypeid"], $this->page_typearr["t_pid"], $this->page_typearr["t_name"], $typeLink, "art") . "&nbsp;&nbsp;&raquo;&nbsp;&nbsp;<a href='" . $slink . "'>" . $row["a_title"] . "</a>");
     }
     if (indexOf($this->html, "[artinfo:prelink]")) {
         $this->html = replaceStr($this->html, "[artinfo:prelink]", $this->getArtPreNextLink($row["a_id"], 0));
     }
     if (indexOf($this->html, "[artinfo:nextlink]")) {
         $this->html = replaceStr($this->html, "[artinfo:nextlink]", $this->getArtPreNextLink($row["a_id"], 1));
     }
     $this->replaceComment(2, $row["a_id"]);
     $this->replaceMood(2, $row["a_id"]);
     $labelRule = buildregx("\\[artinfo:\\s*([0-9a-zA-Z]+)([\\s]*[len|style]*)[=]??([\\da-zA-Z\\-\\\\/\\:\\s]*)\\]", "");
     preg_match_all($labelRule, $this->html, $matches2);
     for ($j = 0; $j < count($matches2[0]); $j++) {
         $marktemp = $this->parse("art", $matches2[0][$j], $matches2[0][$j], $matches2[1][$j], $matches2[3][$j], $row, 0);
         $this->html = replaceStr($this->html, $matches2[0][$j], $marktemp);
     }
     unset($matches2);
     $this->mark();
     $this->ifEx();
     $this->run();
 }
Пример #2
0
function maketopicindex()
{
    global $flag, $db, $mac, $mac, $template;
    $t1 = root . "template/" . app_templatedir . "/" . app_htmldir . "/" . $flag . "topic.html";
    $template->html = getFileByCache("template_" . $flag . "topic", $t1);
    $tempLabelStr = $template->html;
    $psize = $template->getPageListSizeByCache($flag . "topicpage");
    if (isN($psize)) {
        $psize = 10;
    }
    $sql = "select t_id from {pre}" . $flag . "_topic";
    $nums = $db->getOne("select count(t_id) from {pre}" . $flag . "_topic");
    $pcount = ceil($nums / $psize);
    if ($nums == 0) {
        echo "<font color='red'>没有专题数据!</font><br>";
        $pcount = 1;
    }
    echo "正在开始生成专题首页...";
    for ($i = 1; $i <= $pcount; $i++) {
        $mac["page"] = $i;
        $template->html = $tempLabelStr;
        $template->topicpagelist();
        $template->mark();
        $template->ifEx();
        $template->run("other");
        $topicLink = $template->getPageLink($i);
        if (app_installdir != "/") {
            $topicLink = replaceStr($topicLink, app_installdir, "../");
        } else {
            $topicLink = ".." . $topicLink;
        }
        $path = dirname($topicLink);
        if (!file_exists($path)) {
            mkdir($path);
        }
        fwrite(fopen($topicLink, "wb"), $template->html);
        echo " 生成完毕 <a target='_blank' href='" . $topicLink . "'>&nbsp;&nbsp;<font color=red>浏览</font></a><br>";
    }
}
Пример #3
0
function makeTopicById($topicid)
{
    global $flag, $db, $mac, $cache, $template;
    if ($flag == "art") {
        $mac["arttopicid"] = $topicid;
        $typearr = getValueByArray($cache[3], "t_id", $topicid);
        $sql = "select  a_id from {pre}art where a_topic = " . $topicid . "";
        $sql1 = "select count(*) from {pre}art where a_topic = " . $topicid . "";
    } else {
        $mac["vodtopicid"] = $topicid;
        $typearr = getValueByArray($cache[2], "t_id", $topicid);
        $sql = "select  d_id from {pre}vod where d_topic = " . $topicid . "";
        $sql1 = "select  count(*) from {pre}vod where d_topic = " . $topicid . "";
    }
    $template->html = getFileByCache("template_" . $flag . "topiclist_" . $topicid, root . "template/" . app_templatedir . "/" . app_htmldir . "/" . $typearr["t_template"]);
    $psize = $template->getPageListSizeByCache($flag . "page");
    if (!isNum($psize)) {
        $psize = 10;
    }
    $nums = $db->getOne($sql1);
    $pcount = ceil($nums / $psize);
    if ($nums == 0) {
        echo "<font color='red'>ID为 " . $topicid . " 的专题没有数据</font><br>";
        $pcount = 1;
    }
    echo "正在开始生成专题<font color='red'>" . $typearr["t_name"] . "</font>的列表<br>";
    for ($i = 1; $i <= $pcount; $i++) {
        $mac["page"] = $i;
        $template->loadtopic($flag, $typearr);
        $topicLink = $template->getPageLink($i);
        if (app_installdir != "/") {
            $topicLink = replaceStr($topicLink, app_installdir, "../");
        } else {
            $topicLink = ".." . $topicLink;
        }
        $path = dirname($topicLink);
        mkdirs($path);
        fwrite(fopen($topicLink, "wb"), $template->html);
        echo $typearr["t_name"] . " 生成完毕 <a target='_blank' href='" . $topicLink . "'>" . $topicLink . "&nbsp;&nbsp;<font color=red>浏览</font></a><br>";
    }
}