I'm trying to implement a 3rd party class that contains User Agent detection functions. I assume implementing it is more complex than just copying the file into mysite/code and using a standdard PHP include statement. I want to be able to call it in the Page_Controller so I assume it actually needs to extend one of the other Controllers to use it however, I can't find any documentation on how to this.
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
You can do it a couple of ways. If you put it in your mysite folder then SS will include it automatically for you. You don't need to change / include anything, SS will 'know' where it is. You might need to do a ?flush=1 to make sure this works.
Or second option - if the autoloader doesn't work, eg if the classname doesn't equal the filename or if you have multiple class's in the same file you can put the file in its own folder with a '_manifest_exclude' blank file and then use the normal php include or require tag to include your file just as normal.
Okay, thanks, that's what I thought, I think the problem was that the class name and file name had an underscore in it.