AI摘要

本文介绍了如何在Sablog2.0模板中安装BackLinks。首先,在modules/article.php文件中添加BackLinks代码和密钥,然后在templates/default/normal.php文件中添加链接变量代码。完成后,需要在BackLinks后台激活广告位并验证网页配置。注意,Sablog采用UTF-8编码,建议使用DreamWave或EditPlus修改文件,避免使用记事本。
本文介绍了如何在

今天偶注册了BackLinks,在安装代码的时候遇到问题,由于Sablog采用模板方式,不能直接插入BackLinks的代码,必须换一种方法才行,经过本人研究测试后,得到如下方法,先共享给需要帮助的朋友。

什么是BackLinks?

打开modules\article.php 在倒数第二行添加下面代码,将密钥代码换成你的密钥,在BlackLink网站上获取代码的地方可以看到钥。

//BlackLink链接代码

// The following variable defines whether links are opened in a new window
// (1 = Yes, 0 = No)
$OpenInNewWindow = "1";

// ********************************************************************
// Please DO NOT modify anything below
// ********************************************************************

$BLKey = "密钥代码";

BLQueryString ="LinkUrl=".urlencode(((BLQueryString  = "LinkUrl=".urlencode(((_SERVER['HTTPS']=='on')?'https://':'http://').SERVER[HTTPHOST]._SERVER['HTTP_HOST']._SERVER['REQUEST_URI']);
$BLQueryString .= "&Key=" .urlencode($BLKey);
$BLQueryString .= "&OpenInNewWindow=" .urlencode($OpenInNewWindow);


if(intval(get_cfg_var('allow_url_fopen')) && function_exists('file')) {
    if(BLcontent=@file("http://www.backlinks.com/engine.php?".BLcontent = @file("http://www.backlinks.com/engine.php?".BLQueryString)) 
        BLcode=@join(,BLcode = @join('', BLcontent);
}
else {
    $BLcode = "It appears that your web host has disabled all functions for handling remote pages and as a result the BackLinks software will not function on your web page. Please contact your web host for more information.";
}

现在链接代码已经生成了,现在将链接变量代码输出来,打开templates\default\normal.php文件,在合适的地方添加下面代码就OK了。

<h2>赞助商链接<h2>
    <ul>
     $BLcode
    </ul>

代码修改好后,到BackLinks后台把广告位激活一下,点“My Link Pages”,看到网址后面红色字体是“Inactive”,表示还未激活,点一下“Validate Web Page”检测一下代码,看到最后“Congratulations! It appears that your web page is configured correctly! ”,就OK了,再看一下网址那里就显示的是绿色的“active”,表示已经激活,等着别人来买你的链接吧。

什么是BackLinks?

最后提一下,应该Sablog采用的是UTF-8网页编码,所以在修改文件的时候,建议使用DreamWave或者使用EditPlus修改,不能使用记事本打开修改,切记。。切记。。



最后修改:2009 年 08 月 16 日
点赞的人是最酷的