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


Reply


3 Posts   738 Views

Avatar
eddieconnecti

Community Member, 26 Posts

27 January 2010 at 4:51am

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!

Avatar
Willr

Forum Moderator, 5513 Posts

27 January 2010 at 11:51am

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.

Avatar
eddieconnecti

Community Member, 26 Posts

27 January 2010 at 12:14pm

That´s just great! Thanks a lot!