Welcome Guest, Not a member yet? Register   Sign In
Setting a homepage
#4

(This post was last modified: 03-28-2018, 02:38 PM by InsiteFX.)

The default controller cannot be in a sub-directory.

From the CodeIgniter Users Guide.

You can NOT use a directory as a part of this setting!


PHP Code:
<?php
defined
('BASEPATH') OR exit('No direct script access allowed');

/**
 * -----------------------------------------------------------------------
 * Editor   : PhpStorm
 * Date     : 1/12/2018
 * Time     : 7:40 AM
 * Authors  : Raymond L King Sr.
 * -----------------------------------------------------------------------
 *
 * Class        MY_Controller
 *
 * @project     ci3admin
 * @author      Raymond L King Sr.
 * @link        http://www.procoversfx.com
 * @copyright   Copyright (c) 2009 - 2018 Custom Software Designers, LLC.
 * @license     http://www.procoversfx.com/license
 * -----------------------------------------------------------------------
 */

/**
 * Class BaseController
 */
class BaseController extends CI_Controller
{
    
/**
     * Class properties - public, private, protected and static.
     * -----------------------------------------------------------------------
     */

    /**
     * Data variable for views.
     *
     * @var  array
     */
    
public $data = [];

    
/**
     * __construct ()
     * -----------------------------------------------------------------------
     *
     * Class    Constructor
     *
     * NOTE: Not needed if not setting values or extending a Class.
     */
    
public function __construct()
    {
        
parent::__construct();

        
log_message('debug'"BaseController Controller Class Initialized");
    }

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

  // End of BaseController Controller Class.

/**
 * Class Backend
 */
class Backend extends BaseController
{
    
/**
     * Class properties - public, private, protected and static.
     * -----------------------------------------------------------------------
     */

    /**
     * __construct ()
     * -----------------------------------------------------------------------
     *
     * Class    Constructor
     *
     * NOTE: Not needed if not setting values or extending a Class.
     */
    
public function __construct()
    {
        
parent::__construct();

 
       log_message('debug'"Backend Controller Class Initialized");
    }

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

  // End of Backend Controller Class.

/**
 * Class Frontend
 */
class Frontend extends BaseController
{
    
/**
     * Class properties - public, private, protected and static.
     * -------------------------------------------------------------------
     */

    /**
     * __construct ()
     * -------------------------------------------------------------------
     *
     * Class    Constructor
     *
     * NOTE: Not needed if not setting values or extending a Class.
     */
    
public function __construct()
    {
        
parent::__construct();

        
log_message('debug'"Frontend Controller Class Initialized");
    }

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

  // End of Frontend Controller Class.

// End of MY_Controller Controller Class.

/**
 * -----------------------------------------------------------------------
 * Filename: MY_Controller.php
 * Location: ./application/core/MY_Controller.php
 * -----------------------------------------------------------------------
 */ 

Use the above and then create a Home controller.

PHP Code:
<?php
defined
('BASEPATH') OR exit('No direct script access allowed');

/**
 * -----------------------------------------------------------------------
 * Editor   : PhpStorm
 * Date     : 1/12/2018
 * Time     : 7:29 AM
 * Authors  : Raymond L King Sr.
 * -----------------------------------------------------------------------
 *
 * Class        Home
 *
 * @project     ci3admin
 * @author      Raymond L King Sr.
 * @link        http://www.procoversfx.com
 * @copyright   Copyright (c) 2009 - 2018 Custom Software Designers, LLC.
 * @license     http://www.procoversfx.com/license
 * -----------------------------------------------------------------------
 */
class Home extends Frontend
{
    
/**
     * Class properties - public, private, protected and static.
     * -----------------------------------------------------------------------
     */

    /**
     * __construct ()
     * -----------------------------------------------------------------------
     *
     * Class    Constructor
     *
     * NOTE: Not needed if not setting values or extending a Class.
     */
    
public function __construct()
    {
        
parent::__construct();

        
log_message('debug'"Name Controller Class Initialized");
    }

    
/**
     * index ()
     * -----------------------------------------------------------------------
     *
     */
    
public function index()
    {
        
$data = [];
        
        
$this->load->view('Your_view'$data);

    }


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

  // End of Home Controller Class.


/**
 * -----------------------------------------------------------------------
 * Filename: Home.php
 * Location: ./application/controllers/Home.php
 * -----------------------------------------------------------------------
 */ 

Hope that helps.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
Setting a homepage - by TamasD - 03-28-2018, 12:11 PM
RE: Setting a homepage - by jreklund - 03-28-2018, 02:09 PM
RE: Setting a homepage - by TamasD - 03-28-2018, 02:11 PM
RE: Setting a homepage - by InsiteFX - 03-28-2018, 02:32 PM
RE: Setting a homepage - by jreklund - 03-28-2018, 02:53 PM
RE: Setting a homepage - by InsiteFX - 03-28-2018, 08:17 PM
RE: Setting a homepage - by XtreemDeveloper - 03-29-2018, 05:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB