21297 Posts in 5734 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 220 Views |
-
Best place for a common function

6 March 2012 at 11:04pm
I have two functions which I want to use in both a controller (which is called in template), and a DataModule.
It's only two functions, instead of duplicating the code, whats/where is the best place to put these two functions?
-
Re: Best place for a common function

7 March 2012 at 8:20am
Page.php Page_Controller
Not sure what DataModule is but if it extends the Page class then it should be accessible in your other two classes.
-
Re: Best place for a common function

7 March 2012 at 1:50pm
See this thread for some solutions: http://www.silverstripe.org/general-questions/show/19136
-
Re: Best place for a common function

8 March 2012 at 8:14pm
Thanks for the replies.
I don't feel like the functions belong in the main Page controller - as other controllers don't need these functions.Maybe I could create a separate class with static functions (or normal).
| 220 Views | ||
|
Page:
1
|
Go to Top |



