Posts

Showing posts with the label drupal7

connect to multiple database from drupal

Drupal has the ability to connect to multiple databases, allowing you to use Drupal’s built in database abstraction layer on more than just Drupal's primary database. Preferably you would add your configuration in the settings.php file for your site, so that all modules can interact with the new database. Drupal 7 In your settings.php: $databases = array(); $databases['default']['default'] = array( // Drupal's default credentials here. // This is where the Drupal core will store it's data. ); $databases['alternate_db']['default'] = array( // Your secondary database's credentials here. // You will be able to explicitly connect to this database from your modules. ); The way to use it in module: // Use the database we set up earlier db_set_active('alternate_db'); // Run some queries, process some data db_query('...............'); //Switch back to the default connection when finished. // other...

How does caching work in Drupal?

Image
In my experience, there seems to be a lot of misunderstanding how Drupal caching works. I'm not talking about advanced caching mechanisms like Varnish, APC or memcache here, I'm talking about the core Drupal caching: page cache and block cache which are available in Drupal 7 core. Drupal 6 is similar but works a but differently because page caching was simplified for Drupal 7 (e.g. aggresive mode is now a available as a settings.php var) and the entire system also has become pluggable. Everybody knows this screen and the settings. But what do they exactly mean? What difference do they actually make? What do they do? Here is an attempt to explain the settings at '/admin/config/development/performance' . Page Caching: If enables, page caching will only be used for anonymous users. If you enable page caching, the entire HTML of each page will be stored in the database. This significantly reduces the amount of queries needed. This automatically means that bl...

whats new in drupal7

So finally Drupal 7 has been released, following 3 years' intensive development. Hundreds of developers have contributed to make Drupal easier and more powerful than ever. Drupal is an open source Content Management System written in PHP. Yes, another one. However, Drupal was one of the first good CMSs and it became a popular blogging and social community platform following its launch in 2001. Many popular sites use it today including The White House , The Economist , The New York Observer , HowToDoThings.com and Linux Journal . Changes for site builders new minimum requirements: PHP 5.2, MySQL 5.0, PostgreSQL 8.3 installation profiles (minimal / default) SQLite support new password strength indicator time zone handling in core story content type renamed article default taxonomy tags add-a-menu link permission screen easier to read, each has descriptions that can be translated, grouped by content type users can cancel own accounts improved translation interface foru...