Welcome Guest, Not a member yet? Register   Sign In
Retrofitting App to use CodeIgniter
#10

[eluser]dcunited08[/eluser]
sophistry,

Thanks for the assistance, I tried your new fixes and got it working rather well (with some htaccess to hide the index.php and routing everything to my default controller). I made some changes to include an 'old' folder to segregate everything out of the default folder and keep the main structure intact.
Code:
class Site_migrate_base extends Controller {

    var $default_view_and_method = 'index';
    var $oldDir;
    
    function Site_migrate_base()
    {
        parent::Controller();
    }
    
    function _remap()
    {
        $view_or_method = $this->uri->rsegment(2,$this->default_view_and_method);
        
        // if the method exists in any parent/child class, run it
        // else load the view file (even nested views by uri string)
        if (method_exists($this,$view_or_method))
        {
            $this->$view_or_method();
        }
        else
        {
            $local_view_path = rtrim($this->uri->ruri_string(),'/');
            if(isset($this->oldDir))
            {
                $local_view_path =  str_ireplace('tirome', 'TIRomeOld', $local_view_path);
                
            }
            
            $view_file_full_path = APPPATH.'views/'.$local_view_path;
            $view_file = (is_dir($view_file_full_path)) ? $local_view_path.'/'.$this->default_view_and_method : $local_view_path;
            
            $activeDir = getcwd();
            $worked = chdir(dirname($view_file_full_path));
            $this->load->view($view_file);
            chmod($activeDir);
        }
    }


I used a route to send everything ending in '.php' to the default controller so that anything new will not end in '.php'.


Messages In This Thread
Retrofitting App to use CodeIgniter - by El Forum - 09-12-2008, 09:25 AM
Retrofitting App to use CodeIgniter - by El Forum - 09-12-2008, 11:37 AM
Retrofitting App to use CodeIgniter - by El Forum - 09-15-2008, 04:12 AM
Retrofitting App to use CodeIgniter - by El Forum - 09-15-2008, 04:27 AM
Retrofitting App to use CodeIgniter - by El Forum - 09-15-2008, 07:56 AM
Retrofitting App to use CodeIgniter - by El Forum - 09-16-2008, 07:01 AM
Retrofitting App to use CodeIgniter - by El Forum - 09-16-2008, 11:43 AM
Retrofitting App to use CodeIgniter - by El Forum - 09-16-2008, 12:09 PM
Retrofitting App to use CodeIgniter - by El Forum - 09-16-2008, 02:13 PM
Retrofitting App to use CodeIgniter - by El Forum - 09-17-2008, 01:37 PM
Retrofitting App to use CodeIgniter - by El Forum - 09-17-2008, 07:32 PM
Retrofitting App to use CodeIgniter - by El Forum - 09-18-2008, 10:08 AM
Retrofitting App to use CodeIgniter - by El Forum - 09-18-2008, 12:19 PM
Retrofitting App to use CodeIgniter - by El Forum - 09-18-2008, 12:30 PM



Theme © iAndrew 2016 - Forum software by © MyBB