ecshopһܲϵͳںܶ˾ŻҲܺãΪ꣬ܶණǶ̬ģԣŻ˵ôãҵα̬дں̵̨Уѡдд
α̬ѾϿ˵ĻԸǰһƪ¶дģԼ
DZҪǣECSHOPڵһЩ룬ɴ̬ҳʹϵͳõŻ
ȶҳд̬ɡ
ECSHOPһܺõPHPԴ̳ϵͳԴƷϸĿϸҪÿƵҳ̬Ըõ¼Ҿ֪dedecmsһϵеķģ壬ȻֶȥƲƷͼڲƷбҳʱû̬ڿô̬ȽϺã̳DzƷҳ̬ʹ´롣
Php
if(file_exists($htmlfile) && (!$updatehtml)){
header("HTTP/1.1 301 Moved Permanently");
header("Location: {$htmlfile}");
}else{
$htmlcontent = $smarty->make_html("goods.dwt",$cache_id);
if(file_put_contents($htmlfile,$htmlcontent)){
header("HTTP/1.1 301 Moved Permanently");
header("Location: {$htmlfile}");
}
}
if(file_exists($htmlfile) && (!$updatehtml)){ header("HTTP/1.1 301 Moved Permanently"); header("Location: {$htmlfile}"); }else{ $htmlcontent = $smarty->make_html("goods.dwt",$cache_id); if(file_put_contents($htmlfile,$htmlcontent)){ header("HTTP/1.1 301 Moved Permanently"); header("Location: {$htmlfile}"); } }
301תǷܹ¼ĵַı䣬ʵǿԵģҿsiteһҵ̳Ǿ֪ʵ̬ҵҲԴsupersite,ԴϵͳҲǾ̬ת̬¼Ծģд
1.ҳУ$smarty->display('index.dwt', $cache_id);һ䣬˵ǰҳʾǰij´루οעͣ
$file = 'index.html';//̬ҳļ
$content = $smarty->make_html('index.dwt');//index.dwtģҳ
$filename = ROOT_PATH . $file;//̬ҳ·
file_put_contents($filename, $content);//ļ
echo $content;//ҳ
⼸if (!$smarty->is_cached('index.dwt', $cache_id))жԭежDzɾ̬ҳ棨һֱɵ до
//ж
//echo file_get_contents(ROOT_PATH . 'index.html');//̬ҳ
ϼ䣬ǾͿҳľ̬ҳͬǿɲƷͲƷľ̬ҳϵͳľ̬ˡ
ҳ̬ҳɺǽҪɵDzƷľ̬ҳ棬ҵ뷨ǰѲƷҳ汣ڸĿ¼£ȻȽң
DZȽʺŻΪһץȡʱֻץȡ㡣ѲƷڸĿ¼ֲƷҪԣ
ץȡһ棬ǿѲƷ¸Ŀ¼С
ƴ룺
$filename = build_uri('category', array('cid' => $catinfo['cat_id']));//·ѡԼϲĹ췽
$content = $GLOBALS['smarty']->make_html('category.dwt');//̬ҳ
$filename = ROOT_PATH . $filename;//ļ·ڸĿ¼
file_put_contents($filename, $content);//
Ʒľ̬ҳ룺
$goodinfo = get_all_goodsinfo($goods_id);
$cat_name = $goodinfo['cat_name'];
$goodsfile = build_uri('goods', array('gid' => $goods_id));
$content = $GLOBALS['smarty']->make_html('goods.dwt');
$html_tempdir = (ROOT_PATH.$cat_name.'/');
if (!is_dir($html_tempdir))//ɲƷĿ¼
{
mkdir($html_tempdir);
}
$htmlfilename = ROOT_PATH . $goodsfile;
file_put_contents($htmlfilename,$content);
ҵʹalias.html' target='_blank'>Ƽ»ߣ
function build_uri(........)
................
case 'category':
$cat_name = $GLOBALS['db']->getOne('SELECT cat_name FROM ' . $GLOBALS['ecs']->table('category') . " WHERE cat_id = '$cid'");
$uri = $cat_name . '-' . $cid;
if (!empty($page))
{
$uri .= '-' . $page;
}
........
case 'goods':
$goods_info = $GLOBALS['db']->getRow('SELECT g.goods_name, c.cat_name FROM ' . $GLOBALS['ecs']->table('goods') . " as g left join " .
$GLOBALS['ecs']->table('category') . " as c on c.cat_id = g.cat_id WHERE g.goods_id = '$gid'");
$goods_name = $goods_info['goods_name'];
$cat_name = $cat_name;
$uri = $cat_name . '/' . $goods_name . '-' . $gid ;
..........................
make_html : ڲ:
includes µ cls_template.php
function make_html($filename, $cache_id = '')
{
ob_start();
$this->display($filename,$cache_id);