Example #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();
 }
Example #2
0
 function loadart()
 {
     if ($this->P['make'] != true && chkCache($this->P['cp'], $this->P['cn'])) {
         $this->H = getCache($this->P['cp'], $this->P['cn']);
     } else {
         $this->H = loadFile(MAC_ROOT_TEMPLATE . "/" . $this->T['t_tpl_art']);
         $this->C["sitetid"] = $this->D['a_type'];
         $this->C["siteid"] = $this->D['a_id'];
         $this->P['arttypeid'] = $this->T['t_id'];
         $this->P['arttypepid'] = $this->T['t_pid'];
         $this->P['similar'] = array('name' => $this->D['a_name'], 'tag' => $this->D['a_tag']);
         $GLOBALS['MAC_CACHE']['arttype'][$this->T['t_id']]['similar'] = 'no';
         if ($this->P['make'] == true) {
             if (strpos($this->H, 'similar=') > 0) {
                 $GLOBALS['MAC_CACHE']['arttype'][$this->T['t_id']]['similar'] = 'ok';
             }
         }
         $this->mark();
         $this->P['pageflag'] = 'art';
         $this->P['pagetype'] = 'detail';
         if ($this->P['make']) {
             return;
         }
         $this->H = str_replace("[art:page]", $this->P["pg"], $this->H);
         $arr = explode("[art:page]", $this->D["a_content"]);
         $arrlen = count($arr);
         if ($this->P['pg'] > $arrlen) {
             $this->P['pg'] = $arrlen;
         }
         $this->P['content'] = $arr[$this->P["pg"] - 1];
         $this->P['pagesize'] = 1;
         $this->P['datacount'] = $arrlen;
         $this->P['pagecount'] = $arrlen;
         $this->pageshow();
         unset($arr);
         $this->replaceArt();
         setCache($this->P['cp'], $this->P['cn'], $this->H);
     }
 }
Example #3
0
function diypage()
{
    global $template;
    $path = be("get", "path");
    $cacheName = "template_diypage_" . $path;
    if (chkCache($cacheName)) {
        $template->html = getCache($cacheName);
    } else {
        $path = root . path;
        $template->html = file_get_contents($path);
        $template->mark();
        setCache($cacheName, $template->html, 0);
        $template->run("vod");
    }
    echo $template->html;
}