Welcome Guest, Not a member yet? Register   Sign In
Issues or misunderstanding of routes
#1

[eluser]emilianozublena[/eluser]
hi, im kinda new to CI, im trying to develop a clean and simple CMS using CI as base, im using MatchBox for the HMVC design pattern, i have been able to make it work, im able to create new modules and almost anything, but this is kind of making me crazy;

inside of each module, i have an admin.php controller, thats the one who handles the Backend administration and also helps me to have nice url's inside backend Wink

so, if a go to http://localhost/myfolder/ecommerce/admin (being ecommerce the folder's name of my module of ecommerce and admin the name of the controler) it works splendid, but. to tell you the truth, that url is NOT nice so using routes im trying to make my url work this way: http://localhost/myfolder/admin/ecommerce.

I've added the following in the routes.php file, but i cant make it work

$route['admin/([a-zA-Z_-]+)/(:any)'] = '$1/admin/$2';
$route['admin/([a-zA-Z_-]+)'] = '$1/admin/index';

trying to find what am i doing wrong ive tried this simple thing

$route['admin/ecommerce'] = 'ecommerce/admin';

but doesnt work too!


what things should i have in my mind while dealing with routes?

thanks for your help in advance!
#2

[eluser]Clifford James[/eluser]
This might work, changing ' to ":

route[‘admin/([a-zA-Z_-]+)/(:any)’] = "$1/admin/$2";
$route[‘admin/([a-zA-Z_-]+)’] = "$1/admin/index";
#3

[eluser]emilianozublena[/eluser]
hi Clifford, thanks for your reply, i've tried that and didnt worked either Sad

any other ideas?

btw, im running apache2 inside ubuntu 10.04, already have mod_rewrite enabled and successfuly removed index.php from CI url's. other than that, i dont know what else you should know.

regards!
#4

[eluser]Clifford James[/eluser]
What does your .htaccess look like?
#5

[eluser]emilianozublena[/eluser]
i dont think that this is what gives trouble to my project, but there you go Smile

DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
#6

[eluser]emilianozublena[/eluser]
i founded that if i place a route like:
route['admin'] = "admin_ori"; //admin_ori is the admin Controller

it works! what could it be what its doing that it wont work when i put admin/ecommerce but for this, it just works?
#7

[eluser]emilianozublena[/eluser]
anybody a hint?
#8

[eluser]emilianozublena[/eluser]
im still not being able to make it work, i have looked upon PyroCMS and found out that they use the same method as im trying to, but i dont understand why in Pyro it works, and in my version not :S

thanks in advance!




Theme © iAndrew 2016 - Forum software by © MyBB