这段代码应用于“其名为湫”网址导航网站,我从昨天夜里开始构思,今天明确了思路开始测试,早上测试了半天,晚上又测试了6个多小时,一共调试了299次,终于成功了!先看一下效果页面,然后讲一下修改流程!

文章编辑增加字段.jpg

第一步:新建插件

打开主题模板的include.php,新建几个插件,将一下代码插入其中,可更换原有代码中的插件,将:

Add_Filter_Plugin('Filter_Plugin_Edit_Response','SiteNav_Url');

更换为:

Add_Filter_Plugin('Filter_Plugin_Edit_Response','SiteNav_name');
Add_Filter_Plugin('Filter_Plugin_Edit_Response','SiteNav_Url');
Add_Filter_Plugin('Filter_Plugin_Edit_Response','SiteNav_bewrite');
Add_Filter_Plugin('Filter_Plugin_Edit_Response','SiteNav_referrala'); 
Add_Filter_Plugin('Filter_Plugin_Edit_Response','SiteNav_referralb'); 
Add_Filter_Plugin('Filter_Plugin_Edit_Response','SiteNav_mailbox');
Add_Filter_Plugin('Filter_Plugin_Edit_Response','SiteNav_QQ');
Add_Filter_Plugin('Filter_Plugin_Edit_Response','SiteNav_time');
Add_Filter_Plugin('Filter_Plugin_Edit_Response','SiteNav_comment');
第二步:增加PHP函数


依然在主题模板include.php中,新建几个函数,可将原有函数:

function SiteNav_Url(){
    global $zbp,$article;
    if(!$article->Metas->alink){
		$article->Metas->alink= '';
	}
	echo '<br><br><label for="meta_alink" class="editinputname">网址</label> <input type="text" name="meta_alink" value="'.htmlspecialchars($article->Metas->alink).'" placeholder="请填写的您的外链网址,如 www.noteet.com ,不可写入http:// !" style="width:75%"> ';
}
换为:
//网站名称 name
function SiteNav_name(){
    global $zbp,$article;
    if(!$article->Metas->name){
		$article->Metas->name= '';
	}
	echo '<label for="meta_name" class="editinputname">名称</label> <input type="text" name="meta_name" value="'.htmlspecialchars($article->Metas->name).'" placeholder="请填写您的网站名称,如 深山的鹿博客" style="width:75%"> ';
}
//网站网址 Url
function SiteNav_Url(){
    global $zbp,$article;
    if(!$article->Metas->alink){
		$article->Metas->alink= '';
	}
	echo '<br><br><label for="meta_alink" class="editinputname">网址</label> <input type="text" name="meta_alink" value="'.htmlspecialchars($article->Metas->alink).'" placeholder="请填写的您的外链网址,如 www.noteet.com ,不可写入http:// !" style="width:75%"> ';
}
//网站描述 bewrite
function SiteNav_bewrite(){
    global $zbp,$article;
    if(!$article->Metas->bewrite){
		$article->Metas->bewrite= '';
	}
	echo '<br><br><label for="meta_alink" class="editinputname">描述</label> <input type="text" name="meta_bewrite" value="'.htmlspecialchars($article->Metas->bewrite).'"
" placeholder="请填写该网站的描述,description" style="width:75%" >';
}
//网站介绍--名称 referrala
function SiteNav_referrala(){
    global $zbp,$article;
    if(!$article->Metas->referrala){
		$article->Metas->referrala= '';
	}
	echo '<br><br><label for="meta_alink" class="editinputname">介绍--标题</label> <input type="text" name="meta_referrala" value="'.htmlspecialchars($article->Metas->referrala).'"
" placeholder="请填写该网站的介绍标题,Title(关于深山的鹿博客/机电之家我公司分站)" style="width:75%" >';
}
//网站介绍--链接 referralb
function SiteNav_referralb(){
    global $zbp,$article;
    if(!$article->Metas->referralb){
		$article->Metas->referralb= '';
	}
	echo '<br><br><label for="meta_alink" class="editinputname">介绍--链接</label> <input type="text" name="meta_referralb" value="'.htmlspecialchars($article->Metas->referralb).'"
" placeholder="请填写该介绍网址的链接,必须加上http:// !" style="width:75%" >';
}
//站长邮箱 mailbox
function SiteNav_mailbox(){
    global $zbp,$article;
    if(!$article->Metas->mailbox){
		$article->Metas->mailbox= '';
	}
	echo '<br><br><label for="meta_alink" class="editinputname">站长邮箱</label> <input type="text" name="meta_mailbox" value="'.htmlspecialchars($article->Metas->mailbox).'"
" placeholder="请填写该网站站长的邮箱" style="width:75%" >';
}
//站长 QQ QQ
function SiteNav_QQ(){
    global $zbp,$article;
    if(!$article->Metas->QQ){
		$article->Metas->QQ= '';
	}
	echo '<br><br><label for="meta_alink" class="editinputname">站长QQ</label> <input type="text" name="meta_QQ" value="'.htmlspecialchars($article->Metas->QQ).'"
" placeholder="请填写该网站站长的QQ号!" style="width:75%" >';
}
//收录时间 time
function SiteNav_time(){
    global $zbp,$article;
    if(!$article->Metas->time){
		$article->Metas->time= '';
	}
	echo '<br><br><label for="meta_alink" class="editinputname">收录时间</label> <input type="text" name="meta_time" value="'.htmlspecialchars($article->Metas->time).'"
" placeholder="请填写您需要设置的时间,如2016年11月27日 11:50:24" style="width:75%">';
}
//用户评论 comment
function SiteNav_comment(){
    global $zbp,$article;
    if(!$article->Metas->comment){
		$article->Metas->comment= '';
	}
	echo '<br><br><label for="meta_alink" class="editinputname">访客评论</label> <input type="text" name="meta_comment" value="'.htmlspecialchars($article->Metas->comment).'"
" placeholder="请填写网站访客对该网站的评论!" style="width:75%" >';
}

第三步:调用函数

我这里调用了所有函数,并更改了“点击直达”的链接方式,仅供参考!于2017-09-10 01:06:00重新编辑,增加了判断数据是否存在,存在即显示的功能。


				{$article.Content}
<div class="zebra" >
<table cellspacing="0" cellpadding="5"  align="center" interlaced="disabled">
    <tbody>
        <tr class="firstRow">
            <td width="200" valign="middle" style=" word-break: break-all;" align="center">
                网站名称
            </td>
            <td width="700" valign="top" style=" word-break: break-all;">
            	{$article.Metas.name}
            </td>
        </tr>
        <tr>
            <td width="200" valign="middle" style=" word-break: break-all;" align="center">
                网站域名
            </td>
            <td width="700" valign="top" style=" word-break: break-all;">
                {$article.Metas.alink}
            </td>
        </tr>
        <tr>
            <td width="200" valign="middle" style=" word-break: break-all;" align="center">
                网站描述</td>
            <td width="700" valign="top" style=" word-break: break-all;">
            	{$article.Metas.bewrite}
            </td>
        </tr>
        {if $article->Metas->referrala!=""}
        <tr>
            <td width="200" valign="middle" style=" word-break: break-all;" align="center">
                网站介绍</td>
            <td width="700" valign="top" style=" word-break: break-all;" class="tags">
                    <a href="{$article.Metas.referralb}" target="_blank"  title="{$article.Metas.referrala}">{$article.Metas.referrala}</a>
            </td>
        </tr>
        {/if}
        {if $article->Metas->mailbox!=""}
        <tr>
            <td width="200" valign="middle" style=" word-break: break-all;" align="center">
                站长邮箱
            </td>
            <td width="700" valign="top" style=" word-break: break-all;">
            {$article.Metas.mailbox} 
            </td>
        </tr>
        {/if}
        {if $article->Metas->QQ!=""}
        <tr>
            <td width="200" valign="middle" style=" word-break: break-all;" align="center">
                联系Q Q
            </td>
            <td width="700" valign="top" style=" word-break: break-all;">
				{$article.Metas.QQ}             
            </td>
        </tr>
        {/if}
        <tr>
            <td width="200" valign="middle" style=" word-break: break-all;" align="center">
                收录时间
            </td>
            <td width="700" valign="top" style=" word-break: break-all;">
                {$article.Metas.time}
            </td>
        </tr>
        {if !empty($tag)}
        <tr>
            <td width="200" valign="middle" style=" word-break: break-all;" align="center">
                Tag标签
            </td>
            <td width="700" valign="top" style=" word-break: break-all;" class="tags">
            {if !empty($tag)}{foreach $article.Tags as $tag}<a href="{$tag.Url}" target="_blank">{$tag.Name}</a>{/foreach}{/if}
            </td>
        </tr>
        {/if}
        {if $article->Metas->comment!=""}
        <tr>
            <td width="200" valign="middle" style=" word-break: break-all;" align="center">
                用户评论
            </td>
            <td width="700" valign="top" style=" word-break: break-all;">
                {$article.Metas.comment} 
            </td>
        </tr>
        {/if}
    </tbody>
</table>
</div>
<p>
</p>
{if $article->Metas->alink!=""}
<div class="zebrb" >
<table cellspacing="0" cellpadding="10"  align="center" interlaced="enabled" class="tags">
    <tbody>
        <tr class="ue-table-interlace-color-single firstRow">
            <td width="294" valign="middle" style=" word-break: break-all;background-color: #f5f5f5" align="center">
<a href="http://seo.chinaz.com/?host={$article.Metas.alink}" target="_blank"  title="{$article.Metas.name}站长之家SEO综合查询">站长之家综合查询</a>
            </td>
            <td width="294" valign="middle" style=" word-break: break-all;" align="center">
<a href="https://www.baidu.com/s?ie=utf8&wd=site%3A{$article.Metas.alink}" target="_blank"  title="百度Site一下{$article.Metas.name}">百度Site一下</a>
            </td>
            <td width="294" valign="middle" style=" word-break: break-all;background-color: #f5f5f5" align="center">
<a href="http://www.aizhan.com/cha/{$article.Metas.alink}" target="_blank"  title="{$article.Metas.name}爱站网SEO综合查询">爱站网综合查询</a>
            </td>
        </tr>
    </tbody>
</table>
</div>
<a href="http://{$article.Metas.alink} " target="_blank" class="ma ascbg">点击直达</a>