Welcome Guest, Not a member yet? Register   Sign In
problem with Query database in routes.php file

dear all,

I have problem to query database table in routes.php file, this the details story:

I have table in database which contains some filed


i want to query which modules name is actice and use it to route to my url, sample, if i get query news is active from my mic_modules tables so i can redirect to, but if i can't it when i access i will route to

Simple explaination is i want to get which modules is active but i query it from database table.

any advice for this problem? please help...


What about adding a uri column to your modules table? Then handle the condition in your controller using an if/else statement that considers the query results. You can use the redirect() function in url helper to handle the routing.

that's bring me to what not i want to...

if i write url --> http:\\\ci\index.php\xxx

but xxx can't find at controller directory so 404 error page will show, in this case i want this will be redirect to default controller.

if i use route like this

$route['(.*)'] = 'default/$1';

it will wrap all uri and redirect to http:\\\ci\index.php\default

FIY, i have been try use hooks too but i can't load database at pre_system hooks, any suggestion ???

Theme © iAndrew 2016 - Forum software by © MyBB