Jump to:

5513 Posts in 1732 Topics by 1218 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Import own classes

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

Page: 1
Go to End
Author Topic: 674 Views
  • eddieconnecti
    Avatar
    Community Member
    26 Posts

    Import own classes Link to this post

    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!

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Import own classes Link to this post

    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.

  • eddieconnecti
    Avatar
    Community Member
    26 Posts

    Re: Import own classes Link to this post

    That´s just great! Thanks a lot!

    674 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.