• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Routing DB pages

#14
(10-09-2015, 06:33 AM)mwhitney Wrote: I didn't really take a look at this earlier for one reason or another, but here's my initial feedback on the MY_Router class:

- Match the signature of the parent's constructor and pass the argument to the parent so you don't lose functionality in the router:




PHP Code:
public function __construct($routing NULL)
{
 
   log_message('debug'"Class ".get_class($this)." Initialized.");
 
   parent::__construct($routing);


- The get_class($this) is not really necessary here unless you plan on further extending MY_Router. It's a great idea for things like MY_Controller and MY_Model, where you could potentially have hundreds of extending classes, but an extension of MY_Router is going to be rare enough that it can write its own log_message() call for initialization (and I would make this an 'info' call to match the call in CI_Router, but that's up to you).

- You'll have to update this for 3.0.2, which shouldn't be too painful and hopefully won't mess anything up. This is what always makes me step back from overwriting existing methods and try to think about another way to do it. In this case, I'm still not completely sure, but after running it through a diff against the 3.0.1 router, I can see that you did tread lightly, and I haven't found a way, yet, to do the same thing while overriding fewer methods.

- Changed the constructor so it now matches the parent constructor.

- get_class is me being a bit lazy when adding a log message. I can just copy and paste and the corret class name is logged. I like to log all classes that are called so I can see what is going on when debugging and searching for problems.

Reading the changelog for 3.0.2 I only found this regarding the Router class

Quote:Fixed a bug (#4109) - Routing to default_controller didn’t work when enable_query_strings is set to TRUE.

So I think I only need to update the _set_routing method with the fixed one and it should be good to go.
Reply


Messages In This Thread
Routing DB pages - by Martin7483 - 09-28-2015, 02:39 AM
RE: Routing DB pages - by slax0r - 09-28-2015, 04:47 AM
RE: Routing DB pages - by Martin7483 - 09-28-2015, 04:58 AM
RE: Routing DB pages - by slax0r - 09-28-2015, 05:03 AM
RE: Routing DB pages - by Martin7483 - 09-28-2015, 05:12 AM
RE: Routing DB pages - by slax0r - 09-28-2015, 05:21 AM
RE: Routing DB pages - by Martin7483 - 09-28-2015, 05:31 AM
RE: Routing DB pages - by slax0r - 09-28-2015, 05:46 AM
RE: Routing DB pages - by Martin7483 - 09-30-2015, 07:48 AM
RE: Routing DB pages - by weblogics - 10-05-2015, 11:07 AM
RE: Routing DB pages - by Martin7483 - 10-08-2015, 07:54 AM
RE: Routing DB pages - by weblogics - 10-09-2015, 05:11 AM
RE: Routing DB pages - by mwhitney - 10-09-2015, 06:33 AM
RE: Routing DB pages - by Martin7483 - 10-15-2015, 01:02 AM
RE: Routing DB pages - by Martin7483 - 10-15-2015, 05:03 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.