Jump to content

framework - routing & modules question/help


Recommended Posts

hey guys im currently making a framework at the moment which is working fine but i want to be able to add modules and a routing system but firstof all i dont know if i understand it fully if anyone can help.




basically adding a module you would be able to direct  controller: news  action: articles  like so

$modules->add_module('news', array('controller' => 'news', 'action' => 'articles' ));

which would direct http://domain.co.uk/news to the news / articles controlller and action ... is that how it should work?




and the routing to work as such


 $route->add_route(':username', array('controller' => 'user', 'action' => 'info'));


so that the url from user/info controller and action would be http://domain.co.uk/destramic


if someone could please help to shine a bit of light on this so i can understand a bit better please or if anyone has a good site or read up on this...thank you







Link to comment
Share on other sites

Both examples look like simple routes to me, the first is just a hard coded value instead of the more dynamic :something version.


I'm not exactly sure why your naming the first example a module.


In my github (link in signature) there is a repo called proem, this is my simple framework (that isn't near complete), there is a pretty simple Router within that if your looking for some examples.

Link to comment
Share on other sites

sorry haha...i must of just read if quickly but thanks for that ive seen your examples of your routing system so its something to go of...also do you know much about the zend framework?...im just wondering what the modules are actually for?...thanks again thorp

Link to comment
Share on other sites

Ive used Zend on a few projects. Modules are just a way to group controllers together into separate sections. It gives your urls more depth eg; /module/controller/action vs /controller/action

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.