一、关于模板的调用
默认使用的是:/templets/plus/guestbook.htm,所以也不需要重新修改什么PHP文件,指向新的路径回到我们新建的自己的模板文件。只要把做好的模板,替换/templets/plus/guestbook.htm,再加上,修改相对的路径为<?php echo $cfg_templeturl; ?>/jikong/imgcssjs/ 即可。
还有head.htm 和 footer.htm 的使用要用到以下的方法
打开"/include/common.func.php" 加入以下代码
function pasterTempletDiy($path)
{
require_once(DEDEINC."/arc.partview.class.php");
global $cfg_basedir,$cfg_templets_dir;
$tmpfile = $cfg_basedir.$cfg_templets_dir."/".$path;//模版文件的路径
$dtp = new PartView();
$dtp->SetTemplet($tmpfile);
$dtp->Display();
}
function pasterTempletDiy2($path)
{
require_once(DEDEINC."/arc.partview.class.php");
global $cfg_basedir,$cfg_templets_dir;
$tmpfile = $cfg_basedir.$cfg_templets_dir."/".$path;//模版文件的路径
$dtp = new PartView();
$dtp->SetTemplet($tmpfile);
$temstr = $dtp->GetResult();
return $temstr;
}
使用的方法:
<?php
pasterTempletDiy("default/head.htm");
?>
二、管理员cookies丢失?管理员明明登录了却不能管理?
发生这种情况那时我是在本地调试,然后又摆上服务器调试出现的问题。估计是缓存问题,我换了个浏览器就可以管理了。
三、下面是代码部分
css部分,直接加入到<head>
<style>
.lefttd {
border-left:1px solid #dedede;
border-right:1px solid #dedede;
}
.ltd {
border-left:1px solid #dedede;
border-right:1px solid #dedede;
border-top:1px solid #dedede;
border-bottom:1px dashed #dedede;
}
.msgtd {
line-height:180%;
border-right:1px solid #dedede;
padding:5px;
height:80px;
}
.timetd {
border-right:1px solid #dedede;
border-top:1px solid #dedede;
border-bottom:1px dashed #dedede;
padding-left:5px;
}
.bottomtd {
border-right:1px solid #dedede;
border-top:1px dashed #dedede;
padding-left:5px;
}
.writetable td {
padding: 5px;
}
.writetd {
background:url(img/wbg.gif);
}
.pagetable {
border:1px solid #dedede;
margin-bottom:8px;
background:#FBFEED;
}
.pagelistbox {
}
.pagelistbox span{
border:1px solid #dedede;
padding:2px;
margin-right:3px;
background:#E8F9BF;
}
.pagelistbox a {
border:1px solid #dedede;
padding:2px;
margin-right:3px;
background:#E8F9BF;
padding-left:5px;
padding-right:5px;
}
.rebox {
width:98%;
padding:3px;
border:1px solid #dedede;
}
.btn-2{
width:70px;
height:25px;
border:none;
background:url(../templets/default/images/btn-bg2.gif) left top no-repeat;
line-height:25px;
overflow:hidden;
color:#444;
margin-right:2px;
cursor:pointer;
}
.ipt-txt{
line-height:15px;
padding:4px 5px;
border-width:1px;
border-style:solid;
border-color:#666 #BBB #BBB #666;
font-size:12px;
margin-right:2px;
}
#liuyanbu{font: 12px Verdana,Arial,Tahoma;}
#liuyanbu table{
width: 100%;
border-top-width: 0px;
border-right-width: 0px;
border-bottom-width: 0px;
border-left-width: 0px;
border-spacing: 1px;
-webkit-margin-start: auto;
-webkit-margin-end: auto;
}
</style>
下面是代码
<div id="liuyanbu" style="width:724px;">
<?php
$ntt=0;
$bgcc = '#FBFEED';
?>
{dede:datalist}
<table width='100%' border='0' align="center" cellpadding='0' cellspacing='0' style="<?php echo (($ntt==0) ? "background:{$bgcc}" : 'background:#ffffff'); ?>">
<tr>
<td width='160' align="center" class='ltd'>
<img height='16' src='guestbook/images/time.gif' width='16' /> 时间: <?php echo MyDate('m-d H:i',$fields['dtime']); ?>
</td>
<td height="26" class='timetd'>主题:<?php echo $fields['title']; ?>
</td>
</tr>
<tr>
<td width='160' rowspan='2' align="center" class='lefttd'>
<table width='160' border='0' align="center" cellpadding='1' cellspacing='2'>
<tr>
<td height="20" style="text-align:center"> <b><?php echo $fields['uname']; ?></b></td>
</tr>
</table>
</td>
<td class='msgtd'><?php echo $fields['msg']; ?></td>
</tr>
<?php if($g_isadmin) { ?>
<tr>
<td height="26" class="bottomtd">
<a href='guestbook.php?action=admin&id=<?php echo $fields['id']; ?>'><img src='guestbook/images/quote.gif' border=0 height=16 width=16 />[回复/编辑]</a>
<a href='guestbook.php?action=admin&id=<?php echo $fields['id']; ?>&job=del'><img src='guestbook/images/del.gif' border=0 height=16 width=16 />[删除]</a>
</td>
</tr>
<?php } ?>
</table>
<?php if($ntt==0){$ntt=1;}else{ $ntt=0; } ?>
{/dede:datalist}
<table border='0' cellpadding='0' cellspacing='0' width='100%' align='center' class='pagetable'>
<tr>
<td align="center" height='28'> {dede:pagelist listsize='5'/} </td>
</tr>
</table>
<table width="724" border="0" cellspacing="" cellpadding="4" align="center" bgcolor="#dedede" class='writetable'>
<form method="post" action="guestbook.php" name="form1">
<input type='hidden' name='action' value='save' />
<tr>
<td colspan='4' class='writetd'> <b>发布留言:</b><a name='write'></a></td>
</tr>
<tr bgcolor="#ffffff">
<td width="10%" align="center" nowrap><font color="#FF0000">*</font>你的姓名:</td>
<td width="40%"><input type="text" maxlength="10" name="uname" size="30" value="<?php echo $g_name; ?>" class="ipt-txt"/></td>
<td width="10%" align="center" nowrap>验 证 码:</td>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="70"><input name="validate" type="text" id="vdcode2" class="ipt-txt" style="width:60px;text-transform: uppercase;" /></td>
<td><img src='../include/vdimgck.php'/></td>
</tr>
</table>
</td>
</tr>
<tr bgcolor="#ffffff">
<td width="10%" align="center" nowrap><font color="#FF0000">*</font>标题:</td>
<td width="40%" colspan="4"><input type="text" maxlength="150" style="width:420px;" name="title" size="30" class="ipt-txt"/></td>
</tr>
<tr bgcolor="#ffffff">
<td align="center" nowrap width="10%"><font color="#FF0000">*</font>留言内容:<br />
(1000字内) </td>
<td align="left" colspan="4" width="40%">
<textarea name="msg" cols="70" rows="5" class="textarea ipt-txt"></textarea>
</td>
</tr>
<tr bgcolor="#ffffff">
<td colspan="4" align="center" nowrap><input maxlength="1000" type="submit" name="Submit" value="提 交" class="btn-2" />
<input type="reset" name="Submit2" value="取 消" class="btn-2" /></td>
</tr>
</form>
</table>
<br />
</div>