Welcome Guest, Not a member yet? Register   Sign In
Routing vs Wrapper functions
#1

[eluser]meigwilym[/eluser]
Hi,

I'm building a site for my Rugby Club.

The site is in two parts: info about the club (history etc), and info about the teams (scores, fixtures, match reports etc).

So I have two controllers with functions like this:
Code:
Club
  /index
  /more/id

Team
  /info/teamid  # team homepage
  /fixtures/teamid
  /match-reports/reportid
In my search for prettier URLs (e.g. team/first/fixtures), I think I have two choices: Routing or wrapper functions in the classes.

Code:
$route['team/first'] = 'team/info/1';

# or...

function first(){
  return $this->info(1);
}

So my question is, which is the better way? Is there a difference?

Many thanks,

Mei
#2

[eluser]TheFuzzy0ne[/eluser]
Personally, I prefer the second approach. It allows you to keep the routing within the controller. Other people might see things differently however.
#3

[eluser]meigwilym[/eluser]
Me too. It also allows me to stay in the controllers directory, and saves me from having to mess about in the config files.

Mei




Theme © iAndrew 2016 - Forum software by © MyBB