![]() |
Troubles with routing - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Troubles with routing (/showthread.php?tid=17506) |
Troubles with routing - El Forum - 04-07-2009 [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 Troubles with routing - El Forum - 04-07-2009 [eluser]n0xie[/eluser] Maybe you should try to use views instead of includes? In your view: Code: $this->load->view('header'); Troubles with routing - El Forum - 04-07-2009 [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? Troubles with routing - El Forum - 04-07-2009 [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/functioniwanttosubmitto. 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... |