作為多用戶blog系統(tǒng),plog具有強大的影響力,最近我也拿plog用了一下
順便記錄一下使用過程中要注意的問題
1.漢化
目前版本是1.0.1
Plog程序結(jié)構(gòu)非常好,不過也難以看懂和進行修改。
plog發(fā)行版本已經(jīng)申明不會出GB2312的版本,只有UTF-8
這個問題也困擾了我很久,老外怎么就喜歡用連中國人都不懂的編碼呢
不過要與國際接軌 還真得用utf-8
我不喜歡utf-8 所以我把它漢化為GB2312了
其實plog的漢化非常簡單 記事本就有這個功能
./locale/locale_zh_CN.php是中文語言包 使用utf-8編碼
把它打開 復(fù)制所有內(nèi)容到記事本中 然后另存為文件覆蓋locale_zh_CN.php
這時文件大小將由54K 減小到47K 這個文件就是Gb2312的語言包了
別慌 還有一個地方?jīng)]改
打開這個文件 找到$messages[‘encoding‘]一行 將"utf-8" 替換為gb2312就可以了
漢化完畢
2.配置二級域名
使用者都希望能讓申請blog的用戶擁有xx.xx.cn這樣的二級域名以代替原來又臭又長的一大串參數(shù)
1)首先要配置您自己的域名使它支持泛域名解析
所謂泛域名解析是DNS域名提供商提供的一種服務(wù),
您可以使用*.saysay.cn 都能解析到您所在的服務(wù)器IP地址
你可以通過自己配置DNS服務(wù)器或者向供應(yīng)商要求這種服務(wù) 一般是需要另外加費用的
2)登陸到plog后臺控制中心->常規(guī)設(shè)置->subdomains_enabled 這個選項 將他啟用
同時設(shè)置好您base_url地址和subdomains_base_url
以我為例:
base_url http://www.saysay.cn/blog
subdomains_base_url http://{username}.saysay.cn
這里的username是plog內(nèi)的一種變量 設(shè)置為username 就可以采用用戶名為二級域名
如果你設(shè)置為{blogid} 那么二級域名就是blogid的值
3)設(shè)置url
在URL設(shè)置里面選擇"自定義鏈接" 我不采用plog自帶的mod rewrite方式
我自己定義基本格式
我設(shè)置為
request_format_mode : /archive/{year}/{month}/{day}/{blogid}/{postid}.html$
category_link_format: /categories/{blogid}/{catid}$
archive_link_format : /archive/{blogid}/{year}{month}{day}
user_posts_link_format :/{blogname}/user/{username}$
post_trackbacks_link_format :/{blogname}/post/trackbacks/{postname}$
其他的我還沒來得及改 就拿這么多說明吧
以上格式顧名思義了
下面還要在apache的httpd.conf中配置mod rewrite
我不推薦plog自帶的.htaccess方式 那樣對服務(wù)器負擔比較大 不過虛擬主機支持的話
也只能用.htaccess方式
我以虛擬主機來說明
<VirtualHost 61.152.114.86>
DocumentRoot /usr/etc/wwwroot/www.saysay.cn/blog
ServerAdmin coolsky@saysay.cn
ServerName *.saysay.cn
ServerSignature email
DirectoryIndex summary.php index.php index.html index.htm default.php
RewriteEngine On
#RewriteMap blog txt:/usr/etc/wwwroot/www.saysay.cn/blog/blog_url.txt
#RewriteCond %{REQUEST_URI} ^/$
#RewriteCond %{HTTP_HOST} ^([^.]+).saysay.cn$ [NC]
#RewriteCond ${blog:%1} ^(.*)$ [NC]
#RewriteRule ^/(.*)$ %1/$1
RewriteRule ^/archive/[^.]+/[^.]+/[^.]+/([0-9]+)/([0-9]+)+\.html$ /index.php?op=ViewArticle&blogId=$1&articleId=$2
[L,NC]
# Category view (i.e. /plog/88_userfoo/categories/4_cat-foobar.html)
RewriteRule ^/categories/([0-9]+)/([0-9]+)$ /index.php?op=Default&blogId=$1&postCategoryId=$2 [L,NC]
RewriteRule ^/test.html$ /test.php[L,NC]
# Monthly archive (i.e. /plog/1_userfoo/archive/200401.html)
#RewriteRule ^/([0-9]+)_[^/]+/archive/([0-9]{6})\.html$ /index.php?blogId=$1&Date=$2 [L,NC]
# Daily and Month archive (i.e. /plog/1_blogfoo/archive/20040101.html)
RewriteRule ^/archive/([0-9]+)/([0-9]+)$ /index.php?blogId=$1&Date=$2 [L,NC]
#文章歸檔
RewriteRule ^/([0-9]+)/$ /index.php?op=Template&blogId=$1&show=archives [L,NC]
# Album (i.e. /plog/88_userfoo/albums/34_title-foo-bar.html)
RewriteRule ^/([0-9]+)_[^/]+/albums/([0-9]+)_[^.]+\.html$ /index.php?op=ViewAlbum&blogId=$1&albumId=$2 [L,NC]
# Albums (i.e. /plog/88_userfoo/albums/)
RewriteRule ^/([0-9]+)_[^/]+/albums/$ /index.php?op=ViewAlbum&blogId=$1&albumId=0 [L,NC]
# Category-Feeds (i.e. /plog/3_userfoo/feeds/categories/2_category/atom)
RewriteRule ^/([0-9]+)_[^/]+/feeds/categories/([0-9]+)_[^.]+/(.*)$ /rss.php?blogId=$1&categoryId=$2&profile=$3 [L,NC]
# Feeds (i.e. /plog/3_userfoo/feeds/atom)
RewriteRule ^/([0-9]+)_[^/]+/feeds/(.*)$ /rss.php?blogId=$1&profile=$2 [L,NC]
# Trackbacks (i.e. /plog/3_userfoo/trackbacks/34_title-foo-bar.html)
RewriteRule ^/([0-9]+)_[^/]+/trackbacks/([0-9]+)_[^.]+\.html$ /index.php?op=Trackbacks&blogId=$1&articleId=$2 [L,NC]
# Comment form (i.e. /plog/88_userfoo/comment/34_title-foo-bar.html)
RewriteRule ^/([0-9]+)_[^/]+/comment/([0-9]+)_[^.]+\.html$ /index.php?op=Comment&blogId=$1&articleId=$2 [L,NC]
# Resources (i.e. /plog/88_userfoo/resources/this-is-a-resource-name.pdf.html)
RewriteRule ^/([0-9]+)_[^/]+/resources/([^.]+)\.([^.]+)\.html$ /index.php?op=ViewResource&blogId=$1&resource=$2.$3
[L,NC]
# Download a resource (i.e. /plog/88_userfoo/get/this-is-a-resource-name.pdf)
RewriteRule ^/([0-9]+)_[^/]+/get/(.+)$ /resserver.php?blogId=$1&resource=$2 [L,NC]
# Static Pages (i.e /plog/3_userfoo/demosites)
RewriteRule ^/([0-9]+)_[^/]+/(.+)$ /index.php?op=Template&blogId=$1&show=$2 [NC]
# A non-default blog (i.e. /plog/88_userfoo)
RewriteRule ^/([0-9]+)_[^/]+$ /index.php?blogId=$1 [L,NC]
# Daly archive (i.e. /plog/1_userfoo/archive/20040101.html)
RewriteRule ^/([0-9]+)_[^/]+/archive/([0-9]{8})\.html$ /index.php?blogId=$1&Date=$2 [L,NC]
</VirtualHost>
上面代碼下面部分采用了plog的.htaccess文件中默認的,我只改了和修改url對應(yīng)的部分
以上配置好以后 我們只需要重啟apache 你就會發(fā)現(xiàn)
如果你申請了名字為coolsky的用戶 你就可以用coolsky.saysay.cn這個域名進行訪問了
如果你發(fā)的文章id是1 那么你文章的鏈接就會是"http://coolsky.saysay.cn/archive/2005/09/14/18/1.html" 的格式
其他類似
這樣還不行 如果你輸入www.saysay.cn他也會自動轉(zhuǎn)到這個地址上 不是我們的初衷
要保留www.saysay.cn,blog.saysay.cn的域名 我們還需要在apache配置一個虛擬主機
在上面的配置文件下面加上
<VirtualHost 61.152.114.86>
DocumentRoot /usr/etc/wwwroot/www.saysay.cn/
ServerAdmin coolsky@saysay.cn
ServerName www.saysay.cn
ServerSignature email
DirectoryIndex summary.php index.html index.htm default.php
</VirtualHost>
這樣我們可以用http://www.saysay.cn/blog/summary.php來訪問首頁
如何才能把summary.php設(shè)置為首頁呢,也就是說
但是當我輸入http://blog.saysay.cn的時候是轉(zhuǎn)向是index.php 而不是summary.php
雖然在上面的第一個虛擬主機配置中我們定義了DirectoryIndex summary.php 但是實際卻沒有起作用
解決方法: 其實我沒找到很好的方法
我在index.php中加入以下代碼進行轉(zhuǎn)向:
if($_SERVER[‘HTTP_HOST‘]=="blog.saysay.cn"){
header(‘location: http://www.saysay.cn/blog/‘);
}
4.其他備注
系統(tǒng)默認是要發(fā)郵件 確認后才開通的
修改成既時開通方法:
郵件設(shè)置->check_email_address_validity 和email_service_enabled 都改為否
另外如果要整合數(shù)據(jù)庫 可以通過外部提交到注冊頁面的第二步或第三步 并用post模擬原始提交post數(shù)據(jù).
[本日志最后由coolsky于2006-02-14 16:35編輯]
引用通告地址:
GB2312 http://saysay.cn/trackback.php?id=133&encode=gb2312
UTF-8 http://saysay.cn/trackback.php?id=133&encode=utf-8
Big5 http://saysay.cn/trackback.php?id=133&encode=big5