Drupal系列网站设置文件settings.php包含共用的部分
Jun 06, 2016 pm 08:11 PM以前在设置MediaWiki网站的时候,是把一些共用的修改放在CommonSettings.php中,然后LocalSettings.php中最后加入一行: require_once( "/usr/local/apache2/htdocs/common/CommonSettings.php" ); 就可以让一系列的网站都共用CommonSettings.php这个文件中
以前在设置MediaWiki网站的时候,是把一些共用的修改放在CommonSettings.php中,然后LocalSettings.php中最后加入一行:
require_once( "/usr/local/apache2/htdocs/common/CommonSettings.php" );
就可以让一系列的网站都共用CommonSettings.php这个文件中的设置,比较简单、方便,我们一直在采用。
在Drupal的网站中,因为需要在settings.php中做的修改不算多,所以以前就没有像上面那样设置,只是在各个站的settings.php中单独修改需要修改的内容。
近期因为做多语言的系列网站需要在settings.php中修改site name,逐个修改很麻烦,就想到调用统一的common.php,然后以后的修改就只需要在这一个文件就可以了,这个办法也很简单,在各个站的settings.php最后一行加入:
require_once( "/var/www/html/example.com/sites/common.php" );
这个common.php中可以包含各种设置、判断、翻译等。
我们以前的settings.php中一般只是加入了一条判断手机版的语句,例如:
if (substr($path,0,3)=='/m/') $conf['theme_default'] = 'mobile';
可以把这一句复制到common.php,并加入更多的其它设置语句。原来的settings.php可以批量修改,用到的linux shell语句示例如下:
find /var/www/html/example.com/sites -maxdepth 2 -name 'settings.php' | xargs perl -pi -e 's|.*substr.*theme_default.*mobile.*|require_once( "/var/www/html/example.com/sites/common.php" );|g'
?
自由标签:
- Drupal
- 网站
- 设置
原文地址:Drupal系列网站设置文件settings.php包含共用的部分, 感谢原作者分享。

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to set the scheduled time for publishing works on Douyin? How does it set the video duration?

Where is the Douyin tag set? How can it be tagged so that it can be pushed accurately?

Do Not Disturb Mode Not Working in iPhone: Fix

Where to set Douyin recommendations and selections

How to set the watermark in the middle on Weibo_How to set the watermark in the middle on Weibo

How to set up scheduled publishing on Weibo_Tutorial on how to set up scheduled publishing on Weibo

How to set the countdown to grab tickets in Damai

Xiaomi 15 series full codenames revealed: Dada, Haotian, Xuanyuan
