CodeIgniter Forums
Hi all, another url problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: Hi all, another url problem (/thread-56092.html)



Hi all, another url problem - El Forum - 11-26-2012

[eluser]ppwalks[/eluser]
Hi all,

i'm having a bit of trouble finding an answer to this question, I have searched all the forums on this and still no-one has answered this question.

How do you assign a parent url in the url structure i.e

http://www.site.com/parent/child

I currently have my queries set up to find an article based upon the url_slug and with the pages/posts table I have a parent id to assign any pages as a sub-page but as a access them the browser only shows one level deep, do I set up the query to identify if has parent first and pass the args to the controller or is their an easier way without having to write more complex db queries.

Thanks all

Paul


Hi all, another url problem - El Forum - 11-27-2012

[eluser]ppwalks[/eluser]
Never mind fixed the problem and it was relatively easy to be honest, I used the URL SEGMENTS to get the url sent from the generated menu and I simple run the search through the last segments to retrieve the current page so this would make it flexible for any level of url index.

Get the segment array then use the php function "end" to get the last value, very easy.....