Example #1
0
 foreach ($row as $k => $v) {
     ${$k} = $v;
 }
 unset($row);
 $pubdate = strftime("%y-%m-%d", $pubdate);
 $title = ConvertStr($title);
 $keywords = ConvertStr($keywords);
 $description = ConvertStr($description);
 $yplj = ConvertStr($yplj);
 $dsql->Close();
 //判断文章分页开始
 $newBody = split("#p#(.*)#e#", $body);
 $newBodyLength = count($newBody);
 if ($newBodyLength > 1) {
     foreach ($newBody as $key => $val) {
         $pagination = articlePagination($i, $newBodyLength, $key + 1);
         $body = $newBody[$key] . $pagination;
         ob_start();
         include $cfg_templets_dir . "/mobile/article.htm";
         $pageBody = ob_get_contents();
         ob_end_clean();
         if ($key == 0) {
             $fp = @fopen('../m/article/' . $i . '.html', 'w') or die('读取失败,确定有写入权限?');
         } else {
             $fp = @fopen('../m/article/' . $i . '_' . ($key + 1) . '.html', 'w') or die('读取失败,确定有写入权限?');
         }
         fwrite($fp, $pageBody);
         fclose($fp);
         unset($pageBody);
     }
 } else {
            $pubdate = strftime("%y-%m-%d", $pubdate);
            if ($arcrank != 0) {
                exit;
            }
            $title = ConvertStr($title);
            $keywords = ConvertStr($keywords);
            $description = ConvertStr($description);
            if ($ishidden == 1) {
                exit('article is hiddening');
            }
            $dsql->Close();
            //文章分页开始
            $newBody = split("#p#(.*)#e#", $body);
            $newBodyLength = count($newBody);
            if ($newBodyLength > 1) {
                if (empty($pageno) || preg_match("#[^0-9]#", $pageno)) {
                    $pageno = 1;
                }
                $pagination = articlePagination($id, $newBodyLength, $pageno);
                $body = $newBody[$pageno - 1] . $pagination;
                include $cfg_templets_dir . "/mobile/article.htm";
                exit;
            } else {
                include $cfg_templets_dir . "/mobile/article.htm";
                exit;
            }
        } else {
            exit('error');
        }
    }
}