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.

Customising the CMS /

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

Import own classes


Go to End


3 Posts   1126 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, 5523 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!