Ejemplo n.º 1
0
function sys_eShowSp2($spid, $spr, $line, $strlen)
{
    global $empire, $dbtbpre, $public_r, $class_r, $emod_r;
    $sql = sys_ReturnTogQuery('sp', $spid, $line, '', '');
    if (!$sql) {
        return "";
    }
    //取得模板
    $tr = sys_ReturnBqTemp($spr['tempid']);
    if (empty($tr['tempid'])) {
        return "";
    }
    $listtemp = str_replace('[!--news.url--]', $public_r[newsurl], $tr[temptext]);
    $subnews = $tr[subnews];
    $listvar = str_replace('[!--news.url--]', $public_r[newsurl], $tr[listvar]);
    $rownum = $tr[rownum];
    $formatdate = $tr[showdate];
    $docode = $tr[docode];
    //替换模板变量
    $listtemp = ReplaceSpClassname($listtemp, $spid, $spr);
    if (empty($rownum)) {
        $rownum = 1;
    }
    //字段
    $ret_r = ReturnReplaceListF($tr[modid]);
    //列表
    $list_exp = "[!--empirenews.listtemp--]";
    $list_r = explode($list_exp, $listtemp);
    $listtext = $list_r[1];
    $no = 1;
    $changerow = 1;
    while ($r = $empire->fetch($sql)) {
        if (empty($class_r[$r[classid]][tbname])) {
            continue;
        }
        $infor = $empire->fetch1("select * from {$dbtbpre}ecms_" . $class_r[$r[classid]][tbname] . " where id='{$r['id']}'");
        if (empty($infor[checked])) {
            continue;
        }
        $infor[oldtitle] = $infor[title];
        //替换列表变量
        $repvar = ReplaceListVars($no, $listvar, $subnews, $strlen, $formatdate, $url, $have_class, $infor, $ret_r, $docode);
        $listtext = str_replace("<!--list.var" . $changerow . "-->", $repvar, $listtext);
        $changerow += 1;
        //超过行数
        if ($changerow > $rownum) {
            $changerow = 1;
            $string .= $listtext;
            $listtext = $list_r[1];
        }
        $no++;
    }
    //多余数据
    if ($changerow <= $rownum && $listtext != $list_r[1]) {
        $string .= $listtext;
    }
    $string = $list_r[0] . $string . $list_r[2];
    echo $string;
}
Ejemplo n.º 2
0
//取得列表模板
$list_exp = "[!--empirenews.listtemp--]";
$list_r = explode($list_exp, $listtemp);
$listtext = $list_r[1];
$no = $offset + 1;
$changerow = 1;
while ($r = $empire->fetch($sql)) {
    if (empty($class_r[$r[classid]][tbname])) {
        continue;
    }
    $infor = $empire->fetch1("select * from {$dbtbpre}ecms_" . $class_r[$r[classid]][tbname] . " where id='{$r['id']}' limit 1");
    if (empty($infor['id'])) {
        continue;
    }
    //替换列表变量
    $repvar = ReplaceListVars($no, $listvar, $subnews, $subtitle, $formatdate, $url, $have_class, $infor, $ret_r, $docode);
    $listtext = str_replace("<!--list.var" . $changerow . "-->", $repvar, $listtext);
    $changerow += 1;
    //超过行数
    if ($changerow > $rownum) {
        $changerow = 1;
        $string .= $listtext;
        $listtext = $list_r[1];
    }
    $no++;
}
//多余数据
if ($changerow <= $rownum && $listtext != $list_r[1]) {
    $string .= $listtext;
}
$string = $list_r[0] . $string . $list_r[2];
Ejemplo n.º 3
0
function ReUserjs($jsr, $addpath)
{
    global $empire, $public_r;
    DoFileMkDir($addpath . $jsr['jsfilename']);
    //建目录
    //取得js模板
    $jstemptext = GetTheJstemp($jsr[jstempid]);
    $ret_r = ReturnReplaceListF($jstemptext[modid]);
    //字段
    $jstemptext[temptext] = str_replace('[!--news.url--]', $public_r[newsurl], $jstemptext[temptext]);
    $temp_r = explode("[!--empirenews.listtemp--]", $jstemptext[temptext]);
    $query = stripSlashes($jsr[jssql]);
    $query = RepSqlTbpre($query);
    $sql = $empire->query($query);
    $no = 1;
    while ($r = $empire->fetch($sql)) {
        $r[oldtitle] = $r[title];
        //替换列表变量
        $repvar = ReplaceListVars($no, $temp_r[1], $jstemptext[subnews], $jstemptext[subtitle], $jstemptext[showdate], $url, 0, $r, $ret_r);
        $allnew .= $repvar;
        $no++;
    }
    $allnew = "document.write(\"" . addslashes(stripSlashes(str_replace("\r\n", "", $temp_r[0] . $allnew . $temp_r[2]))) . "\");";
    WriteFiletext_n($addpath . $jsr['jsfilename'], $allnew);
}