CodeIgniter Forums

Full Version: issue with including view with view
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2

El Forum

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

El Forum

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

El Forum

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

El Forum

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

El Forum

[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”/>

El Forum

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

El Forum

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

El Forum

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

El Forum

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

El Forum

[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.
Pages: 1 2