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

  • Home
  • SEARCH
  • 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 8917967
In Process

The Archive Base Latest Questions

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

I have a site written with mvc Codeigniter. I want that inside a view

  • 0

I have a site written with mvc Codeigniter. I want that inside a view in a specific position call another view because for example the menu is repeated in many pages and is the same for all.

In my controller I have write this:

public function home()
    {
      $data['menu_function'] = $this->load->view('backend/include/menu_function_view');
      $data['menu'] = $this->load->view('backend/include/menu_view');
      $this->load->view('backend/include/header_view_logged');
      $this->load->view('backend/home_view',$data);
      $this->load->view('backend/include/footer_view');
    }

and into my home_view

<?php 
echo($menu_function);
?>
<div id="page">
    <?php 
    echo($menu);
    ?>
     <div id="content">
....

The problem is that the content inside $menu is out form page. I have seen that in firebug ithe html is like this:

<div id="menu">
...
</div>
   <div id="page">
    ...
   </div>

instead of:

<div id="page">
     <div id="menu">
      ...
     </div>
   </div>

How can I solve It?

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

    Don’t know if this the best approach but usually I use to create template file that load view in it. Here the basic idea:

    in folder view I create file template.php that contains:

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

    I then create folder view/include which contains:

    file header.php and footer.php

    In controller I call:

    $data['main_content'] = 'user/dashboard';
    $this->load->view('template', $data);
    

    EDIT: The menu problem

    How about passing the data like $menu_config to your header or view template.

    header.php

    <html>
    <head>
        <title>$title</title>
    </head>
    <body>
    
    <?php 
        if($menu_position == 'top1') { 
            $this->load->view($menu);
        }
    ?>
    

    On Controller:

    $data['main_content'] = 'user/dashboard';
    $data['menu'] = 'top_menu';
    $data['menu_position'] = 'top1';
    $this->load->view('template', $data);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written an ASP.NET MVC application that runs inside an IFrame. When one
I have a site written in Delphi that needs to get data from a
I have an English language forum site written in perl that is continually bombarded
We have a updatable web site project that is written in c#, it has
I have a MVC web site that worked well, until I moved it into
I have written a simple ASP.NET MVC 2 application that stores data and can
I have a web-site written in ColdFusion that contains both the usual interactive web
I have one site, written in php and inside of the .php site there
I have a web site written in ASP.NET MVC 4.5 I have a controller
I have written a MVC web application that is used on our corporate intranet.

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.