goFrendiAsgard / No-CMS

No-CMS, A CodeIgniter Based CMS Framework
299 stars 199 forks source link

Routes #48

Closed izdrail closed 11 years ago

izdrail commented 11 years ago

hy ,i was working today with modules inside nocms ..and i observe that you can't use routes inside modules or config ..it will be nice to do so ...

goFrendiAsgard commented 11 years ago

Hi, thank you for let me know about this. I'll check it tonight. I think it is related to HMVC plugin, but let's see if I can do something with that.

izdrail commented 11 years ago

yes ... hope thatyou cand fix'it ...

goFrendiAsgard commented 11 years ago

Hi, I found that config file works like this:

Assuming configuration file should be located on "my_module/config/config.php" and has such a code:

$config['something'] = 'some value';

Then, you can get the config from any controller by using something like this:

$this->load->config('my_module/config');
echo $this->config->item('something');

I can't figure out for the route in module. Can you please share your code, so that I can check that?

izdrail commented 11 years ago

ok so if the config it's working in this way for me it's ok ... in routes im refering like this ..i have a module called moduleA and a method inside the controller moduleA named methodB i what to rewrite the url so that insted of site.com/moduleA/methodB i have like this site.com/whateverA/whateverB ...and the routes.php to be inside the folder of module/config/routes.php, not in aplication/config/routes.php

goFrendiAsgard commented 11 years ago

I think one quick solution is by using .htaccess. I'm not quite sure about it since I never use routes.php to rewrite the URL. I don't even sure that we can do that by using routes.php. But I'll check it again. EDIT: I'm sorry, you are right, we should be able to use it http://ellislab.com/codeigniter/user-guide/general/routing.html

izdrail commented 11 years ago

i was prepering to put you the link ...:) ok hope that we cn use'it ,because ionize cms or pyro cms using alredy this

goFrendiAsgard commented 11 years ago

For now I come to conclusion that it is goes as http://ellislab.com/forums/viewthread/181459/ But I'll check it more if there is already some solution for this.

goFrendiAsgard commented 11 years ago

Hi again, I found it works. Maybe you've just forgot adding "module" name (just as in my case). In my case, I have "example" module, which has "example" controller and "index" function And I put this in modules/example/config/routes.php

$route['example/something_doesnt_exists'] = 'example/index'; 

I try to access localhost/No-CMS/example/something_doesnt_exists and it works as expected

EDIT: to do what you want (change the url of the module name) I think you need to change the main routes.php (application/config/routes.php)

EDIT AGAIN: if you don't want to make changes of main routes.php (application/config/routes.php), then you can make a new "dummy" modul called "whateverA". and in whateverA, you should make a new routes.php (modules/whateverA/routes.php), and write something like this:

$route['whateverA/whateverB'] = 'moduleA/methodB';