年年我发 立即注册PayPal并开始接受信用卡付款。
http://www.paypal.com



返回   年年我发 > 网站建设 > Web Directory
用户名
密码
 
注册账号 论坛帮助 会员列表 日历事件网赚工具 标记版面已读




回复
 
主题工具 搜索本主题 显示模式
  #1   IP: 59.60.149.106
旧 2008-04-23, 08:22 PM
car car 当前离线
高级会员
 
注册日期: 2006-05-14
帖子: 419
精华: 0
现金: 4415 元
资产: 4415 元
声望: 10 car 正向着好的方向发展
默认 Full Article Rewrite [phpld 3.3]

Mod Title: Full Article Rewrite

Last Updated: 19 Jan. 2008

Supported by Mod Developer: Yes

This mod upgrades the simplistic article rewrite from phpLD 3.3. After installing this mod your article URLs will turn from http://www.mydirectory.com/articles/article-239.html to http://www.mydirectory.com/articles/...itle-here.html
Important: backup all files before modifying them!

Open admin/article_edit.php
Find
if ($action == 'N')
{
$data['DATE_ADDED'] = gmdate ('Y-m-d H:i:s');
}
Replace with
if ($action == 'N')
{
$data['DATE_ADDED'] = gmdate ('Y-m-d H:i:s');
$data['TITLE_REWRITE'] = preg_replace ('`[^\w_-]+`', '-', $data['TITLE']);
}
Open submit_article.php
Find
$data['META_KEYWORDS'] = (!empty ($data['META_KEYWORDS']) ? clean_meta_keywords($data['META_KEYWORDS']) : '');
Replace with
$data['META_KEYWORDS'] = (!empty ($data['META_KEYWORDS']) ? clean_meta_keywords($data['META_KEYWORDS']) : '');
$data['TITLE_REWRITE'] = preg_replace ('`[^\w_-]+`', '-', $data['TITLE']);
Open include/tables.php
Find
$tables['article'] = array (
'name' => TABLE_PREFIX.'ARTICLE' ,
'fields' => array (
'ID' => 'I KEY AUTO' ,
'TITLE' => 'C(255) NOTNULL' ,
Replace with
$tables['article'] = array (
'name' => TABLE_PREFIX.'ARTICLE' ,
'fields' => array (
'ID' => 'I KEY AUTO' ,
'TITLE' => 'C(255) NOTNULL' ,
'TITLE_REWRITE' => 'C(255) NOTNULL' ,
Find
$tables['article_review'] = array (
'name' => TABLE_PREFIX.'ARTICLE_REVIEW' ,
'fields' => array (
'ID' => 'I KEY AUTO' ,
'TITLE' => 'C(255) NOTNULL' ,
Replace with
$tables['article_review'] = array (
'name' => TABLE_PREFIX.'ARTICLE_REVIEW' ,
'fields' => array (
'ID' => 'I KEY AUTO' ,
'TITLE' => 'C(255) NOTNULL' ,
'TITLE_REWRITE' => 'C(255) NOTNULL' ,
Open index.php
Find
//Article search
$search_preferences = array ();
$search_preferences['Select_Options'] = array ( '`ID`' ,
'`TITLE`' ,
Replace with
//Article search
$search_preferences = array ();
$search_preferences['Select_Options'] = array ( '`ID`' ,
'`TITLE`' ,
'`TITLE_REWRITE`' ,
Open .htaccess
Find
RewriteRule (.*)articles/article-(.*)\.htm[l]?$ article.php [QSA,NC]
Replace with
RewriteRule (.*)articles/(.*)\.htm[l]?$ article.php [QSA,NC]
Open article.php
Find (around line 158)
elseif (ENABLE_REWRITE == 1)
{
preg_match ('#(.*)article(_|-)(\d+)\.htm[l]?$#i', request_uri(), $matches);
$id = (!empty ($matches[3]) ? intval ($matches[3]) : 0);
}
Replace with
elseif (ENABLE_REWRITE == 1)
{
preg_match ('`articles/([\w_-]+)\.htm[l]?$`', request_uri(), $matches);
$rdata = $db->GetRow("SELECT `ID` FROM `{$tables['article']['name']}` WHERE `TITLE_REWRITE` = '$matches[1]'");
if (!$rdata)
{
$tpl->assign('error', "Invalid article title - not found in database");
$id = 0;
}
else
{
$id = $rdata['ID'];
}
}
Now you have to edit the template files that reference articles. The general rule is to replace anything that references
articles/article-{$article.ID}.html
with
articles/{$article.TITLE_REWRITE}.html
NOTE: $article is just a random name. It could appear as $val, $latest_search[i] etc depending on your template. You have to replace it keeping the same variable name (i.e. $val.TITLE_REWRITE, $latest_search[i].TITLE_REWRITE)

For example, for the Professional template (the default that comes with 3.3) you have to make the replacements in
templates/Professional/articlelink.tpl
templates/Professional/article_search.tpl
templates/Professional/rightside.tpl
Run these SQL queries from the phpLD admin System->Database page or from phpMyAdmin

ALTER TABLE `PLD_ARTICLE` ADD `TITLE_REWRITE` VARCHAR( 255 ) NOT NULL AFTER `TITLE`
ALTER TABLE `PLD_ARTICLE_REVIEW` ADD `TITLE_REWRITE` VARCHAR( 255 ) NOT NULL AFTER `TITLE`
UPDATE `PLD_ARTICLE` SET `TITLE_REWRITE`=CONCAT('article-', `ID`)
UPDATE `PLD_ARTICLE_REVIEW` SET `TITLE_REWRITE`=CONCAT('article-', `ID`)
回复时引用此帖

wellcome to www.0058.net
回复


当前查看此主题的会员: 1 (0 位会员和 1 位游客)
 
主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

论坛启用 BB 代码
论坛启用 表情符号
论坛启用 [IMG] 代码
论坛禁用 HTML 代码
论坛跳转

相似的主题
主题 主题作者 版面 回复 最后发表
Top List of Press Release Sites and Article Directories! yahoo 网站链接开发 0 2007-08-17 11:21 AM
SupSite/X-Space 启用Rewrite说明 car Discuz/SupeSite/X-Space 0 2007-02-23 11:58 AM
Article submission list topvip 网站链接开发 1 2006-03-23 01:00 AM


所有时间均为北京时间. 现在的时间是 12:53 PM, Free Patent & Patent Ideas


Powered by vBulletin 3.5.2 Chinese Exhibition Happy New Year
©2000 - 2008,Jelsoft Enterprises Ltd  Desiccant Molecular Sieve Weight Loss Bentonite Trade Manager