23486 Posts in 18995 Topics by 2878 members
|Go to End|
16 February 2011 at 1:13pm
Hi I'm new to SS.
I have many contact forms at different pages and using same function.
I don't want to write same function on every controller.
Where I can put the function that all controller can access to it?
16 February 2011 at 5:28pm
Put it in code/Page.php under Page_Controller. As long as your contact form pages extend the Page class, they will inherit your function.
17 February 2011 at 9:47am
Thanks Ryan M,
Could you show me example, accessing controller B to Page_Controller ?
17 February 2011 at 12:45pm
I'm not sure what you mean... do you want me to write an example of how to call the function from another page?
All you would need to do is either use this in your page's controller:
or in your template:
Remember, putting the function in the parent, ie Page.php, will make it available to any pages that extend Page.php.
17 February 2011 at 12:56pm
|Go to Top|