Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7053951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:34:01+00:00 2026-05-28T03:34:01+00:00

In codeigniter we have the standard classes of an mvc framework, models,views, libraries,etc. I’d

  • 0

In codeigniter we have the standard classes of an mvc framework, models,views, libraries,etc. I’d like to add my own sub-set of objects to CodeIgniter, how can I best go about that? for example:

directories:

controllers
core
helpers
etc..
widgets //custom object type

inside of core, I could have a My_Widget class that everything in the widget folder would extend. Then, inside of a controller I could have something like:

$this->load->widget('Example_Widget');
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:34:02+00:00Added an answer on May 28, 2026 at 3:34 am

    I have never done this so I can’t offer you a complete solution, but I can at least try to point you in the right direction.

    Take a look at the Loader Class, located in /system/core/Loader.php. This is what you are accessing when you use $this->load. It contains a number of methods for loading resources of different types (models, libraries, etc). You may be able to get away with duplicating the model() method, renaming it widget(), and updating the paths to check an /application/widgets directory. You might need to do a little more, such as creating a CI_Widget base class, but you should be able to go line by line through the method and figure out what it requires to work.

    I hope this helps.

    Edit (1/12/2012):

    Here is an example of someone extending CodeIgniter to support a custom resource type.

    Sparks is a package management system for CodeIgniter much like RubyGems for Ruby. Using a spark is simple. Once you have modified your CodeIgniter environment to support sparks, you simply install the spark and then load it using $this->load->spark('...');. Modifying your CodeIgniter environment to support sparks simply entails extending the Loader Class to support the new sparks() method.

    The code for modifying the Loader Class is available here. Following the pattern in that file, you should be able implement loading of your own custom resource types. In my previous answer I said that you could get away with modifying the /system/core/Loader.php file although I would recommend you follow the approach used by sparks and use a /application/core/MY_Loader.php file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have codeigniter installed at the root directory, and would like to have a
I am using Codeigniter framework and I have a form with input fields. When
Fairly straightforward question: I know that Codeigniter is a MVC framework - however what
I have a question just like in the title - Why codeigniter shopping cart
I have a question just like in the title - Why codeigniter shopping cart
In the CodeIgniter framework I have a form action that posts the id of
I have Codeigniter and Ion Auth installed on MAMP. I have the libraries working
I have a CodeIgniter MVC application. I have a model called city that has
I have a CodeIgniter app which has a controller to invoke Capistrano. Like so:
I have a codeigniter project light inside the folder projects , it looks like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.