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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:35:39+00:00 2026-06-15T05:35:39+00:00

Possible Duplicate: Call to a member function on a non-object In my homepage view

  • 0

Possible Duplicate:
Call to a member function on a non-object

In my homepage view I’ve trying to pass data to my header sub-view

<?php
  $this->load->model('header2');
  $head = $this->header2->HeaderData();
  $this->load->view('head_view', $head);
?>    

but I get this error:

Message: Undefined property: CI_Loader::$header2
Fatal error: Call to a member function HeaderData() on a non-object in H:\Forum\application\views\homepage_view.php on line 6

  • 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-06-15T05:35:40+00:00Added an answer on June 15, 2026 at 5:35 am

    write your code in controller method and load your view form there only, and use code like this

     $this->load->model('header2');
     $data['head'] = $this->header2->HeaderData();
     $this->load->view('head_view', $head);
    

    and in the head_view.php view access this property as $head like this

    echo '<pre>';
    print_r($head);
    echo '</pre>';
    

    if you are loading main view and then calling subview in it then you don’t need to pass a value while loading view and you can directly access value in subview, so you can directly use $head in subivew.

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

Sidebar

Related Questions

Possible Duplicate: PHP Fatal error: Call to a member function Execute() on a non-object
Possible Duplicate: CakePHP: Call to a member function find() on a non-object I have
Possible Duplicate: Call to a member function bind_param() on a non-object I'm getting the
Possible Duplicate: Call to a member function on a non-object I have just started
Possible Duplicate: Call to a member function on a non-object What is wrong with
Possible Duplicate: Call to a member function on a non-object I try to call
Possible Duplicate: lambdas require capturing 'this' to call static member function? I want to
Possible Duplicate: javascript object, access variable property name? I'm trying to call a method
Possible Duplicate: Call Function in Underlying ViewController as Modal View Controller is Dismissed I've
Possible Duplicate: What will happen when I call a member function on a NULL

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.