CodeIgniter Forums
issue with including view with view - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: issue with including view with view (/thread-18358.html)

Pages: 1 2


issue with including view with view - El Forum - 05-04-2009

[eluser]gedev2006[/eluser]
Hi

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?


issue with including view with view - El Forum - 05-04-2009

[eluser]umefarooq[/eluser]
tell me the css path, is you css in right path of your controller or view


issue with including view with view - El Forum - 05-04-2009

[eluser]Dam1an[/eluser]
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?


issue with including view with view - El Forum - 05-04-2009

[eluser]gedev2006[/eluser]
hi

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 />" />


issue with including view with view - El Forum - 05-04-2009

[eluser]umefarooq[/eluser]
check its not right

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

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


issue with including view with view - El Forum - 05-04-2009

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


issue with including view with view - El Forum - 05-04-2009

[eluser]TheFuzzy0ne[/eluser]
:wow: <-- Looks more like someone who ate too much sugar.


issue with including view with view - El Forum - 05-04-2009

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


issue with including view with view - El Forum - 05-04-2009

[eluser]Dam1an[/eluser]
I would have spotted it immediatly if it had been in code blocks Wink


issue with including view with view - El Forum - 05-04-2009

[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.