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.

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.

General Questions /

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

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

The Manifest builder and including custom php libraries


Go to End


3 Posts   2611 Views

Avatar
dalesaurus

Community Member, 283 Posts

14 August 2009 at 5:37am

Edited: 14/08/2009 5:39am

I am attempting to add an existing PHP library into my SS install. I know the SS Manifest Builder traverses all folders hunting for php files that live in a directory that doesn't have a _manifest_exclude file in it and are not listed in _exclude.php.

Logic would tell me that I can:

  • 1. Create a library dir: /mysite/lib/
  • 2. Copy my library files into that dir, MyCustomClass.php
  • 3. Rebuild
  • 4. Call MyClassPhp() from anywhere in the php code

However in my controller when I try to instantiate new MyCustomClass() I get: Fatal error: Class 'MyCustomClass' not found in

I perused the mainfest builder files and see that SS has indeed found it an produced a manifest file to include it. Is there a problem that I'm missing? Can I not have an arbitrary sub folder under /mysite/ with php? I don't see anywhere that the includes only work on /top-level/code/?

Avatar
Willr

Forum Moderator, 5523 Posts

14 August 2009 at 3:32pm

You should be able to use any folder name - not just code. I know for example the Mollom module stores the 3rd party library in /lib/

Make sure your filename = classname eg if you call your class MyCustomClass then your file must be MyCustomClass.php.

Avatar
dalesaurus

Community Member, 283 Posts

15 August 2009 at 2:24am

Man, that is totally it. My first post on this forum ended up being the same thing.

I'm going to go add some comments on the wiki. I know there is a blurb but it isn't stressed very much.

http://doc.silverstripe.com/doku.php?id=manifestbuilder