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 4034774
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:00:53+00:00 2026-05-20T12:00:53+00:00

<?php class Blog extends CI_Controller { function Blog() { parent::CI_Controller(); } } I’m trying

  • 0
<?php
class Blog extends CI_Controller {
    function Blog() {
        parent::CI_Controller();
    }
}

I’m trying to create a constructor in Code Igniter for my class ‘Blog’ and the above code is giving me a fatal error:

Fatal error: Call to undefined method
CI_Controller::CI_Controller() in
C:\xampp\htdocs\mysites\blog\application\controllers\blog.php
on line 5

How do I fix this?

(I’m going through a online video tutorial on the official code igniter website but I think the tutorial is about 2 years out of date as some of the things are not working when I follow them exactly as shown in the video, this being one of them – the link to the video is here – I encounter this problem towards the end of the tutorial about 8 minutes in)

  • 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-20T12:00:54+00:00Added an answer on May 20, 2026 at 12:00 pm

    It should be this…

    <?php
    class Blog extends CI_Controller {
    
        function __construct() {
            parent::__construct();
        }
    
    }
    

    The tutorial you are probably going through is based on 1.7.2 which had a core of php4 which did not use the php5 __construct() method of building Class constructors. Codeigniter 2.0.0 has a php5 core and uses it.

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

Sidebar

Related Questions

my controller is <?php class Blog extends Controller { function Blog() { parent::Controller(); }
I have a php class, RegistrationController, <?php class RegistrationController extends ParentController { function __construct()
I am having PHP class class SurveyQuestion extends CActiveRecord { public function relations() {
Model : <?php class Blogm extends CI_Model{ function __construct() { // Call the Model
the class, which is content.php class content { private $vars = array(); public function
Here is the class: functions.php class buildPage { public function Set($var,$val){ $this->set->$var = $val;
I have a Model called blog_model. The code for its constructor is below: class
Hi. I've been trying to create a PHP page using Savant Templating Engine that
Hi Im trying to develop a oop php driven blog. Im new to the
I'm fairly new to PHP and designing a small blog. I'm trying to submit

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.