真正的【将标题直接链接到外部链接】
功能:
将标题直接链接到外部链接,后台文章录入:直接添加转向网址即可,无须其他选择,不转向请留空。
网址为动态转向,记录点击数,外连和动态文章一样可以设置收费等。
改法:
第一步
假设dede_为表前缀,则在dede_archives 添加一字段
字段名:redirecturl
打开:view.php
找到:
CODE:$arc->Display();
$arc->Close();[Copy to clipboard]
前面加入:
CODE:$url = new Archives($aid);
$redirecturl = $url->ArcInfos['redirecturl'];
if ($redirecturl != "") {
$dsql = new DedeSql(false);
$dsql->SetQuery("Update dede_archives set click=click 1 where ID='$aid'");
$dsql->ExecuteNoneQuery();
header("Location:$redirecturl");
exit();
}
$url->Close();[Copy to clipboard]
打开:article_add.php
找到
CODE:<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="80">阅读权限:</td>
<td width="224"> <select name="arcrank" id="arcrank" style="width:150">
<?
$urank = $cuserLogin->getUserRank();
$dsql = new DedeSql(false);
$dsql->SetQuery("Select * from dede_arcrank where adminrank<='$urank'");
$dsql->Execute();
while($row = $dsql->GetObject())
{
echo " <option value='".$row->rank."'>".$row->membername."</option>
";
}
$dsql->Close();
?>
</select> </td>
<td width="63">发布选项:</td>
<td><input name="ishtml" type="radio" class="np" value="1" checked>
生成HTML
<input type="radio" name="ishtml" class="np" value="0">
仅动态浏览</td>
</tr>
</table>[Copy to clipboard]
后面加入:
CODE: <table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="80">转向网址:</td>
<td width="520"><input name="redirecturl" type="text" id="redirecturl" style="width:250px"></td>
</tr>