Welcome Guest, Not a member yet? Register   Sign In
Load view within view
#1

[eluser]shiggins[/eluser]
I recently upgraded to 1.6.1 and while it seems implausible, views that I load within a view don't work properly.

For instance I have a number of menus on each page which I call via $this->load->view('menuexample'). Although the menu is displayed it's not in the proper location. It's as if the view overrides any CSS rules, which doesn't make any sense at all. However if I place the menu code into the page, then no problem.

Any suggestions?
#2

[eluser]chejnik[/eluser]
Hello, I also load view within a view, override of css is not possible i guess.
Can you send real code, so we can have a look at it? Maybe there is a small error
that makes it incorrect. Ales
#3

[eluser]Lone[/eluser]
Please place some code examples along with some html example outputs and make sure you use the CODE tags.
#4

[eluser]shiggins[/eluser]
Well it's pretty straightforward....here, for example, I have a menu which is supposed to be positioned in the upper right of the page. If I use load->view...the menu ends up somewhere near the bottom of the page, completely ignoring the class (headeright) rules of the containing div. On the other hand if I replace the load->view with the actual code (templates/top_menu.php), the result is as required. The strange thing is that this was working a couple of weeks ago, and now it's not, but there is no rhyme nor reason that I can see.

Code:
<!--TOP MENU-->
        <div class="headeright">
                  
        &lt;?=$this->load->view('templates/top_menu');?&gt;
#5

[eluser]Pascal Kriete[/eluser]
Get rid of the equal sign (&lt;?=...). You're telling it to echo the view which will put it before the final output call.
#6

[eluser]shiggins[/eluser]
Sorry, that was a typo.....

But it makes no difference to the end result...menu is still ignoring CSS rules.
#7

[eluser]Code Arachn!d[/eluser]
If it's CSS that you're talking about - can you link to the test page in the sandbox or at least provide the CSS and the HTML?
#8

[eluser]Lone[/eluser]
That does seem to be very weird.. Got any HTML samples?
#9

[eluser]shiggins[/eluser]
Let's remember that the issue is not CSS because if I copy the code from the views templates/top_menu.php file and place it where the load->view is currently located, it displays correctly, So the issue is why won't the load->view display the code exactly as if it were not referenced.

This is the menu code that is being called.

Code:
<div id="topmenu">
    <ul id="topmenu">
       <li><img src="&lt;?=base_url()?&gt;images/top_menu/stores_events.gif" alt="Stores and Events"></li>
       <li><img src="&lt;?=base_url()?&gt;images/top_menu/product_tips.gif" alt="Product Tips"></li>
       <li><img src="&lt;?=base_url()?&gt;images/top_menu/decorating.gif" alt="Decorating"></li>
       <li><img src="&lt;?=base_url()?&gt;images/top_menu/hiring.jpg" alt="We're Hiring"></li>
       <li><img src="&lt;?=base_url()?&gt;images/top_menu/contact.gif" alt="Contact Us"></li>
    </ul>
</div>
#10

[eluser]Pascal Kriete[/eluser]
Ok, probably not the source of the issue, but the point of ids is that they're unique, so you really shouldn't have two with the same name.

More to the point, try to include() the view and see if that works.




Theme © iAndrew 2016 - Forum software by © MyBB