Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

[SOLVED] Implementing 3rd Party Class


Reply


3 Posts   1022 Views

Avatar
zenmonkey

Community Member, 532 Posts

31 August 2009 at 3:49am

Edited: 02/09/2009 6:16am

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.

Avatar
Willr

Forum Moderator, 5513 Posts

31 August 2009 at 9:12am

Edited: 31/08/2009 9:13am

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.

Avatar
zenmonkey

Community Member, 532 Posts

31 August 2009 at 12:27pm

Okay, thanks, that's what I thought, I think the problem was that the class name and file name had an underscore in it.