• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Codeigniter, linking to dynamic URLS

#1
[eluser]Unknown[/eluser]
All my routing is done with a database so my urls are dynamic.
However, i would still like to be able to link to them, but to do that, I need your help.

Currently my routes look like this:
Code:
Array
(
    [default_controller] => user/create
    [404_override] =>
    [create/success] => user/create/success
    [create] => user/create
    [administrator] => administrator/dashboard
    [login] => user/login
    [logout] => user/logout
    [administrator/editor] => administrator/editor
    [administrator/clients] => administrator/clients
    [administrator/client/(:num)] => administrator/clients/client/$1
)

I'm looking to create a function where i input the link to the controller.
It could be:
Code:
echo url_real('administrator/clients/client/11'); // returns: administrator/client/11

My theory is that i first match the varible with all the array's values, and after that, matches all the $1, $2, $3 with the array's keys.
And after that return the dynamic url.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.