CodeIgniter Forums
Help with helpers - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Help with helpers (/showthread.php?tid=31625)



Help with helpers - El Forum - 06-26-2010

[eluser]sarah fox[/eluser]
Hi, Has anyone got a PRIMITIVE / Basic guide to 'helpers' ?


I'm getting anerror message in my controllers

>> sing $this when not in object context in .....


has anyone got a basic example

CONTROLLER

primitive controller.php code

How to send a number to a helper..

HELPER

Retrieve the number sent from controller
- add 1 to the number,
send it back to controller


Controller.php assigns the value to a variable - send to a view...





I've been to a few tutorial sites & they do not have 'primitive' (but complete) codes - They just show 1-liner codes, without any relation to a whole script...


Thankyou

EDIT :- Fatal error: Using $this when not in object context in

(forgot the first few characters of error Smile )


Help with helpers - El Forum - 06-26-2010

[eluser]sarah fox[/eluser]
Hi,

Finally off to bed - but I figured it out...

Tomorow - I'll post my "simple" tutorial / Guide on how helpers are done ..

Is it possible to get the help-files updated ? & if so, who do I contact with my simple' code - For their consideration...


Help with helpers - El Forum - 06-26-2010

[eluser]pickupman[/eluser]
Helpers are simply php functions. You pass parameters just like you would to any php function if required. I think why they are referred to as helpers rather than functions is because of similar vocabulary between class functions (methods) and actual function names. Also, helpers may perform multiple php functions like sanitizing form input.