Welcome Guest, Not a member yet? Register   Sign In
issue with including view with view
#1

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

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

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

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

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

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

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

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

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

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




Theme © iAndrew 2016 - Forum software by © MyBB