CodeIgniter Forums
Hyphen in Controller Function Names? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Hyphen in Controller Function Names? (/showthread.php?tid=29636)



Hyphen in Controller Function Names? - El Forum - 04-16-2010

[eluser]Prophet[/eluser]
Hi all, the project I am working on at the moment needs to have "pretty" URLs. An example that is giving me grief is "/reports/stock-take". The way I have gone about this is by creating a function called stock-take() in my reports controller... But of course PHP doesn't like hyphens in function names.

How can I keep the hyphen in the URL and still call a separate stock_take() function?


Hyphen in Controller Function Names? - El Forum - 04-16-2010

[eluser]John_Betong[/eluser]
[quote author="Prophet" date="1271434847"]Hi all, the project I am working on at the moment needs to have "pretty" URLs. An example that is giving me grief is "/reports/stock-take". The way I have gone about this is by creating a function called stock-take() in my reports controller... But of course PHP doesn't like hyphens in function names.

How can I keep the hyphen in the URL and still call a separate stock_take() function?[/quote]

Take a look at ./config/routes.php
 
 
 


Hyphen in Controller Function Names? - El Forum - 04-16-2010

[eluser]Prophet[/eluser]
[quote author="John_Betong" date="1271436386"]Take a look at ./config/routes.php[/quote]

Thank you very much!


Hyphen in Controller Function Names? - El Forum - 04-16-2010

[eluser]Aidy[/eluser]
I been using this, works brill..

http://ellislab.com/forums/viewthread/85901/#623512