• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
issue with including view with view


If i include a view within a view, for example a navigation bar that will be used site wide, in the controller like this:

$viewdata['navbar'] = $this->load->view ( 'templates/navbar', true );

$this->load->view ( 'home', $viewdata );

Then in the view:

<?= $navbar; ?>

The navbar doesnt seem to pick up the CSS thats included in the view ?? Any ideas?

tell me the css path, is you css in right path of your controller or view

Firstly, if you want to pass the contents of the view into a variable, the true should be the 3rd paramted (the second is the view data)
Secondly, why not just load the view within the main view?


i didnt know its possible to include a view in the other.

The css path is like this in the view: <link rel="stylesheet" type="text/css" href="<?= base_url(); ?>css/main.css />" />

check its not right

your code
<link rel=“stylesheet” type=“text/css” href=”<?= base_url(); ?>css/main.css />” >

<link rel=“stylesheet” type=“text/css” href=”<?= base_url(); ?>css/main.css”/>

[eluser]Zeeshan Rasool[/eluser]
You have eagle eyes dude.... :wow:

:wow: <-- Looks more like someone who ate too much sugar.

[eluser]Thorpe Obazee[/eluser]
I read it a couple of times before I saw what he modified Smile

I would have spotted it immediatly if it had been in code blocks Wink

[eluser]Thorpe Obazee[/eluser]
Yeap. I don't know about the others, but it seems that some new posters aren't fond (or didn't see them) of code blocks. I prefer them for readability purposes.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.