Welcome Guest, Not a member yet? Register   Sign In
Overide Codeigniter ntaive library how ?
#15

[eluser]toopay[/eluser]
@InsiteFX,

Here, i include the code inside Loader.php at system/core...
Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
* An open source application development framework for PHP 5.1.6 or newer
*
* @package        CodeIgniter
* @author        ExpressionEngine Dev Team
* @copyright    Copyright (c) 2008 - 2011, EllisLab, Inc.
* @license        http://ellislab.com/codeigniter/user-guide/license.html
* @link        http://codeigniter.com
* @since        Version 1.0
* @filesource
*/

// ------------------------------------------------------------------------

/**
* Loader Class
*
* Loads views and files
*
* @package        CodeIgniter
* @subpackage    Libraries
* @author        ExpressionEngine Dev Team
* @category    Loader
* @link        http://ellislab.com/codeigniter/user-guide/libraries/loader.html
*/
class CI_Loader {

    // All these are set automatically. Don't mess with them.
    var $_ci_ob_level;
    // Here, it is string, not an array!
    var $_ci_view_path        = '';
    var $_ci_library_paths    = array();
    var $_ci_model_paths    = array();
    var $_ci_helper_paths    = array();
    var $_base_classes        = array(); // Set by the controller class
    var $_ci_cached_vars    = array();
    var $_ci_classes        = array();
    var $_ci_loaded_files    = array();
    var $_ci_models            = array();
    var $_ci_helpers        = array();
    var $_ci_varmap            = array('unit_test' => 'unit', 'user_agent' => 'agent');


    /**
     * Constructor
     *
     * Sets the path to the view files and gets the initial output buffering level
     *
     * @access    public
     */
    function __construct()
    {
        // Here, it is string, not an array!
        // If we want to specify other directory than 'views'
        // We need to declared $this->_ci_view_path = APPPATH.'otherviews/';
        // at MY_Loader.php, and save it, not into 'application/libraries' but 'application/core'
        $this->_ci_view_path = APPPATH.'views/';
        $this->_ci_ob_level  = ob_get_level();
        $this->_ci_library_paths = array(APPPATH, BASEPATH);
        $this->_ci_helper_paths = array(APPPATH, BASEPATH);
        $this->_ci_model_paths = array(APPPATH);

        log_message('debug', "Loader Class Initialized");
    }

    //... Here the view function

    /**
     * Load View
     *
     * This function is used to load a "view" file.  It has three parameters:
     *
     * 1. The name of the "view" file to be included.
     * 2. An associative array of data to be extracted for use in the view.
     * 3. TRUE/FALSE - whether to return the data or load it.  In
     * some cases it's advantageous to be able to return data so that
     * a developer can process it in some way.
     *
     * @access    public
     * @param    string
     * @param    array
     * @param    bool
     * @return    void
     */
    function view($view, $vars = array(), $return = FALSE)
    {
        return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return));
    }
    //...
}
So, your above code will not affecting the Loader class at all. To overide the Loader, we only need to specify our own view folder, by STRING (NOT ARRAY), at '$this->_ci_view_path' variable on MY_Loader class, then save it to application/core.


Messages In This Thread
Overide Codeigniter ntaive library how ? - by El Forum - 04-30-2011, 08:59 PM
Overide Codeigniter ntaive library how ? - by El Forum - 04-30-2011, 11:29 PM
Overide Codeigniter ntaive library how ? - by El Forum - 05-01-2011, 12:36 AM
Overide Codeigniter ntaive library how ? - by El Forum - 05-01-2011, 12:45 AM
Overide Codeigniter ntaive library how ? - by El Forum - 05-01-2011, 12:51 AM
Overide Codeigniter ntaive library how ? - by El Forum - 05-01-2011, 12:56 AM
Overide Codeigniter ntaive library how ? - by El Forum - 05-02-2011, 02:38 AM
Overide Codeigniter ntaive library how ? - by El Forum - 05-02-2011, 02:54 AM
Overide Codeigniter ntaive library how ? - by El Forum - 05-02-2011, 02:58 AM
Overide Codeigniter ntaive library how ? - by El Forum - 05-02-2011, 03:07 AM
Overide Codeigniter ntaive library how ? - by El Forum - 05-02-2011, 03:17 AM
Overide Codeigniter ntaive library how ? - by El Forum - 05-02-2011, 03:19 AM
Overide Codeigniter ntaive library how ? - by El Forum - 05-02-2011, 04:46 AM
Overide Codeigniter ntaive library how ? - by El Forum - 05-02-2011, 07:13 AM
Overide Codeigniter ntaive library how ? - by El Forum - 05-02-2011, 09:57 AM
Overide Codeigniter ntaive library how ? - by El Forum - 05-02-2011, 11:12 AM
Overide Codeigniter ntaive library how ? - by El Forum - 05-02-2011, 12:28 PM
Overide Codeigniter ntaive library how ? - by El Forum - 05-02-2011, 01:22 PM



Theme © iAndrew 2016 - Forum software by © MyBB