初学者使用说明: |
赋予可读写权限 |
安装程序: /setup/setup.php |
管理员登录: /admin/admin_login.php |
一般的流程是 创建频道->创建栏目->添加文章->页面生成 |
其中,主页、频道、栏目以及文章是通过后台生成静态页面的。 |
在生成这些静态页面前要为首页,频道,栏目创建模板。 |
创建模板请在后台管理中创建。 |
模板使用说明: |
一、模板是生成静态页面的基础,也就是html代码。所不同的是在模板中有一系列的变量,在生成文章时就是替换了模板中的变量,就形成真正的页面。 |
二、模板中的变量主要分为两大类:一、系统变量;二、自定义标签 |
其中,系统变量主要有:{ $PageTitle },{ $Skin_CSS },{ $MenuJS },{ $InstallDir },{ $ShowPath },{ $ShowPage } {GetArticleList(aaa,bbb,)} {GetPicArticle(aaa,bbb)}等;自定义变量要在系统后台添加。在使用时只需要在模板中用{}将自定义变量名括起来。 |
三、系统变量的替换:在生成文件的时候会将模板中的系统变量替换成相应的内容。其中 |
{ $InstallDir }是系统的安装目录,在后台的管理中定义安装目录, |
{ $PageTitle }是页面的标题,会根据文章的名称来生成 |
{ $ShowPath }是显示当前的所在的网站的位置 |
{ $ShowPage }显示上一页,下一页,在文章列表时用 |
{GetArticleList(aaa,bbb,)} 取得文章列表,具体用法见文档。 |
{GetPicArticle(aaa,bbb)} 取得图片文章的列表,具体用法见文档。 |
四、自定义标签的使用方法 |
首先在系统后台的自定义标签模块定义一个标签,然后在模板中加入这个标签即可,需要注意,在模板中写标签时要用{}括起来。 |
五、模板中各个变量的替换规则 |
在生成页面时,首先替换系统标签,然后按照优先级,从高到低替换自定义标签。 |
六、注意事项 |
1、在管理后台中做栏目的模板时,需要注意,栏目的生成规则和首页、频道、内容页不一样。因为有的栏目还有字栏目,所以,我们在生成的时候,有子栏目的栏目页面既要显示其本栏目的文章列表还要显示一部分子栏目的文章列表;没有子栏目的话则显示本栏目的文章列表。因此,栏目的模板是两个。在添加栏目的模板时,要添加两个,而两个模板是放在一起的,中间用{$$$}来分割,上面部分的是有子栏目的时候使用的,下面部分是没有子栏目时使用的。可以具体看本网站的例子。 |
2、在生成栏目的时候注意还会用到【ArticleList_CurrentClass】【/ArticleList_CurrentClass】和【ArticleList_ChildClass】、【/ArticleList_ChildClass】 标记。其中【ArticleList_CurrentClass】【/ArticleList_CurrentClass】中间用来写GetArticleList和GetPicArticle标签来取得本栏目的文章列表。而【ArticleList_ChildClass】、【/ArticleList_ChildClass】 中间用来GetArticleList和GetPicArticle标签来取得其子栏目的文章列表 |
七、函数的使用方法 |
1、 function GetArticleList( $ChannelID , $ClassID , $ifchildclass , $specid , $start =0, $artcount , $ifhot , $ifelite , $input , $updatetime , $ordertype , $showli , $titlenum , $contentnum , $ifclassname , $artprop , $ifpic , $ifauthurname , $dataformat , $ifshowhits , $ifshowhots , $ifnewflag , $ifshowelite , $ifshowlink , $ifshowpage , $opentype , $pernum =1, $maxperpage =0) |
*函数说明: |
*ChannelID //频道ID eg:1 |
*ClassID //栏目ID eg:1 (0为所有栏目) |
*ifchildClass //是否显示子栏目 eg:True or False |
*specID //专题ID eg:专题ID为0显示所有 |
*start //起始的文章 |
*artcount //显示文章个数 eg:1 |
*ifhot //是否只显示hot eg:True or False 暂未实现 |
*ifelite //是否只显示elite eg:True or False 暂未实现 |
*input //录入者 |
*updatetime //显示更新时间日期 eg:0显示所有日期的 |
*ordertype //排序类型 eg:3按更新日期降序 |
*showtype //显示类型 eg:pic图片显示 暂未实现 |
*titlenum //title字数 eg:30 |
*contentnum //文章内容字数 eg:120 如果为0则不显示。 |
**ifclassname //是否显示栏目名称 暂未实现 |
*artprop //文章属性 eg:0,1 暂未实现 |
*ifpic //是否显示图文字样 eg:True or False 暂未实现 |
*ifauthurname //是否显示作者名字 eg:True or False 暂未实现 |
*dataformat //显示更新日期格式 eg:3 暂未实现 |
*ifshowhits //是否显示点击次数 eg:True or False 暂未实现 |
*ifshowhots //是否显示热点标记 暂未实现 |
*ifnewflag //是否显示最新标记暂未实现 |
*ifshowautime //是否显示作者日期 暂未实现 |
*ifshowlink //是否显示评论连接 1.显示评论,2。显示收藏,3。显示评论,收藏 暂未实现 |
*ifshowpage //是否分页显示 |
*opentype //打开模式 eg:0为原窗口,1为新窗口 暂未实现 |
*PerNum //每行显示最多文章数 选填 |
*MaxPerPage //每页显示最多文章数 选填 |
2、 function GetPicArticle( $ChannelID , $ClassID , $ifchildClass , $specID , $imageartcount , $ifhot , $ifelite , $updatetime , $ordertype , $showtype , $imgwidth , $imgheight , $titlenum , $start , $ifreadme , $columncount ) |
*函数说明: |
*ChannelID //频道ID eg:1 |
*ClassID //栏目ID eg:1 (0为所有栏目) |
*ifchildClass //是否显示子栏目 eg:True or False |
*specID //专题ID eg:专题ID为0显示所有 |
*imageartcount //显示文章个数 eg:1 |
*ifhot //是否只显示hot eg:True or False 暂未实现 |
*ifelite //是否只显示elite eg:True or False 暂未实现 |
*updatetime //显示更新时间日期 eg:0显示所有日期的 暂未实现 |
*ordertype //排序类型 eg:3按更新日期降序,默认是按照点击率 暂未实现 |
*showtype //显示类型 eg:1、只显示图片,2、上面图片,下面文字,3图片加title加文章内容 暂未实现 |
*imgwidth //图片宽度 eg:20 暂未实现 |
*imgheight //图片高度 eg:30 暂未实现 |
*titlenum //title字数 eg:30 |
*start //起始作品 eg:120 如果为0则不显示。 |
*ifreadme //是否显示提示信息 eg:True or False 暂未实现 |
*columncount //每列显示多少文章 eg:1 |
==================================================================================== |
<?php |
require_once ( 'showlist.php' ); |
require_once ( 'showhot_db.php' ); |
require_once ( 'pager.class.php' ); |
$Config = Config(); |
$InstallDir = $Config ->InstallDir; |
$SkinID = SkinCss(); |
$ChannelID = $_GET [ 'ChannelID' ]; |
$ChannelInfo = ChannelInfo( $ChannelID ); |
$ChannelDir = $ChannelInfo ->ChannelDir; |
$ChannelName = $ChannelInfo ->ChannelName; |
$HitsOfHot = $ChannelInfo ->HitsOfHot; |
$ModuleType = $ChannelInfo ->ModuleType; |
if ( $ModuleType ==1) |
{ |
$Table = "dm72_flash" ; |
$ArticleID = "FlashID" ; |
} |
if ( $ModuleType ==2) |
{ |
$Table = "dm72_cartoon" ; |
$ArticleID = "CartoonID" ; |
} |
if ( $ModuleType ==3) |
{ |
$Table = "dm72_joke" ; |
$ArticleID = "JokeID" ; |
} |
/*$Str = str_replace('{$Skin_CSS}',"<link href='Skin/Skin$SkinID.css' rel='stylesheet' type='text/css'>",$Str); |
$Str = str_replace('{$MenuJS}','',$Str); |
$Str = str_replace('{$PageTitle}',"$Config->SiteName---会员列表",$Str); |
$Str = str_replace('{$ShowPath}', "",$Str); |
$Str = str_replace('{$InstallDir}', $Config->InstallDir,$Str); |
$Str = str_replace('{InstallDir}', $Config->InstallDir,$Str); |
$Str = str_replace('{$SiteName}',$Config->SiteName,$Str); |
*/ |
?> |
<html> |
<head> |
<title>DM72 Flash 动画 漫画 动漫 小游戏 笑话 搞笑动画 >><?= $ChannelName ?>>>推荐作品 </title> |
<meta http-equiv= "Content-Type" content= "text/html; charset=utf-8" > |
<link href= 'skin/Skin1.css' rel= 'stylesheet' type= 'text/css' > |
</head> |
<body leftmargin=0 topmargin=0 > |
<div id=menuDiv style= 'Z-INDEX: 1000; VISIBILITY: hidden; WIDTH: 1px; POSITION: absolute; HEIGHT: 1px; BACKGROUND-COLOR: #9cc5f8' ></div> |
<table height=67 cellSpacing=0 cellPadding=0 width=760 align=center border=0> |
<tr> |
<td><A href= "/" ><IMG height=67 alt= "DM72欢迎您!" src= "images/logo.gif" width=223 border=0></A></td> |
<td width=537 background=images/tkmy_02.gif> |
<table height=8 cellSpacing=0 cellPadding=0 width= "100%" align=center border=0> |
<tr> |
<td></td> |
</tr> |
</table> |
<table height= "85%" cellSpacing=0 cellPadding=0 width= "100%" align=center border=0> |
<tr> |
<td width=35></td> |
<td width=110><A href= "flashgame/" target=_blank>游戏乐园</A></td> |
<td width=105><A href= "gxdh/" target=_blank?>搞笑动画</A></td> |
<td width=105><A href= "flashgsp/" target=_blank>FLASH故事片</A></td> |
<td width=105><A href= "xhpd/" target=_blank>笑话频道 </A></td> |
<td><A href= "http://bbs.dm72.com/" target=_blank>动漫社区</A></td> |
</tr> |
<tr> |
<td></td> |
<td><A href= "ngs/" target=_blank>男歌手 MTV</A></td> |
<td><A href= "flashngs/" target=_blank>女歌手 MTV</A></td> |
<td><A href= "dmjs/" target=_blank>动漫教室</A></td> |
<td><A href= "manhua/" target=_blank>漫画世界 </A></td> |
<td><A href= "jdzj/" target=_blank>经典专辑</A></td> |
</tr> |
</table> |
</td> |
</tr> |
</table> |
<table height=29 cellSpacing=0 cellPadding=0 width=760 align=center border=0> |
<tr> |
<td width=400 background=images/t0_01.gif> |
<table cellSpacing=0 cellPadding=0 width= "100%" border=0> |
<tr> |
<td height=2></td> |
</tr> |
<tr> |
<td height=25> |
<table cellSpacing=0 cellPadding=0 width= "100%" align=center border=0> |
<tr> |
<td><IFRAME id=UserLogin src= "dm72_login.php" frameBorder=0 width=400 scrolling=no height=25></IFRAME></td> |
</tr> |
</table> |
</td> |
</tr> |
<tr> |
<td height=2></td> |
</tr> |
</table> |
</td> |
<td width=360 background=images/t0_01.gif> |
<table cellSpacing=0 cellPadding=0 width= "100%" border=0 > |
<tr> |
<td height=2></td> |
</tr> |
<tr> |
<FORM name=search action=search.php method=GET> |
<td height=25> 搜索: |
<select name= "Type" > |
<option value= "1" selected>Flash</option> |
<option value= "2" >漫画</option> |
<option value= "3" >笑话</option> |
</select> |
<select name= 'Field' size= '1' > |
<option value= 'Title' selected>作品标题</option> |
<option value= 'Content' >作品内容</option> |
<option value= 'Author' >作品作者</option> |
<option value= 'Inputer' >录 入 者</option> |
</select> |
</td> |
<td height=25> |
<Input id=Keyword maxLength=50 size=10 value=关键字 name=Keyword onFocus= "this.select();" > |
<Input id=Submit type=submit value=·搜索· name=Submit> |
<Input id=Field type=hidden value=Title name=Field> </td></FORM> |
</tr> |
<tr> |
<td height=2></td> |
</tr> |
</table> |
</td> |
</tr> |
</table> |
<table width= "760" border= "0" align= "center" cellpadding= "0" cellspacing= "0" class = "top_Path" style= "word-break:break-all;Width:fixed" > |
<tr> |
<td width= "5%" align= "center" ><div align= "left" ><img src= "images/arrow3.gif" width= "8" height= "11" ></div></td> |
<td width= "73%" ><div align= 'left' >您现在的位置: <a href= '$Config->SiteUrl' ><?= $Config ->SiteName?></a> >> 热门作品</div></td> |
</tr> |
</table> |
<!--导航代码结束--> |
<!-- ********网页顶部代码结束******** --> |
<!-- ********网页中部代码开始******** --> |
<table width= "760" border= "0" align= "center" cellpadding= "0" cellspacing= "0" class = "center_tdbgall" > |
<tr> |
<!--网页中部左栏代码开始--> |
<td width= "180" rowspan= "6" align= "left" valign= "top" class = "left_tdbgall" > <table width= "100%" border= "0" cellspacing= "0" cellpadding= "0" style= "word-break:break-all;Width:fixed" > |
<tr> |
<td align= "center" class = "left_title" >专 题 栏 目</td> |
</tr> |
<tr> |
<td class = "left_tdbg1" ><script language= 'javascript' src= '<?php echo $ChannelDir ?>/JS/ShowSpecialList.js' ></script></td> |
</tr> |
<tr> |
<td class = "left_tdbg2" ></td> |
</tr> |
<tr> |
<td align= "center" class = "left_title" ><a class = "class" href= "showhot.php?ChannelID=<?=$ChannelID?>" >最 新 热 门</a></td> |
</tr> |
<tr> |
<td class = "left_tdbg1" ><script language= 'javascript' src= '<?php echo $ChannelDir ?>/JS/Article_Hot.js' ></script></td> |
</tr> |
<tr> |
<td class = "left_tdbg2" ></td> |
</tr> |
<tr> |
<td align= "center" class = "left_title" ><a class = "class" href= "showelite.php?ChannelID=<?=$ChannelID?>" >最 新 推 荐</a></td> |
</tr> |
<tr> |
<td class = "left_tdbg1" ><script language= 'javascript' src= '<?php echo $ChannelDir ?>/JS/Article_Elite.js' ></script></td> |
</tr> |
<tr> |
<td class = "left_tdbg2" ></td> |
</tr> |
</table> |
<!--网页中部左栏代码结束--> |
<!--网页中部左间隔代码开始--> |
<td width= "5" rowspan= "2" ></td> |
<!--网页中部左间隔代码结束--> |
<!--网页中部中栏代码开始--> |
<td width= "575" valign= "top" class = "main_tdbgall" > |
<table width= "100%" border= "0" cellspacing= "0" cellpadding= "0" Class= "main_title_575" style= "word-break:break-all;Width:fixed" > |
<tr> |
<td><b>推荐作品列表</b></td> |
</tr> |
</table> |
<table width= "100%" border= "0" cellspacing= "0" cellpadding= "0" Class= "main_tdbg_575" style= "word-break:break-all;Width:fixed" > |
<tr> |
<td height= "100" valign= "top" > |
|
<table width= '100%' cellpadding= '0' cellspacing= '0' > |
<?php |
|
|
if ( isset( $_GET [ 'page' ]) ) |
{ |
$page = (int) $_GET [ 'page' ]; |
} |
else |
{ |
$page = 1; |
} |
if ( isset( $_GET [ 'PageSize' ]) ) |
{ |
$PageSize = (int) $_GET [ 'PageSize' ]; |
} |
else |
{ |
$PageSize = 20; |
} |
$sql = "select * from $Table where ChannelID = $ChannelID and Passed = 1 and Deleted=0 and (Hot=1 or Hits > $HitsOfHot ) order by Hits desc " ; |
if (isset( $_GET [ 'Type' ])) |
{ |
//echo $_GET['Type']; |
$sql = $sql . " and Type =" . $_GET [ 'Type' ] ; |
} |
//echo $sql; |
$pager_option = array ( |
"sql" => $sql , |
"PageSize" => $PageSize , |
"CurrentPageID" => $page |
); |
if ( isset( $_GET [ 'numItems' ]) ) |
{ |
$pager_option [ 'numItems' ] = (int) $_GET [ 'numItems' ]; |
} |
$pager = @ new Pager( $pager_option ); |
$Myres = $pager ->getDataLink(); |
if ( $Myres ){ |
while ( $res = mysql_fetch_object( $Myres ) ) |
{ |
?> |
<tr> |
|
<td align= 'left' class = 'listbg' > |
|
<?php |
$ArticleInfo = ArticleLJ( $res ->FlashID, 'dm72_flash' ); |
echo str_replace ( '{$InstallDir}' , '' , $ArticleInfo ); |
?></td> |
</tr> |
<?php |
}} |
?> |
|
</table> |
|
|
</td> |
</tr> |
<tr> |
<td align= "center" valign= "top" > |
|
<?php |
//显示分页信息 |
if ( $pager ->isFirstPage ) |
{ |
$turnover = "首页|上一页|" ; |
} |
else |
{ |
$turnover = "<a href='?ChannelID=$ChannelID&page=1&numItems=" . $pager ->numItems. "&PageSize=" . $PageSize . "'>首页</a>|<a href='?ChannelID=$ChannelID&page=" . $pager ->PreviousPageID. "&numItems=" . $pager ->numItems. "&PageSize=" . $PageSize . "'>上一页</a>|" ; |
} |
if ( $pager ->isLastPage ) |
{ |
$turnover .= "下一页|尾页" ; |
} |
else |
{ |
$turnover .= "<a href='?ChannelID=$ChannelID&page=" . $pager ->NextPageID. "&numItems=" . $pager ->numItems. "&PageSize=" . $PageSize . "'>下一页</a>|<a href='?ChannelID=$ChannelID&page=" . $pager ->numPages. "&numItems=" . $pager ->numItems. "&PageSize=" . $PageSize . "'>尾页</a>" ; |
} |
echo '<table align=left><tr><td>共 <b>' . $pager ->numItems. '</b> 个文章' ; |
echo $turnover ; |
echo ' 页次:<strong><font color=red>' . $page . '</font>/' . $pager ->numPages. '</strong>页 ' ; |
echo '<input type=text index=\'1\' name=MaxPerPage size=3 maxlength=4 value=' . $PageSize . ' onChange="window.location=\'showhot.php?ChannelID=' . $ChannelID . '&page=1&PageSize=\'+this.value;">个/页 转到:' ; |
echo '<select name=page size=1 onchange="javascript:window.location=\'showhot.php?ChannelID=' . $ChannelID . '&PageSize=' . $PageSize . '&page=\'+this.options[this.selectedIndex].value;">' ; |
for ( $i =1; $i <= $pager ->numPages; $i ++){ |
echo '<option value=' . $i ; |
if ( $i == $page ){ |
echo ' selected ' ; |
} |
echo ' >第' . $i . '页</option>' ; |
} |
echo '</select>' ; |
echo "</td></tr></table>" ; |
?> |
</td> |
</tr> |
</table> |
<table width= "100%" border= "0" cellspacing= "0" cellpadding= "0" style= "word-break:break-all;Width:fixed" > |
<tr> |
<td Class= "main_shadow" ></td> |
</tr> |
<tr> |
<td Class= "main_title_575" ><b>热门作品</b></td> |
</tr> |
<tr> |
<td Class= "main_tdbg_575" > |
<table width= '100%' cellpadding= '0' cellspacing= '5' border= '0' align= 'center' > |
<tr valign= 'top' > |
<?php |
$result =mysql_query( "select * from $Table where ChannelID = $ChannelID and Passed = 1 and Deleted=0 and (Hot=1 or Hits > $HitsOfHot ) and (DefaultPicUrl is not null and DefaultPicUrl<>'') order by UpdateTime desc" ); |
$i =0; |
while ( $resul =mysql_fetch_object( $result )) |
{ $i = $i +1; |
?> |
<td align= 'center' > |
|
<?=GetPicArticleL( $resul ->FlashID, $Table ); ?> |
|
</td> |
<?php |
if ( $i >3) |
{ |
break ; |
} |
} |
?> |
|
</tr> |
</table> |
</td> |
</tr> |
<tr> |
<td Class= "main_shadow" ></td> |
</tr> |
</table> |
</td> |
<!--网页中部中栏代码结束--> |
<!--网页中部右间隔代码开始--> |
<td width= "1" rowspan= "2" ></td> |
<!--网页中部右间隔代码结束--> |
</tr> |
<tr> |
<td valign= "top" Class= "main_Search" ></td> |
</tr> |
</table> |
<table width= "760" border= "0" align= "center" cellpadding= "0" cellspacing= "0" class = "center_tdbgall" > |
<tr> |
<td Class= "main_shadow" ></td> |
</tr> |
</table> |
<table width=760 border=0 align=center cellPadding=0 cellSpacing=0 bgcolor= "#FFFFFF" > |
<tr> |
<td height=28 align=middle background= "skin/blue/main_title_575.gif" > |
<div align=center> |
<A href= "/" >关于dm72</A> | |
<A onclick= "this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.dm72.com');" href= "#" >设为首页</A>| |
<A href= "copyright.php" >服务条款 </A>| |
<A href= "http://bbs.dm72.com/" >动漫联盟</A> | |
<A href= "lxwm.htm" target=_blank>客服中心</A> | |
<A href= "lxwm.htm" target=_blank>合作推广</A> | |
<A href= "daohang.htm" >网站导航 </A>| |
<A href= "user_friendsite.php" target=_blank>友情连接</A> |
</div></td> |
</tr> |
<tr> |
<td align=middle height=25> |
<div align=center>Copyright © 2005 - 2006 <a href= "http://www.dm72.com" target= "_blank" ><font color= "#FF0000" >dm72</font></a> All Rights Reserved</div></td> |
</tr> |
<tr> |
<td align=middle height=25> |
<div align=center> <font color= "#FF0000" >动漫72</font> 版权所有</div></td> |
</tr> |
</table> |
</body> |
</html> |