导航

随笔分类 -  开源项目 - Drupal

摘要:文章来源:http://www.cnblogs.com/ghj1976/archive/2010/07/19/1780844.html在 drupal 跟目录下有个 .htaccess 文件, 这个文件中就有URL地址重写的配置信息,配置信息如下:# Various rewrite rules. RewriteEngine on # If your site can be accessed both with and without the 'www.' prefix, you # can use one of the following settings to redirec 阅读全文

posted @ 2013-10-09 16:10 eastson 阅读(260) 评论(0) 推荐(0)

摘要:1.启用memcache代替Mysql的缓存表处理缓存数据。2.添加一个opcode缓存可以让 PHP能够重用前面编译过的代码,这样就会跳过解析和编译。常见的opcode缓存有Alternative PHP Cache (http://pecl.php.net/package/APC), eAccelerator (http://eaccelerator.net), XCache (http://trac.lighttpd.net/xcache/)3.Session放到数据库=》memcache处理。同时利于多个服务器的扩展。4.PHP允许你控制多长时间清除一次旧的会话记录。Drupal将这一 阅读全文

posted @ 2013-10-09 15:59 eastson 阅读(586) 评论(0) 推荐(0)

摘要:网上看到一篇介绍Drupal与phpbb整合的文章。浏览了一下,真心地不错。于是就想将与整合有关的文章做一个汇总,以备不时之需:Drupal7整合PHPBB论坛Drupal 7 整合 Vanilla 论坛drupal与ucenter的集成的模块ucenterzencart与drupal整合(第1天)——zencart基础操作教程zencart与drupal整合(第2天)—zencart模块调用机制zencart与drupal整合(第3天)—将zencart与drupal组合成一个网站Drupal 集成 Question2Answer(用户整合)Drupal与MediaWiki 整合教程-Aut 阅读全文

posted @ 2013-10-09 15:10 eastson 阅读(324) 评论(0) 推荐(0)

摘要:什么意思?意思是说,假如你有这样的需求,需要将cache_page缓存到数据库,其它的都缓存到memcache,这该怎么办?看看_cache_get_object()的实现你就会知道上面的问题该怎么处理了:function _cache_get_object($bin) { static $cache_objects; if (!isset($cache_objects[$bin])) { $class = variable_get('cache_class_' . $bin); if (!isset($class)) { $class = variable_get(... 阅读全文

posted @ 2013-10-09 14:18 eastson 阅读(279) 评论(0) 推荐(0)

摘要:Drupal许多的函数中都使用了静态变量。按照通常的用法,静态变量的使用应该是这样的:function drupal_set_title($title = NULL) { static $stored_title; if (isset($title)) { $stored_title = $title; } return $stored_title;}但是Drupal使用的方式有些不同。主要的考量应该是这样:可能会有几十上百个函数中使用了静态变量,Drupal需要在某一时刻对这些静态变量都做reset处理。这个时候,不可能对这几十上百个函数都重新调用一次。因此,Drupal需要一... 阅读全文

posted @ 2013-10-09 11:20 eastson 阅读(298) 评论(0) 推荐(0)

摘要:页面缓存是什么意思?有些页面浏览量非常大,而且与状态无关,这类页面就可以使用页面缓存技术。在页面第一次请求完毕以后,将响应结果保存起来。下一次再请求同一页面时,就不需要从头到尾再执行一遍,只需要将第一次执行的响应结果获取出来,直接返回给使用者就行了。什么样的页面请求可以缓存?Drupal使用函数drupal_page_is_cacheable()区分哪些请求可以缓存:function drupal_page_is_cacheable($allow_caching = NULL) { $allow_caching_static = &drupal_static(__FUNCTION__, 阅读全文

posted @ 2013-10-08 16:55 eastson 阅读(1000) 评论(0) 推荐(0)

摘要:配置是Drupal启动过程中的第一个阶段,通过函数_drupal_bootstrap_configuration()实现:function _drupal_bootstrap_configuration() { set_error_handler('_drupal_error_handler'); set_exception_handler('_drupal_exception_handler'); drupal_environment_initialize(); timer_start('page'); drupal_settings_init 阅读全文

posted @ 2013-10-08 11:19 eastson 阅读(603) 评论(0) 推荐(0)

摘要:Drupal整个启动过程共分为8个阶段:DRUPAL_BOOTSTRAP_CONFIGURATION:initialize configuration DRUPAL_BOOTSTRAP_PAGE_CACHE:try to serve a cached page DRUPAL_BOOTSTRAP_DATABASE:initialize database layer DRUPAL_BOOTSTRAP_VARIABLES:initialize the variable system DRUPAL_BOOTSTRAP_SESSION:initialize session han... 阅读全文

posted @ 2013-10-07 16:51 eastson 阅读(580) 评论(0) 推荐(0)

摘要:Drupal的后台数据库中有很多以cache开头的表,这些都是Drupal的缓存数据表。Drupal的缓存机制使用了接口方式,所有的缓存对象都必须实现DrupalCacheInterface接口:interface DrupalCacheInterface { function get($cid); function getMultiple(&$cids); function set($cid, $data, $expire = CACHE_PERMANENT); function clear($cid = NULL, $wildcard = FALSE); function isE. 阅读全文

posted @ 2013-10-07 16:03 eastson 阅读(622) 评论(0) 推荐(0)

摘要:Drupal的系统变量都保存在数据库variable表中:然后,开发人员可以通过下面的API函数操作这些系统变量:function variable_get($name, $default = NULL) { global $conf; return isset($conf[$name]) ? $conf[$name] : $default;}function variable_set($name, $value) { global $conf; db_merge('variable')->key(array('name' => $name))-&g 阅读全文

posted @ 2013-10-07 15:47 eastson 阅读(314) 评论(0) 推荐(0)

摘要:My solution to getting Clean URL working with my multisite setup drupal 4.7I added Alias to my httpd.conf apache file: # Alias for all php drupal sites Alias /abc /var/www/html/drupal Alias /def /var/www/html/drupal Alias /xyz /var/www/html/drupalMy setup has 4 sites /drupal, /abc, /def,... 阅读全文

posted @ 2013-10-05 16:47 eastson 阅读(291) 评论(0) 推荐(0)

摘要:Drupal的注册表是指registry和registry_file两个数据表。前一个表保存所有可用的类和接口以及它们所对应的文件,后一个表保存每个文件的hash码。1. 将所有需要更新的文件都汇总的$files数组:// 需要更新的文件有两部分:一是系统includes目录下所有的.inc文件,二是模块描述文件中通过files属性声明的文件。$files = array();$modules = db_query("SELECT * FROM {system} WHERE type = 'module'")->fetchAll();foreach ( 阅读全文

posted @ 2013-10-05 10:57 eastson 阅读(367) 评论(0) 推荐(0)

摘要:Drupal通过spl_autoload_register()注册类加载器实现自动加载:function _drupal_bootstrap_database() { // ... .... spl_autoload_register('drupal_autoload_class'); spl_autoload_register('drupal_autoload_interface');}再来看看类加载器是如何实现的?function drupal_autoload_interface($interface) { return _registry_check_c 阅读全文

posted @ 2013-10-05 10:26 eastson 阅读(499) 评论(0) 推荐(0)

摘要:Drupal的配置文件搜索是通过bootstrap.inc的conf_path()函数实现的:function conf_path($require_settings = TRUE, $reset = FALSE) { $conf = &drupal_static(__FUNCTION__, ''); if ($conf && !$reset) { return $conf; } $confdir = 'sites'; $sites = array(); if (file_exists(DRUPAL_ROOT . '/' 阅读全文

posted @ 2013-10-04 15:16 eastson 阅读(947) 评论(0) 推荐(0)

摘要:Drupal使用称之为“placeholder”的方式处理SQL查询参数: 'page',));// CORRECT:$result = db_query("SELECT nid, title FROM {node} WHERE type = :type", array( ':type' => 'page',));?>数组参数主要是应用于IN查询的环境: array(13, 42, 144));// Will get turned into this prepared statement equivalent au 阅读全文

posted @ 2013-09-26 16:28 eastson 阅读(260) 评论(0) 推荐(0)

摘要:Drupal的数据库连接信息通过文件settings.php中的变量$databases设置。变量$databases是一个二维的数组,第一维称为key,第二维称为target。使用这种方式可以处理多数据库和主从分离这样复杂的情况。例如,假设有这样的配置:$databases['default']['default'] = array( 'database' => 'drupal',);$databases['default']['slave1'] = array( 'database 阅读全文

posted @ 2013-09-24 09:56 eastson 阅读(742) 评论(0) 推荐(0)

摘要:1 /** 2 * Passes alterable variables to specific hook_TYPE_alter() implementations. 3 * 4 * This dispatch function hands off the passed-in variables to type-specific 5 * hook_TYPE_alter() implementations in modules. It ensures a consistent 6 * interface for all altering operations. 7 *... 阅读全文

posted @ 2013-08-13 14:53 eastson 阅读(831) 评论(0) 推荐(0)

摘要:Drush(Drush = Drupal + Shell)就是使用命令行命令来操作Drupal站点,它的命令格式与git类似,都是双字命令(drush + 实际的命令)。既然是命令行命令,也就可以使用其他脚本来实现相同的功能,比如编写shell脚本来实现相同的功能,也的确有不少人这样做过。但是,使用Drush要远优于编写自己的脚本,好处在于,一是可以利用Drush开发社区的力量,二是Drush的命令更加可靠,适用于更多变的环境。从安全性考虑,Drush应当安装站点之外的目录下。官方站点上介绍,最简单的安装方法是使用PEAR工具,但是很多共享主机可能并不提供此工具。下面介绍的是通过git来安装最 阅读全文

posted @ 2013-08-09 15:23 eastson 阅读(1211) 评论(0) 推荐(0)

摘要:1. 安装并启用CKEditor和IMCE模块。2. 配置CKEditor:3.配置用户的权限即可。最终效果图: 阅读全文

posted @ 2013-08-07 17:42 eastson 阅读(250) 评论(0) 推荐(0)

摘要:Views模块:使用Drupal 6 Views Module系列(一)主题:Drupal Zen 基模板菜鸟终结者:认识Zen|增加对Nice Menus 的支持|一些基于Zen的子模板|drupalla.com案例讲解Drupal主题制作指南(v6) 阅读全文

posted @ 2013-08-07 15:31 eastson 阅读(229) 评论(0) 推荐(0)