Problems with custom controllers

#4
[eluser]John_Betong[/eluser]
I have just tried this on my LOCALHOST and it seems to work.
 
 
Code:
// ./controller/c_test.php

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

require APPPATH .'libraries/MY_test.php';

//============================================
class C_test extends MY_test
{
    
   //===============================================================================================
   function index($owner=NULL, $pagename=NULL, $key=NULL)
   {
     echo 'THIS WORKS FINE ON MY LOCALHOST';
   }

}//endclass

// ./libararies/MY_test.php
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

// http://ellislab.com/forums/viewthread/62859/
class My_test extends Controller
{
    
    // ESSENTIAL TO HAVE A CONTRUCT
        // http://ellislab.com/forums/viewthread/128180/
      function __construct()
    {
      parent::__construct();
      $this->load->helper('url');
    }    


  //==================================================
  function index()
  {
    // this is NEVER EVER called      
    echo __FILE__; die;
  }//endfunc

//endclass
 
 
I reckon that it would be beneficial if CodeIgniter elaborated a little on their help and maybe with the installation supplied some empty classes, models, plugins, etc.
 
 
 
 


Messages In This Thread
Problems with custom controllers - by El Forum - 09-06-2009, 08:10 AM
Problems with custom controllers - by El Forum - 09-06-2009, 08:36 AM
Problems with custom controllers - by El Forum - 09-06-2009, 08:43 AM
Problems with custom controllers - by El Forum - 09-06-2009, 06:08 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.