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

2 simple questions


Go to End


5 Posts   1034 Views

Avatar
Holoch

Community Member, 17 Posts

27 February 2015 at 11:03am

Edited: 28/02/2015 9:02am

Hi all
i have two simple questions.
First: Can i creat directory inside mysite/code? what if i want to make directory for data object and page separately. something like this: mysite/code/dataobject and mysite/code/pages

Second: in _config directory can I put any name to YML file?

Avatar
Fred Condo

Community Member, 29 Posts

27 February 2015 at 11:12am

The answer to both questions is yes.

Avatar
camfindlay

Forum Moderator, 267 Posts

27 February 2015 at 11:25am

Fred is correct, you can add any subfolders in the code folder, however there are a few common names I have seen and that other developers will recognise (which makes getting other SilverStripe devs involved easier as they don;t have to learn your custom structure).

/pagetypes - for your custom pagetypes
/objects - for dataobjects
/models - an alternative for dataobjects
/admin - for modeladmins
/extensions - for dataextensions or extensions
/controllers - for customer controllers

same thing applies to the yaml for example something like routes.yml should ideally contain routing configuration.

Common sense and verbose naming is key.

Avatar
Pyromanik

Community Member, 419 Posts

27 February 2015 at 11:59am

Edited: 27/02/2015 11:59am

You can put code (.php files) in any folder (under the installation root), excepting _config.
Or unless there's a _manifest_exclude file present. Then that folder and all subfolders are skipped out by the manifest (and thus the autoloader knows nothing about the files within).

The structure is just convention for the most part. It keeps things tidy.

Avatar
Holoch

Community Member, 17 Posts

28 February 2015 at 8:03am

thank all for the reply