Can't load a controller from a view, why? |
[eluser]gusst250[/eluser]
In one 'view' I want to include a 'controller' (which should be able to load new views itself). I use the command: Code: $url = base_url(); I get this error message: Fatal error: Class content: Cannot inherit from undefined class controller in /var/www/02/22/69/bestallarkompetens.com/www/application/controllers/content.php on line 3 the first 5 lines of content.php is: Code: <?php content.php works fine when browsing to it manually, it's just when it is included in a view that this message appears. Thankful for any help! /Gustav
[eluser]Thorpe Obazee[/eluser]
Controllers are meant to be the receiver of requests. You could: 1. load the view file from the view or controller 2. use ajax to request
[eluser]gusst250[/eluser]
ok, so how do I do it? This 'include' is meant to include content.php in a <div> at the page, to make the site dynamic. I would then be able to load views right in to that <div>.
[eluser]Thorpe Obazee[/eluser]
[quote author="bargainph" date="1258267860"]Controllers are meant to be the receiver of requests. You could: 1. load the view file from the view or controller 2. use ajax to request[/quote] Points to previous answer------^ Or you could use a template library Colin's template Or you could use widgets.. see Widgets
[eluser]gusst250[/eluser]
Sorry, didn't see those links.. (stupid me), thanks anyway. Will investigate possibilities!
[eluser]gusst250[/eluser]
Ok, solved this particular situation with a system of templates. But I'm interested in how to implement these jQuery/ajax-requests into codeIgniter's $this->load-thing. What is the corresponding jQuery/ajax-syntax, in a controller, of loading a view with: Quote:$this->load->view('somefile');
[eluser]Thorpe Obazee[/eluser]
Well there's none at the moment. It would via normal jQuery.. Hmm.. one moment.. Code: <div id="container"> Something like that but of course you can pass along data on trigger etc. Code: // controller
[eluser]gusst250[/eluser]
Can't really try it now because I'm surfing on my iPod. But it looks like exactly what i was looking for, thanks ![]() |
Welcome Guest, Not a member yet? Register Sign In |