views:

214

answers:

2

In Ruby (forgive me for mentioning it's name), I noticed you could do a anchor link with "link to unless current", which would remove the link if it was the current page.

I know there's nothing built into CI to do something similar, but I'm trying to come up with the best way to do this. I've got a few options, but they're all too long and cumbersome.

Any ideas? Maybe using the URI segment?

A: 

You can

A. Use an if statement around the link

or

B. Make your own function

CodeIgniter is a significantly smaller framework than ruby on rails as far as features go. I doubt they have a copy of every useful function rails has.

epochwolf
I realize that CI is lighter and won't provide a piece of code identical to this Ruby one. I'm merely asking if there's a good mix of CI code that will suffice without building the whole thing from pure PHP.
jmccartie
+1  A: 

Why not write your own helper that follows the html helper link_tag checker... put one more condition inside there to check if your in the current controller. Looking at codeIgniter with xdebug, the object returned by get_instance provides access to pretty much everything the controller had. so ci->router->uri->rsegments could be used to check for your controller action.

Edit: Sorry forgot the "uri" part in that chain above.

David