Archive for the '技术-blog工具' Category


Ucenter Home 1.5安装及单点登录集成方案

    整理一下安装Ucenter Home1.5版本及Discuz BBS的过程及与公司自己的门户社区整合过程中的注意事项作为备忘。

下面以在服务器192.168.1.202上安装配置说明一下整合过程。

    操作系统:Redhat AS 4

    Mysql : 5.0

   

1、下载UCenter、UCenter Home、Discuz! 集成安装包

    http://download.comsenz.com/UC_UCH_DZ/UC_UCH_DZ_SC_GBK.zip

2、下载ucenter home 1.5

    http://www.jz123.cn/soft/download.asp?softid=12538&downid=62&id=12427

    目前ucenter home 1.5版本为beta版本,官方尚未正式发布,由于功能相对全,因此采用此版本。

3、下载ucenter头像升级页面

    http://u.discuz.net/download/avatar.zip

4、数据库安装,以utf8创建数据库并创建sns的用户

    create database sns default character set utf8;

    grant all privilege on *.* to sns@’localhost’ identified by ’sns’;

    flush privileges;

5、apache及php安装配置

   使用Redhat AS 4自带的httpd及php,修改/etc/httpd/conf/httpd.conf

       port  80

        DocumentRoot "/var/www/html/sns"

6、安装UCenter、UCenter Home、Discuz! 集成安装包

    mkdir /var/www/html/sns

    unzip UC_UCH_DZ_SC_GBK.zip

    mv upload/* /var/www/html/sns/ 

7、访问http://192.168.1.202,开始安装过程

        UCenter的访问网址:

            http://192.168.1.202/ucenter

        DISCUZ!的访问网址:

            http://192.168.1.202/bbs

        管理员访问网址:
            http://192.168.1.202/bbs/admincp.php
        UCenter Home的访问网址:
            http://192.168.1.202/home
        管理员访问网址:
            http://192.168.1.202/home/admincp.php

8、将ucenter home从1.0版本升级ucenter home 1.5版本

     将UCenter_Home_1[1].5RC1_SC_GBK.rar中的upload目录下的文件upload/ 目录中,除 config.new.php 文件、install/ 目录以外的其他所有文件全部上传到home/目录下并覆盖当前程序,特别注意的是,最新数据库结构 ./data/install.sql 文件不要忘记上传将程序包UCenter_Home_1[1].5RC1_SC_GBK.rar update目录中的update.php文件上传到home/目录目录,并在浏览器运行。

    http://192.168.1.202/home/update.php

    升级成功完成安装后:

      删除home/update.php文件

      删除 home/data/tpl_cache目录中的所有模板缓存文件

      上传avatar.zip中的avatar.php到ucenter/下并覆盖原来的文件

9、为整合门户社区需要进行的修改问题汇总

9.1、ucenter home注册及登录页面校验逻辑修改

注释掉sns安装目录下home/source/function_common.php下的对formhash认证的函数,修改如下:

    //判断提交是否正确

function submitcheck($var) {

        if(!empty($_POST[$var]) && $_SERVER[’REQUEST_METHOD’] == ‘POST’) {

                if((empty($_SERVER[’HTTP_REFERER’]) || preg_replace("/https?:\/\/([^\:\/]+).*/i", "\\1", $_SERVER[’HTTP_REFERER’]) == preg_replace("/([^\:]+).*/", "\\1", $_SERVER[’HTTP_HOST’])) ) {

//删除  && $_POST[’formhash’] == formhash()

//              if((empty($_SERVER[’HTTP_REFERER’]) || preg_replace("/https?:\/\/([^\:\/]+).*/i", "\\1", $_SERVER[’HTTP_REFERER’]) == preg_replace("/([^\:]+).*/", "\\1", $_SERVER[’HTTP_HOST’])) && $_POST[’formhash’] == formhash()) {

                        return true;

                } else {

                        showmessage(’submit_invalid’);

                }

        } else {

                return false;

        }

}

9.2、门户集成ucenter home注册页面实例

一个典型的注册页面

<form id="registerform" name="registerform" action="do.php?ac=register&&ref" method="post" class="c_form">

<table>

  <tr><th>Username</th><td><input type="text" id="username" name="username" value="" /></td></tr>

  <tr><th>Pass</th><td><input type="password" name="password" id="password" value=""  /></td></tr>

  <tr><th>Pass2</th><td><input type="password" name="password2" id="password2" value=""  /></td></tr>

  <tr><th>mail</th><td><input type="text" id="email" name="email" value="@" /></td></tr>

  <tr><td><input type="submit" id="registersubmit" name="registersubmit" value="register" /></td></tr>

</table>

<input type="hidden" name="refer" value="space.php?do=home" />

</form>

注意上述提交按钮<input type="submit" id="registersubmit" name="registersubmit" value="register" />必须以此种形式提交,因为是ucenter程序验证了submit的name或id,在程序提交时候不要忘记了此参数。

9.3、注册码问题:

由于用户一般情况下并不需要登录UCHOME的注册页面,因此此处可以先注释掉注册码验证逻辑,只验证用户名称及密码。

注释方法,修改home/source/do_register.php,注释掉

/*

                if($_SCONFIG[’seccode_register’]) {

                        include_once(S_ROOT.’./source/function_cp.php’);

                        if(!ckseccode($_POST[’seccode’])) {

                              showmessage(’incorrect_code’);

                      }

                }

    */

9.4、注册时候需要验证邮箱的问题

由于我们目前注册时候并不需要用户输入邮箱(号码管家也不要求用户使用邮箱注册),而sns注册时候需要用于邮箱,而此部分代码在ucenter中控制,此部分代码加密了的,没有办法修改,目前为简单起见,如果用户在注册时候填写了邮箱,则在门户提交给sns的注册页面参数中以用户填入为准,如果没有,则以用户手机号+”@”+mobile-soft.cn为用户邮箱。

9.5、自动激活问题

UCHOME、BBS通过UCENTER整合到一起后,在UCHOME注册后,在使用BBS时候首先必须进行激活操作,这对于用户体验并不是很好。

因此注册时候,同时完成用户在BBS的激活操作。

 注册时候自动激活用户BBS帐号:

在手软门户登录注册时候同时在cdb_members、cdb_memberfields中插入相应的数据,其中在cdb_members中的password字段可以任意填写

INSERT INTO `cdb_members` VALUES (’21′, ‘liang6′, ‘liang6′, ”, ‘0′, ‘0′, ‘10′, ‘0′, ”, ‘192.168.1.7′, ‘1220466585′, ‘192.168.1.7′, ‘1220466638′, ‘1220466672′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘liangchuan@mobile-soft.cn’, ‘0000-00-00′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘0′, ‘1′, ‘1′, ‘1′, ‘0′, ‘9999′, ‘0′, ‘0′, ‘2′, ‘26′, ‘0′, ‘0′);

INSERT INTO `cdb_memberfields` VALUES (’21′, ”, ”, ”, ”, ”, ”, ”, ”, ”, ”, ”, ”, ‘0′, ‘0′, ”, ”, ”, ”, ”, ”, ‘0′, ‘0′);

以上插入记录的用户的id号可以从uc_members表中获得

9.6、门户集成ucenter home登录实例

<form id="loginform" name="loginform" action="do.php?ac=login&amp;&amp;ref" method="post" class="c_form">

<table class="formtable" cellpadding="0" cellspacing="0">

<tr><th width="100"><label for="username">Username</label></th><td><input name="username" id="username"  value="" type="text"></td></tr>

<tr><th><label for="password">Password</label></th><td><input name="password" id="password"  value="" type="password">

  </td></tr>

<tr><td><input id="loginsubmit" name="loginsubmit" value="Login" class="submit" tabindex="5" type="submit">

</td></tr>

</table>

<input name="refer" value="space.php?do=home" type="hidden">

</form>

9.7、bbs登录注册问题

由于bbs的注册通过sns的注册已经解决了,因此不需要单独的注册页面,开发时候把bbs的注册页面修改为手软门户的注册页面。

要实现在登录门户时候同时自动登录bbs相对简单,一个典型的登录表单:

    <form id="loginform" method="post" name="login" action="logging.php?action=login&amp;loginsubmit=true">

        <input name="username" value="" type="text"><br>

        <input id="password" name="password" type="password"><br>

        <button name="userlogin" type="submit" value="true">login</button>

</form>

 

Dreamhost Internal Server Error故障

  9-5号访问寄存在dreamhost的www.yeeach.com主机时候,访问所有应用页面(blog、pligg、bbs、下载)都报Internal Server Error,查看服务器日志发现大量的如下错误:

[Thu Sep 04 00:41:53 2008] [error] [client 220.181.32.23] Premature end of script headers: php.cgi
[Thu Sep 04 00:41:53 2008] [error] [client 220.181.32.23] php.cgi: error while loading shared libraries: libsablot.so.0: cannot open shared object file: No such file or directory

    看来是apache出了问题,与dreamhost客服联系后,发现不是我自己的问题,近期dreamhsot对debian操作系统进行了升级,从32-bit升级到64-bit,导致原来的32-bit的php动态库不能够再使用。

   按照dreamhost提供的参考网页:

http://www.dreamhoststatus.com/2008/09/02/debian-upgrades-and-custom-php/

http://wiki.dreamhost.com/Installing_PHP5#Compiling_a_Customized_PHP_5

    看见繁琐的升级过程,头就大,也没有时间仔细去琢磨。突然想起来,前段时间遇到的upload_max_filesize时候曾经使用的shell脚本,修改Dreamhost虚拟主机的php.ini的upload_max_filesize参数限制 ,在服务器上执行了一下两个脚本,问题解决了。呵呵,看来多记笔记很有好处。

1、mkdir ~/yeeach.com/cgi-bin/

2、touch ~/php-copy.sh 

#!/bin/sh
CGIFILE="$HOME/yeeach.com/cgi-bin/php.cgi"
INIFILE="$HOME/yeeach.com/cgi-bin/php.ini"
rsync -a /dh/cgi-system/php5.cgi "$CGIFILE"
# REMOVE THE FOLLOWING LINE TO CREATE THE UPDATE-ONLY SCRIPT:
cp /etc/php5/cgi/php.ini "$INIFILE"

perl -p -i -e ‘
s/.*post_max_size.*/post_max_size = 100M/;
s/.*upload_max_filesize.*/upload_max_filesize = 100M/;
‘ "$INIFILE"

3、chmod +x php-copy.sh

4、./php-copy.sh

5、touch ~/yeeach.com/.htaccess

Options +ExecCGIAddHandler php-cgi .phpAction php-cgi /cgi-bin/php.cgi

6、 php daily  update

cp php-copy.sh php-update.sh
#the php-update.sh content is :

#!/bin/sh

CGIFILE="$HOME/yeeach.com/cgi-bin/php.cgi"

INIFILE="$HOME/yeeach.com/cgi-bin/php.ini"

rsync -a /dh/cgi-system/php5.cgi "$CGIFILE"

perl -p -i -e ‘

s/.*post_max_size.*/post_max_size = 100M/;

s/.*upload_max_filesize.*/upload_max_filesize = 100M/;

‘ "$INIFILE"

7、crontab configure

crontab -e
#the crontab's content :
@weekly /home/myusername/php-update.sh

 

参考资料:

http://www.activecollab.com/forums/topic/1507/

http://wiki.dreamhost.com/index.php/PHP.ini .

FIREFOX / IE Word-Wrap:Word-Break问题

用的是wpzone.netfresh wordpress主题,很烦人的是在Internet Explorer下如果content或sidebar的内容部分一行的内容过长,则经常出现sidebar被挤到页面最下端的情况,而在firefox下没有此种现象。一般出现在如下几种情况:

  • 图片太大超过了width
  • url太长没有正常换行,超过了width
  • 代码太长没有正常换行,超过了width

究其原因是因为对于无空格连续长字符,IE与Firefox将它看成是一个长单词了,因此不会自动换行。

对于IE,可以通过IE专有的CSS属性word-wrap即可实现自动换行:word-wrap:break-word;

对于Firefox,CSS2标准并没有定义类似word-wrap的属性,可以通过overflow属性将撑出的部分隐藏:overflow:hidden

因此为了兼容性,可以使用如下方法:

word-wrap: break-word; /* fix for long text breaking sidebar float in IE */
overflow: hidden; /* fix for long non-text content breaking IE sidebar float */

修改fresh theme的style.css文件,在#content和#sidebar中增加上述属性以及pre属性

#content {
color:#000;
display:inline;
float:left;
font-size:14px;
line-height:1.5em;
text-align:left;
width:635px;
margin:13px 0 0 20px;
padding:0 0 20px 0px;
word-wrap: break-word; /* fix for long text breaking sidebar float in IE */
overflow: hidden; /* fix for long non-text content breaking IE sidebar float */
}

#sidebar {
display:inline;
background-color:#fff;
float:right;
font-size:12px;
width:230px;
line-height:1.4em;
padding:20px 20px;
margin:15px 20px 15px 0;
word-wrap: break-word; /* fix for long text breaking sidebar float in IE */
overflow: hidden; /* fix for long non-text content breaking IE sidebar float */
}
pre {
 white-space: pre-wrap;       /* css-3 */
 white-space: -moz-pre-wrap;  /* Mozilla, since 1999 */
 white-space: -pre-wrap;      /* Opera 4-6 */
 white-space: -o-pre-wrap;    /* Opera 7 */
 word-wrap: break-word;       /* Internet Explorer 5.5+ */
}

另外对于firefox和opera可以采用javascript方式来避免overflow:hidden的弊端,具体实现可以参考:

Script word-wrap to Firefox - updated version

参考文档:

http://users.tkk.fi/~tkarvine/pre-wrap-css3-mozilla-opera-ie.html

http://elmicoxcodes.blogspot.com/2007/06/script-word-wrap-to-firefox-updated.html

http://jiarry.bokee.com/5871385.html

http://bbs.blueidea.com/thread-2692909-1-1.html

http://www.positioniseverything.net/explorer/expandingboxbug.html

Technorati 标签:,,,,

pligg SEO支持

为了更好让pligg支持搜索引擎优化,按照SEO的基本原则进行如下一些处理

pligg版本:Pligg_Beta_9.8.2

1、meta keywords和descriptions的配置

Pligg缺省情况下以提交digg内容时候定义的keywords和summary作为页面的keywords和description内容。对于一些站点缺省的keyword或description的维护,可以直接修改tempaltes/meta.tpl,但这样很麻烦,可以通过“后台管理”提供的对lang.conf维护工具来实现keyworkds和descriptions缺省值进行动态维护和修改。

方法如下:

  • 在libs/lang.conf中增加如下内容:

//<SECTION>MISC</SECTION><ADDED>0.5</ADDED>
PLIGG_Meta_Description = “ENTER YOUR DESCRIPTION HERE”
//<SECTION>MISC</SECTION><ADDED>0.5</ADDED>
PLIGG_Meta_Keywords = “ENTER YOUR KEYWORD HERE”

  • 在templates/meta.tpl增加PLIGG_Meta_Description和PLIGG_Meta_Keywords
{* define your meta data here *}

{if $meta_description neq ""}
        <meta name=”description” content=”{$meta_description},{#PLIGG_Meta_Description#}” />
{else}
        <meta name=”description” content=”Yeeach.com” />
{/if}

{if $meta_keywords neq “”}
        <meta name=”keywords” content=”{$meta_keywords},{#PLIGG_Meta_Keywords#}” />
{else}
        <meta name=”keywords” content=”Yeeach.com” />
{/if}
        <meta name=”Language” content=”{#PLIGG_Visual_Meta_Language#}” />
        <meta name=”Robots” content=”All” />

{* the extra tabs are to make it lineup when viewing the source *}
 
  • 从“后台管理”->“设定配置”->“Modify Language”修改keyworkds和descriptions

2、URL搜索引擎友好

  • 从“后台管理”->“设定配置”->“Outgoing”将Outgoing links的值设定为id
  • 从“后台管理”->“设定配置”->“UrlMethod”将URL method将值设定为2
  • 从“后台管理”->“设定配置”->“FriendlyURLs”将Friendly URL’s for stories和Friendly URL’s for categories的值设定为false
  • cp htaccess.default .htaccess
  • 登录“后台管理”->“类别管理”,得到最下方自动生成的RewriteRule,拷贝到.htaccess,替代如下内容后面的内容##### You can find the below lines pre-made for you in the category management section of the admin panel
  • 如果新增了类别,需要重新到“后台管理”->“类别管理”得到新的RewriteRule,然后拷贝到.htaccess中。
  • 之所以将Friendly URL’s for stories和Friendly URL’s for categories的值设定为false,就是为了采用id号方式,避免中文编码urlencode后,mod_rewrite处理的问题。

http://forums.pligg.com/wiki-articles/8594-url-method.html

Dynamic vs Static urls

Dynamic urls contain variables and are typically seen on database driven sites like blogs and forums. A static url does not contain any variables and does not change. Static urls are easier for your users to read. They are also sometimes ranked higher by search engines.
Examples
Dynamic url: yoursite.com/pligg/story.php?title=storytitle
Static url: yoursite.com/pligg/news/yourstorytitle

Url Method options

There are three options on the Url Method page in the admin panel. Choose Url Method 2 to enable static urls.

  • Method 1 = dynamic urls (default)
  • Method 2 = static urls

.htaccess

If you enable Url Method 2 in the admin panel you should see static urls on your site but when you click on an internal link you’ll probably get a 404 this page can not be found error. In order to work properly Url Method 2 requires modifications to your .htaccess file so that so that the new friendly urls are properly mapped to the actual files they refer to.
There is a default .htaccess file included in your Pligg installation called htaccess.default that contains a long list of rewrite commands that are meant to get you started. But you will probably need to modify this file in order to get static urls working properly on your site.

Step by Step Instructions
  1. Check with your host to see if mod rewrite is allowed. If not buy a DreamHost package to help pligg dev.
  2. Check with your host that Apache is configured to use .htaccess files (AllowOverride All)
  3. Get the latest htaccess.default from the SVN on sourceforge.
  4. Go to your admin panel/category management. At the bottom there is a rewrite rule for the categories. Copy this whole line and in htaccess.default paste over You need to copy the line for this whole thing to work right. Paste over the line: RewriteRule ^(all|pligg|category1|category2)/([a-zA-Z0-9-]+)/?$ story.php?title=$2 [L]
  5. Upload htaccess.default to your webserver in the root directory of your install. Overwrite the existing one.
  6. Rename “htaccess.default” to “.htaccess” (no quotes). Note the period in front. That period denotes a hidden file, and may cause it to disappear from some FTP clients. (You might need to enable showing of hidden files or call it by name when downloading).
  7. Turn on URL Method 2 in the admin panel.
  8. Enjoy friendly URL’s

If your Pligg is installed in a subfolder

If Pligg is installed in a subfolder: (ie : yourdomain.com/pligg/) then you will need to modify the RewriteBase in .htaccess:
Change RewriteBase / to RewriteBase /pligg/

Rewrite rule for categories

Every time you add a new category to your site you need to update the mod rewrite rules for the category urls. Simply go back to the admin panel / category management page copy the new rewrite rule and paste it on top of the old one in your .htaccess file.

It’s not working. How do i go back?

If this doesn’t work, mod_rewrite probably isn’t enabled on your webserver. You can go back to the admin panel and set Url Method to 1 again. No harm was done to any files during the instructions above and your site should operate fine without friendly urls.

3、广告

http://www.maranan.us/archives/pligg-ad-placement-tutorial/

http://www.maranan.us/archives/pligg-adsense-tutorial-yget-template/

http://www.maranan.us/archives/putting-adsense-in-your-pligg-sites/

 

 

参考资料

Technorati 标签: , , ,

pligg 集成wysiwyg 编辑器tinymce

由于在自己的个人站点上用pligg来作为网摘工具,因此希望在摘录时候能够直接能够把内容及格式保留下来,而不是单纯的文字介绍,因此用tinymce(用空再试fckeditor)来替代pligg本身的textarea,记录一下集成过程:

1、下载tinymce

http://tinymce.moxiecode.com/download.php

2、上传安装tinymce安装包

上传tinymce到服务器pligg安装目录的3rdparty下并解压

tar zxvf tinymce_2_1_2.tgz

cp -r tinymce/jscripts/tiny_mce/ .

3、启用pligg的html标识支持

在pligg的“后台管理”->“设定配置”->”Submit”中设定“HTML tags to allow”的值为如下内容:

<br><font><img><p><a><strong><ul><li><ol><u><em><span><pre><h1><h2><h3><hr><embed>

4、确认pligg采用的模板文件

查看一下templates/templates.tpl,确认使用的模板为yget

<a href = “{$my_pligg_base}/settemplate.php?template=yget“>yget</a><br/>

5、修改pligg的模板文件pligg.tpl

修改pligg的模板文件templates/yget/pligg.tpl,在 {checkForJs} 后添加如下的内容

{if $pagename eq “submit” || $pagename eq “editlink”}
  <script language=“javascript” type=“text/javascript” src=“{$my_pligg_base}/3rdparty/tiny_mce/tiny_mce.js”></
script>
{/if}

6、修改pligg的模板文件submit_step_2.tpl和comment_form.tpl和editlink_edit_center.tpl

修改pligg的模板文件templates/yget/submit_step_2.tpl,templates/yget/editlink_edit_center.tpl,在以上几个文件头的 {config_load file="/libs/lang.conf"} 后添加如下的内容
{literal}
    <script language=“javascript” type=“text/javascript”>
        tinyMCE.init({
            mode : “exact”,
            elements : “bodytext,summarytext”,
            theme : “advanced”,
            plugins : “advimage,advlink,emotions,iespell,insertdatetime,preview,media,visualchars,xhtmlxtras”,
            theme_advanced_buttons1 : “bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,|,insertdate,inserttime,|,forecolor,backcolor,|,hr,removeformat,formatselect”,
            theme_advanced_buttons2 : “link,unlink,image,media,|,undo,redo,cleanup,|,code,preview”,
            theme_advanced_buttons3 : “”,
            theme_advanced_toolbar_location : “top”,
            theme_advanced_toolbar_align : “left”,
            theme_advanced_path_location : “bottom”,
            height:“350px”,
            width:“550px”,
            extended_valid_elements : “a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]”,
            browsers : “msie,gecko,opera,safari”
        });
    </script>
{/literal}

主要注意的几个参数:

  • width及height元素:要修改tinyMCE wysiwyg的输入框大小,可以修改height和width值。
  • elements元素: elements : “bodytext,summarytext” 是指对<textarea name=”bodytext”..>和<textarea name=”summarytext” ..>这样的元素起作用;

tinymce的一些参数说明:

  • mode: textareas/specific_textareas/exact

textareas: 替换当前页的所有textarea为编辑器

specific_textareas: 不是很明白(特定的textarea??),要配合 textarea_trigger使用

exact: 替换指定ID的div或者textarea为编辑器,要配合elements使用。

  • theme: advanced/simple
    advanced: 高级模式,功能比较多一点。(默认)
    simple: 基本模式,只有基本的功能。
  • plugins: advhr/advimage/advlink/contextmenu/emotions/flash/autosave/style/layer/iespell/insertdatetime/paste/preview/print/save/noneditable/spellchecker/searchreplace/table/zoom/directionality/fullscreen/fullpage/inlinepopups/fullpage
    这些是自带的一些插件,看名字基本上都能明白它的功能。在网站上还有一些其它功能的插件,可以自己去下,放在插件目录下就可以了。
    (”-”加上可以让MCE不试图从插件目录加载这个插件,如plugins : “table,contextmenu,paste,-externalplugin”)
  • language: en/zh_cn/zh_cn_utf8……
    设置使用的语言,网站上也有的下,需要注意的是中文简体和繁体都有两种uft8的,要确定你使用的页面的编码。
    (eg:language : “en”)
  • width:
    height:
    设置编辑器的宽度和高度

具体可以参看http://wiki.moxiecode.com/index.php/TinyMCE:Index

7、参考资料:

http://forums.pligg.com/pligg-mods/5124-mod-tinymce-editor-story-submission-step-2-a.html

http://forums.pligg.com/pligg-mods/853-wysiwyg-editor.html

Technorati 标签:,,,

Pligg安装过程记录

打算使用pligg用于自己日常的网摘使用,以统一网摘内容,避免零散在各个网摘站点上。

这此记录一下自己在基于dreamhost虚拟主机环境下配置pligg的安装过程。

环境说明:

dreamhost虚拟主机环境、linux系统、mysql数据库

wordpress作为缺省主页程序,安装路径为yeeach.com,将pligg的程序安装到wordpress目录下,pligg的安装路径为yeeach.com/digg

1、安装pligg

直接用了dreamhost提供的One-Click Installs的pligg安装包(9.8版本),安装完成后

chmod 644 digg/libs/dbconnect.php
rm -rf digg/install

2、在wordpress中新增page作为导航,并将新增页面的点击操作重定向到pligg

假设pligg路径为http://www.yeeach.com/yeeach-digg

在.htaccess中配置RewriteRule,只在RewriteBase /后增加

RewriteRule yeeach-digg /digg [L]

.htaccess完整的内容如下:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule yeeach-digg /digg [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

3、备份digg库并修改字符集

由于dreamhost的mysql缺省字符集为latin1,需要修改为utf8.

登录phpmyadmin或直接用mysqldump导出digg库为sql文件,手工将DEFAULT CHARSET从latin1替换为utf8

4、删除digg库的库表(虚拟主机用户没有权限直接drop库,只能删除表),导入替换字符集后的sql

5、确认digg表的字符集为utf8_general_ci

6、以god/12345登录pligg,修改口令

7、下载中文语言包

关于Pligg 9.8中文乱码解决方案(Chinese gibberish on Pligg 9.8 solutions)下载libs.zip包,解压后上传到libs/下

8、到“后台管理”的“修改语言”,按照自己需要调整术语说法

9、到“后台管理”的“设定配置”处修改“Searching”为2 = uses MySQL LIKE and is much slower, but returns better results. Also supports “*” and “-”

10、关于前后台界面汉化

前台界面汉化:采用pligg站点上下载的lang.conf已经汉化了前台,需要用pligg下载的汉化包覆盖libs/lang.conf;

后台界面汉化:后台管理界面的汉化需要修改数据库。可以从http://bpdig.com/forum/viewtopic.php?t=73下载后台汉化包,建议不要汉化,汉化很不好用,如要修改,修改前备份数据库后,出错后好回滚。

 

参考资料:

http://blog.bpdig.com/?cat=1
http://forums.pligg.com/pligg-mods/8892-pligg-9-8-chinese-gibberish-pligg-9-8-solutions.html

 

 

Technorati 标签: , ,

如何添加 WordPress 2.3 标签到你使用的主题

http://richgilchrest.com/how-to-add-wordpress-23-tags-to-your-current-theme/

http://richgilchrest.com/how-to-add-wordpress-23-tags-to-your-current-theme-part-2/

http://wordpresschina.org/how-to-add-wordpress-23-tags-to-your-current-theme-9/

WordPress 2.3 应当于 9月 24日发布。很多博客已经想要尽快升级,因为新版本增加了一个非常有利于搜索引擎优化的工具:标签。虽然其它插件来支持标签,显然很多博客并不去用。我知道我就不用。【译者注:我也没用。】

Ultimate Tag Warrior 是目前为止最好的标签插件。我在家里的计算机上安装测试过。不幸的是,这个插件文件在一个压缩包内,看起来就不容易安装,因此很多人都不使用。UTW 也很难配置,有很多选项并没有解释清楚。这个插件有几十个选项要填写,不经过测试你根本不知道效果是什么样,因此我要选择一个标签,就花费了不止一个小时的时间。

WordPress 2.3 改变了这一切。有了内置的插件支持和插件云功能,再也不需要难以配置的插件。WordPress 提供两个简单的接口函数来供任何主题调用。经过这次升级,标签将很快传遍全世界。

不幸的是,这意味着如果你要在你的主题里使用这个功能,必须要进行更新。如果你通过 WordPress 主题站下载的主题,基本没有办法知道你使用的主题的作者是否曾升级。毕竟,到现在很多还有很多主题都不支持 Widget 呢,那可是很容易实现,也是对很多 WordPress 博客用户来说都是必须的功能。【译者注:潜台词,更何况刚刚加入的标签,不知道何年何月才能支持。】

如果你付费平直一个主题,那么在你的主题设计者对你的主题升级之前,你还要等多久呢?要花费你多少钱呢?你的主题设计者还在做这行的生意么?

幸运的是,你可以自己更新你的主题

也不是什么难事。在你进行任何改变之前,我建议你复制一份你使用的主题文件。如果升级中出现任何错误,你无法找到错误的话,你可以删除主题,用你备份的文件来替代。只要备份 WordPress\WP-CONTENT\Theme\themename 目录即可。

【译者注:这里有个错误,目录位置应为 wordpress\wp-content\themes\themename 。另外,本文介绍的仅仅是主题的更新。在你升级 WordPress 2.3 之前,请务必进行全面备份!】

既然你阅读本文,我就假设你对于主题内部的工作并不熟悉。我将简单地介绍下 The Loop (循环),然后解释如何将标签集成到你的主题里。

The Loop 是指你的博客里控制显示信息的 PHP 代码。如果你有兴趣看看纯粹的代码是让 WordPress 工作的话,我这里有一个完整的未加样式的 WordPress 主题 skeleton 。如果你打开 INDEX.PHP 文件,你就会看到 WordPress 使用 PHP 命令来读取和显示信息,包括标题,作者,日期,和评论数目。主题的作者通过 The Loop 来设置布局,相关的样式信息,这样原本纯粹的信息显示就变成了华丽的、格式漂亮的博客页面,包括了颜色,图片和很好的设计结构。

The Loop 代码看起来是这样的:

  1. <?php while( have_posts() ) : the_post(); ?>
  2. <div class=”post” id=”post-<?php the_ID(); ?>”>
  3. <h2><a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”>
  4. <?php the_title(); ?></a></h2>
  5. <?php the_category( ‘, ‘ ); ?> <?php the_author(); ?> <?php the_time(’F jS, Y’); ?>
  6. <?php edit_post_link(’Edit’,’ ‘,”); ?> <br/> <?php comments_popup_link(’No Comments’, ‘1 Comment’, ‘% Comments’); ?>
  7. <?php the_content(); ?>
  8. </div>
  9. <?php endwhile; ?>
添加标签只需要在 The Loop 内添加一行命令

找到你的 \Wordpress\WP-CONTENT\Themes\themename 目录,你将看到这两个文件:

INDEX.PHP

SINGLE.PHP

这个 INDEX 文件是 Wordpress 主要页面。当有人访问你的博客主页的时候,这个页面被加载。这个文件调用 header(页眉),footer(页脚),和 sidebar(侧边拦)文件。它还包含 The Loop。这是我们要添加标签调用函数的地方。插入标签显示函数到你的文章只需要在 The Loop 内添加一个命令:

  1. <?php the_tags(‘before’, ’separator’, ‘after’); ?>

Before,Separator 和 After 分别用你希望在标签行里显示的文字代替。如果你想要在文章内容后面、“Pervious”链接前面显示标签,只要将上面这行代码复制到紧挨下面这行语句后面即可:

  1. <?php the_content(); ?>

你也可以将这句放到别的地方。在下面的截屏,我将命令添加到了评论后面。WordPress 的接口函数都有很容易理解的名字,因此你很容易就能理解每句代码。

添加标签前:

WordPress Tags

添加标签后:

WordPress Tags

SINGLE.PHP (通常)是同 INDEX.PHP 文件是一样的,只不过它只显示特定文章,并不需要执行 Loop (循环)。除非你的主题对独立文章和主页使用不同的样式。因此,你也应该将标签放到 Single.php 完全相同的地方。只需找到和 INDEX.PHP 文件内相同的代码,将标签放上即可。

标签云

标签云功能也已添加(到 WordPress 2.3 中)。有些类似于 Flickr 风格,最流行的标签,显示的字体越大。标签云显示你的博客使用全部标签,而不是某篇文章使用的标签,因此,添加一个 Widget 或到页脚比放到 Loop(循环) 内更好。下面的例子仅仅为了示范,将标签云放在了一篇文章后面:

WordPress Tags

如果你想要创建一个包括标签云的侧边拦 Widget ,你要先安装 Executable PHP Widget 或类似功能的插件,允许你在 Widget 内运行 PHP 代码。插件激活之后,打开你的 Widget 菜单,添加一个 PHP 代码的 Widget。可以随便起个名字,然后再主窗口添加如下代码:

  1. <?php wp_tag_cloud(’smallest=8&largest=36&’); ?>

这个标签云将显示你的博客使用的全部标签,按照名字排序,使用最少的标签 8pt字体,使用最多的标签 36pt 的字体。更多定义标签云的细节可以访问这里

如果你想要在页脚添加标签云,你需要编辑 WordPress\WP-CONTENT\Themes\themename\FOOTER.PHP 。和 index 文件一样,你只需要添加代码到合适的位置即可。放在页脚的时候,比放在 index 内变化稍微多一些,因此我无法精确地告诉你放在什么地方。像前面所说,WordPress 的接口函数很容易理解,因此,想把代码放到什么地方,就放什么地方。如果放错了,你可以很容易地撤销、重新放置。

一点也不难吧,是不是?我希望我已经帮你准备好使用 WordPress 2.3 这个很棒的功能。差不多所有的搜索引擎优化专家都推荐使用标签。标签添加到 WordPress 2.3 之后,不再只是之前那些使用插件的用户,每个用户都将从中受益。

补充:如何添加 WordPress 2.3 标签到你的主题第二部分,回答了下面网友提出的一些问题。

原文出处: http://richgilchrest.com/how-to-add-wordpress-23-tags-to-your-current-theme/

中文翻译: http://wordpresschina.org/how-to-add-wordpress-23-tags-to-your-current-theme-9/

 

Technorati 标签: , , , ,

下一页 »