Jump to:

22977 Posts in 11806 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » [SOLVED] Implementing 3rd Party Class

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

Page: 1
Go to End
Author Topic: 886 Views
  • zenmonkey
    Avatar
    Community Member
    524 Posts

    [SOLVED] Implementing 3rd Party Class Link to this post

    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.

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: [SOLVED] Implementing 3rd Party Class Link to this post

    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.

  • zenmonkey
    Avatar
    Community Member
    524 Posts

    Re: [SOLVED] Implementing 3rd Party Class Link to this post

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

    886 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.