Don't like ads? PRO users don't see any ads ;-)

MY_Controller_remap.php

By: svizion on Apr 28th, 2012  |  syntax: PHP  |  size: 1.68 KB  |  hits: 27  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.  
  3.     /* --------------------------------------------------------------
  4.      * VIEW RENDERING
  5.      * ------------------------------------------------------------ */
  6.        
  7.     /**
  8.      * Override CodeIgniter's despatch mechanism and route the request
  9.      * through to the appropriate action. Support custom 404 methods and
  10.      * autoload the view into the layout.
  11.      */
  12.     public function _remap($method)
  13.     {
  14.         /* --------------------------------------------------------------
  15.         * Check for Existing Functions inside this Controller
  16.         * ------------------------------------------------------------ */
  17.        
  18.         if (method_exists($this, $method))
  19.         {
  20.             call_user_func_array(array($this, $method), array_slice($this->uri->rsegments, 2));
  21.         }
  22.         else
  23.         {
  24.              /* --------------------------------------------------------------
  25.              * Look for "_404" named methods.
  26.              * ------------------------------------------------------------ */
  27.             if (method_exists($this, '_404'))
  28.             {
  29.                 call_user_func_array(array($this, '_404'), array($method));
  30.             }
  31.             else
  32.             {
  33.                 show_404(strtolower(get_class($this)).'/'.$method);
  34.             }
  35.         }
  36.  
  37.         /* --------------------------------------------------------------
  38.         * VIEW RENDERING
  39.         * ------------------------------------------------------------ */
  40.        
  41.         // Add logic here for the index page.
  42.  
  43.         // Bonfire Template Stuff
  44.         Template::set_view('index');
  45.         Template::render();
  46.     }
  47.    
  48.  
  49. ?>
  50.  
  51.  
  52. // End of _remap Method.
  53. // End of CodeIgniter - Bonfire _remap method.