Table of Contents
自由标签:
Home php教程 php手册 Drupal系列网站设置文件settings.php包含共用的部分

Drupal系列网站设置文件settings.php包含共用的部分

Jun 06, 2016 pm 08:11 PM
drupal document series website set up

以前在设置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" );
Copy after login

  就可以让一系列的网站都共用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" );
Copy after login

  这个common.php中可以包含各种设置、判断、翻译等。

  我们以前的settings.php中一般只是加入了一条判断手机版的语句,例如:

if (substr($path,0,3)=='/m/') $conf['theme_default'] = 'mobile';
Copy after login

  可以把这一句复制到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'
Copy after login

?

自由标签:

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to set the scheduled time for publishing works on Douyin? How does it set the video duration? How to set the scheduled time for publishing works on Douyin? How does it set the video duration? Mar 27, 2024 pm 06:11 PM

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? Where is the Douyin tag set? How can it be tagged so that it can be pushed accurately? Mar 27, 2024 am 11:01 AM

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 Do Not Disturb Mode Not Working in iPhone: Fix Apr 24, 2024 pm 04:50 PM

Do Not Disturb Mode Not Working in iPhone: Fix

Where to set Douyin recommendations and selections Where to set Douyin recommendations and selections Mar 27, 2024 pm 05:06 PM

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 the watermark in the middle on Weibo_How to set the watermark in the middle on Weibo Mar 29, 2024 pm 03:31 PM

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 up scheduled publishing on Weibo_Tutorial on how to set up scheduled publishing on Weibo Mar 29, 2024 pm 03:51 PM

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 How to set the countdown to grab tickets in Damai Apr 01, 2024 pm 07:01 PM

How to set the countdown to grab tickets in Damai

Xiaomi 15 series full codenames revealed: Dada, Haotian, Xuanyuan Xiaomi 15 series full codenames revealed: Dada, Haotian, Xuanyuan Aug 22, 2024 pm 06:47 PM

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

See all articles