ezrpg-legacy / ezrpg-2.0.X-discontinued-

http://ezrpgproject.net
Other
6 stars 0 forks source link

Separate Routes from settings.php to make dynamic #23

Closed uaktags closed 10 years ago

uaktags commented 11 years ago

I remember the discussion before was with John and Ferdi about the router needed the routes to be hardcoded and how we're not quite sure where that change was implemented. Personally I don't like this as now modules cant declare their routes, the admin has to add them himself. So here's another proposal to keep the system mainly intact, but expand with a few primitive ideas.

Right now we have routes lined up in the settings.php as config['routes'] = array('something' => 'related', etc) Now I don't mind some routes being hardcoded, my first experience with this is in Codeigniter, so developers can manually add in their own routes. I look at this feature as a debugging feature and an initial setup feature.

Initially, some things that need be set would be the installer and the base module. Those are the only two things that should work right off the bat without even being installed. After that, hardcoding routes should be a debugging feature for developers whom are building modules / features and haven't yet integrated their addon to use the Router fully.

Anyway, my proposal is settings.php can include $config['routes'] = array('module' =>'installer') and a few others.

From there, we should either have routes be in the db or routes be saved in a routes.php file. Either way, it could work much like my "cache" implementation on 1.2.x where modules can call a function like addRoute(), the route is then appended to the current array that's loaded already, the routes.php file is deleted, and a new one is created and repopulated.

So again, developers could manually add their routes to settings.php, those routes will then be loaded into an array which will then be merged with the routes from routes.php

Now the only thing to think about will be, how will addRoutes be called, if theres no route already created for a module, the module itself will not be called unless we have a system such as a Module installer which calls an install function from the module, and that install function itself calls the addRoutes function in our library. Basically im slowly moving to talking about modules with _install, _uninstall, _activate, _deactivate functions :-P

JakeBooher commented 11 years ago

IIRC routes are going to be stored in the database, and then cached to the settings file in the future anyways, so they will be dynamic. I may be wrong though.

On Sat, Jul 20, 2013 at 2:09 PM, uaktags notifications@github.com wrote:

I remember the discussion before was with John and Ferdi about the router needed the routes to be hardcoded and how we're not quite sure where that change was implemented. Personally I don't like this as now modules cant declare their routes, the admin has to add them himself. So here's another proposal to keep the system mainly intact, but expand with a few primitive ideas.

Right now we have routes lined up in the settings.php as config['routes'] = array('something' => 'related', etc) Now I don't mind some routes being hardcoded, my first experience with this is in Codeigniter, so developers can manually add in their own routes. I look at this feature as a debugging feature and an initial setup feature.

Initially, some things that need be set would be the installer and the base module. Those are the only two things that should work right off the bat without even being installed. After that, hardcoding routes should be a debugging feature for developers whom are building modules / features and haven't yet integrated their addon to use the Router fully.

Anyway, my proposal is settings.php can include $config['routes'] = array('module' =>'installer') and a few others.

From there, we should either have routes be in the db or routes be saved in a routes.php file. Either way, it could work much like my "cache" implementation on 1.2.x where modules can call a function like addRoute(), the route is then appended to the current array that's loaded already, the routes.php file is deleted, and a new one is created and repopulated.

So again, developers could manually add their routes to settings.php, those routes will then be loaded into an array which will then be merged with the routes from routes.php

Now the only thing to think about will be, how will addRoutes be called, if theres no route already created for a module, the module itself will not be called unless we have a system such as a Module installer which calls an install function from the module, and that install function itself calls the addRoutes function in our library. Basically im slowly moving to talking about modules with _install, _uninstall, _activate, _deactivate functions :-P

— Reply to this email directly or view it on GitHubhttps://github.com/uaktags/ezrpg-2.0.X/issues/23 .

ferdis commented 11 years ago

Jake is 100% correct. The routes will sync from database to the cache.