曼波中国
曼波社区
曼波知识库
曼波搜索

查看完整版本: 让mambo支持title和meta data的多语言显示

emukang 2006-5-20 05:04

让mambo支持title和meta data的多语言显示

我的站点使用 mambo4.5.3h ([url]http://www.ecnnl.com[/url]), 要支持3种不同语言, 目前我使用mambelfish来实现多语言

但问题是mambelfish不支持title和meta data的多语言支持。因此为了实现这个功能,需要做以下更改。

下面是针对我的站点所做的步骤,大家可以根据自己的需要更改

1. 在 configuration.php里添加title 和meta description, meta keywords的不同语言版本。我的站点要支持中文,英文,和荷兰文,因此我需要做以下更改

[code]$mosConfig_sitename = 'E中荷|荷兰华人电子商务';
$mosConfig_sitenameEn = 'ECnNl|Dutch Chinese e-commerce';
$mosConfig_sitenameNl = 'ECnNl|De Nederlandse Chinese e-handel';
$mosConfig_MetaDesc = '做最好的荷兰华人网站设计, 网上商店系统, 个人婚礼纪念, 客户关系管理系统等电子商务解决方案提供商. ';
$mosConfig_MetaDescEn = 'To be the best e-commerce provider for dutch and chinese people in the netherlands, main business: webdesign, online shop system, wedding website design, CRM, web hosting etc. ';
$mosConfig_MetaDescNl = 'Om de best e-handel leverancier voor Nederlandse en chinese mensen in Nederland, hoofdzaken te zijn: webdesign, online winkel systeem, huwelijk website-ontwerp, CRM, ontvangene web enz. ';
$mosConfig_MetaKeys = 'E中荷, 荷兰, 华人, 中国, 网站搭建, 网页设计制作, 电子商务, 网络购物, 网上购物, 在线购物, 网上商店, 网上开店, 网上支付, 在线订餐, 客户关系管理, CRM, 婚礼网站. ';
$mosConfig_MetaKeysEn = 'ECnNl, Netherlands, China, web design, e-commerce, online shop system, crm, wedding website';
$mosConfig_MetaKeysNl = 'Nederland, China, web ontwerp, e-handel, online winkel systeem, crm, huwelijk website';[/code]

2. 修改includes/frontend.php
change codes uder function mosShowHead():
from
[code]global $mosConfig_lang, $mosConfig_MetaDesc, $mosConfig_MetaKeys,................ [/code]
to
[code]global $mosConfig_lang, $mosConfig_MetaDescEn, $mosConfig_MetaDescNl, $mosConfig_MetaDesc, $mosConfig_MetaKeys, $mosConfig_MetaKeysEn, $mosConfig_MetaKeysNl................[/code]
from
[code]$mainframe->appendMetaTag( 'description', $mosConfig_MetaDesc );
$mainframe->appendMetaTag( 'keywords', $mosConfig_MetaKeys );[/code]
to
[code]        if ($mosConfig_lang == 'simplified_chinese') {
                $mainframe->appendMetaTag( 'description', $mosConfig_MetaDesc );
                $mainframe->appendMetaTag( 'keywords', $mosConfig_MetaKeys );
        } else if ($mosConfig_lang == 'english') {
                $mainframe->appendMetaTag( 'description', $mosConfig_MetaDescEn );
                $mainframe->appendMetaTag( 'keywords', $mosConfig_MetaKeysEn );
        } else if ($mosConfig_lang == 'dutch') {
                $mainframe->appendMetaTag( 'description', $mosConfig_MetaDescNl );
                $mainframe->appendMetaTag( 'keywords', $mosConfig_MetaKeysNl );
        }[/code]

from
[code]$title                 = $params->def( 'title', $mosConfig_sitename );[/code]
to
[code]                if ($mosConfig_lang == 'simplified_chinese') {
                        $title                 = $params->def( 'title', $mosConfig_sitename );
                } else if ($mosConfig_lang == 'english') {
                        $title                 = $params->def( 'title', $mosConfig_sitenameEn );
                } else if ($mosConfig_lang == 'dutch') {
                        $title                 = $params->def( 'title', $mosConfig_sitenameNl );
                }[/code]

3. 修改includes/mambo.php
change codes under function setPageTitle( $title=null )
from
[code]$this->_head['title'] = $title ? $GLOBALS['mosConfig_sitename'] . ' - '. $title : $GLOBALS['mosConfig_sitename'];[/code]
to
[code]                    if ($GLOBALS['mosConfig_lang'] == 'simplified_chinese') {
                                        $this->_head['title'] = $title ? $GLOBALS['mosConfig_sitename'] . ' - '. $title : $GLOBALS['mosConfig_sitename'];
                                } else if ($GLOBALS['mosConfig_lang'] == 'english') {
                                        $this->_head['title'] = $title ? $GLOBALS['mosConfig_sitenameEn'] . ' - '. $title : $GLOBALS['mosConfig_sitenameEn'];
                                } else if ($GLOBALS['mosConfig_lang'] == 'dutch') {
                                        $this->_head['title'] = $title ? $GLOBALS['mosConfig_sitenameNl'] . ' - '. $title : $GLOBALS['mosConfig_sitenameNl'];
                                }[/code]

好了,现在就可以实现title,meta data的多语言支持了:lol

看看我的站点的实际效果吧 [url]http://www.ecnnl.com[/url]

[[i] 本帖最后由 emukang 于 2006-5-20 05:34 编辑 [/i]]

Autoit 2006-5-20 10:29

没用过,但收了...

thanks!


jOOmla! AutoIt!

jackie8241 2006-5-22 10:51

我也想在我的网站上安装这种可以转换语言的模块,mambelfish就可以了吗?

ftsmth 2006-10-1 23:49

好牛阿.....

leo1 2006-10-2 01:08

谢谢

bennybian 2007-5-10 16:23

请教个安装时遇到的问题

Session save path  Not set, Unwriteable  
这个错误提示,如何修改呢??
变量不能保存时在哪里设置呢??
我在apache环境下没问题,但是在iis下面就遇到这个。
页: [1]
查看完整版本: 让mambo支持title和meta data的多语言显示