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.

Customising the CMS

Import own classes


3 Posts   684 Views


27 January 2010 at 4:51am Community Member, 26 Posts

Is it possible to import my own classes in Page.php for example? I am using methods again and again and I don´t want to write the functions twice.

I tried to create a class "ImageManipulator.php" in my folder. It looked something like that:

+ silverstripe
____+ mysite
______ + code
____+ mycustomsite
______ + code
______ + com
________ + ImageManipulator.php
______ + templates
______ ...

The problem is that ss does not ignore this file, but tries to parse it and fails. But I think there must be a folder which is ignored by silverstripe, so that I can create my own classes in there?

Examples welcome!


27 January 2010 at 11:51am Forum Moderator, 5511 Posts

By default SS will build a manifest of all the PHP classes - so you don't have to include or require anything. If you want the default SS manifest builder to ignore a directory (say you have some classes you want to keep wayy out of SS) you need to create a blank '_manifest_exclude' file. No file extension, no content, just a file with that filename.

This will tell the manifest builder to ignore that directory.


27 January 2010 at 12:14pm Community Member, 26 Posts

That´s just great! Thanks a lot!