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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:26:58+00:00 2026-06-05T05:26:58+00:00

I am trying to include a header in my application.I created a controllers site

  • 0

I am trying to include a header in my application.I created a controllers site and defined a function header in it, which renders the data variables to views/header.php

However, when i try to access myUrl/site/header all varialble work fine but when i create another function in site controller index and include views/header in that, and i run site/index then i get Undefined variable notices in the header.

Any Idea??

class site extends CI_Controller {
function header()
{

$data =array('name'=>'foo');

$this->load->view('includes/header',$data);
}

function index()
{

$this->load->view('includes/index');

}
}

INDEX.PHP

$this->load->view('includes/header');

  • 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-05T05:26:59+00:00Added an answer on June 5, 2026 at 5:26 am

    Got it Solved!!!!

    Wrote a new helper and returned the data from there, then passed the data to view using load->view(‘includes/header’,$data);

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

Sidebar

Related Questions

I am trying to write a function that includes a file named header.php in
I am trying to write simple dcmtk application I adeed the following header #include
I'm trying to include the Sparkle framework in my application. I don't really understand
I'm trying to include an image in an email, which is being sent using
I am trying to include a .js file into a php file. My folder
I am trying to include the Zend_Service_Amazon_S3 file by using require_once 'Zend/Service/Amazon/S3.php'; I have
I'm trying to use partial application of function arguments so I can use STL's
I'm using JSF-2.0 and I'm trying to include a jsp as a header for
I am trying to run and compile one application which needs to use the
I'm trying to learn Qt, with a fairly simple application: #include <QtGui/QApplication> #include <QPushButton>

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.