Troubles with routing |
[eluser]IEDani[/eluser]
Hi, I am a begginer with code Igniter and I am lost with the routing rules. I´d like to include some parts of code, something so tipical. For example, I have in the folder views the file x.php, in this file I want to include the file foot.php (that is in a folder called includes, that is contain in views folder). I think that I have to put in x.php file include("includes/foot.php") or include("./includes/foot.php"), but it doesn´t work. If I put the absolute routes ir works good, but I prefer relative routes, do you knows how can include files with relative routes? Thanks you, Dani
[eluser]n0xie[/eluser]
Maybe you should try to use views instead of includes? In your view: Code: $this->load->view('header');
[eluser]IEDani[/eluser]
sure? I can´t use traditional routing system? Anyway, thanks a lot! Besides, if I have a form and I want to put the destination page, I have to put the absolute route, can I use relative routes? How?
[eluser]n0xie[/eluser]
What do you mean by destination page? If you mean the page your form submits to, then that should be to a controller. In that case you wouldn't use relative or absolute paths, you would use the URL. Something like http://www.mysite.tld/mycontroller/funct...tosubmitto. If you mean you want to include a form then the usual way to go about it, is to load the view in the controller like this: Code: /* controller */ Code: /* controller */ Inside your template_view you can then output it like you would any other string/object: Code: /* my template_view */ Hope that helps... |
Welcome Guest, Not a member yet? Register Sign In |