Ignite Drupal |
[eluser]Unknown[/eluser]
Drupal Module: ignite_drupal More info here: http://drupal.org/node/1247682 Quote:WARNING: You must have a bit of CodeIgniter and MVC/OOP knowledge to be able to read the following Ever since I was literally forced to work with drupal, I have always wondered about the following: 1) What if I would be able to call CI controllers directly from my drupal functions/hooks, etc. 2) What if I would be able to load anything I want into drupal and everything that's in the CI autoload automatically ? 3) What if I would not change anything to the CI core so that CI may be uupdated at all times ? 4) What if I would be able to call any Drupal API function inside my CI controllers ? Any Drupal function. 5) What if I would be able to manage URI routing using both CI and Drupal. 6) What if I would be able to setup a Drupal hook_menu() item, and that menu item's path would automagically call one of my CI controllers/method ? Now all that, and more in this simple drupal module (see attachment) How to use it ? Step 1: Installing the drupal module. - Unzip the ignite_drupal archive and copy the ignite_drupal folder in it to your drupal installation under sites/all/modules - Go to your drupal admin area, click on modules and scroll down until you see the Ignite Drupal module - Check the box beside that module - Scroll down more and click the Save button. Step 2: Installing the CodeIgniter MVC - Download the latest version of CodeIgniter from the CI website - Unzip and copy the CodeIgniter you just downloaded to a folder of your preference inside your drupal installation. HINT: The ignite_drupal module will automatically look for the mvc folder. So should be: /path/to/drupal/mvc However you can put it in any folder you like. You'll just have to specify the folder name when you instantiate the CI front controller though. It is IMPERATIVE however to place it inside your drupal installation and not anywhere else. No deeper in the installation or outside of it. - Now copy the contents of the folder: ci_core_patches in your mvc installation folder. It should write 3 patches to your application/core folder contents. To the CI-savy people: This just extends 3 Core components to make them act-rite :-) Step 3: Actually use it :-) I'll just post some sample code from both drupal and one of my CodeIgniter controllers to see how it works: CODEIGNITER PART In one of my CI controllers I have the following code: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); DRUPAL PART In one of my custom drupal modules I have the following code: Code: <?php |
Welcome Guest, Not a member yet? Register Sign In |