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.

Archive /

Our old forums are still available as a read-only archive.

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

Mixed up with basic file structure


Go to End


6 Posts   2443 Views

Avatar
woodb2

Community Member, 48 Posts

28 June 2008 at 2:26am

I think I'm going to start my site over from scratch, but first I would like to know the proper way to go about it. Don't over think your answer, I'm not looking at something complex, just very basic setup.

I built a very basic site using the blackcandy theme. I wanted to make some minor color changes so I copied the blackcandy theme to a new one (we'll call it newtheme). I make my changes to the css in newtheme and it looks like I'm wanting.

I've tried doing the tutorials, but I'm getting lost at where I should be putting the files. Do they go in the tutorial directory (like in the tutorial) or the mysite directory or in with newtheme. I've had limited success doing the ArticlePage tutorial. It took several tries at putting the ArticlePage and ArticleHolder files in different directories to get the types to show up in the CMS (but they do now, but it doesn't work 100%) The Menu2 doesn't show like in the tutorial. In fact the left side menu doesn't work in any of the tutorial examples I've tried (News and Staff examples). The menu works perfect if I create a page with the default Page type.

I'm willing to start from scratch (I haven't added content) if that's the easiest way to get a properly working site.

I'm just not positive which directories I should be modifying/adding when working on the site.

Any help would be appreciated. Thanks!

Avatar
Willr

Forum Moderator, 5523 Posts

28 June 2008 at 11:03am

Once you finish using the tutorial code then your custom PHP page types should go in mysite/code/ rather the tutorial/code/ . To tell SilverStripe to use the code from Mysite rather then the tutorial folder you need to

* Copy tutorial/_config.php to mysite/_config.php
* Open mysite/_config.php and edit the $project = "tutorial" to point to mysite - so $project = "mysite"

* Run db/build?flush=1

Or you can keep using the tutorial/ folder to store the code. Basically that $project var in the _config.php file tells SS where the code is.

All your HTML, CSS and Images for your site should be in themes/newtheme/ as per blackcandy

Avatar
Nadee

Community Member, 12 Posts

14 August 2008 at 10:14pm

I have a similar question.

Both 'mysite' folder and the 'themes/<theme_name>' folder has the same folder structure with sub folders: code, css, images, javascript and templates. Why?

If one should put the custom page types in 'mysite/code' folder, then what should go in 'themes/<theme_name>/code' folder?

Any explanation is greatly appreciated.

Thanks.

Avatar
Willr

Forum Moderator, 5523 Posts

14 August 2008 at 10:31pm

this is a legacy issue that has not been fully resolved / explained - mysite/ folder does not need the css/ images/ and templates/ folders. You can put all your css / template folders in there and not use a theme if you want! normally I just have mysite/code/ , mysite/javascript and mysite/_config.php in the mysite folder.

Unlike mysite where you can put code or templates etc the themes/yourtheme can only contain folders css/ images/ and templates/ as this is what consists of a 'theme'. No code. Just HTML and CSS and images.

Some people put the Javascript files in the themes/yourtheme/javascript folder and that works fine!.

Its a tad confusing at the moment but in conclusion my optimal layout is

mysite /
--- code/
--- javascript/
_config.php

themes
--- your theme name /
------ css/
------ images/
------ templates/
---------- Layout/
---------- Includes/

Avatar
Nadee

Community Member, 12 Posts

15 August 2008 at 3:51am

Thanks willr for the prompt reply. Now it makes sense.

The tutorials doesn't clarify this and even the default SilverStripe release have the legacy folders in it.

Avatar
Willr

Forum Moderator, 5523 Posts

15 August 2008 at 10:01am

Yes those folders will be removed in the next release to help keep it clear and the tutorials are going to be updated.