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.

Installing SilverStripe /

Getting SilverStripe up and running on your computer and on your web server.

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

How SS chooses a directory


Go to End


5 Posts   1898 Views

Avatar
bpesner

Community Member, 7 Posts

9 March 2009 at 5:08pm

Hi,

I'm new to SS. I've installed it and run through the tutorials successfully . Here's my question. How does SS know to use the templates and code from the tutorial directory? Why doesn't it use the mysite directory?

My details:

running on Fedora 7 with apache
installed in /var/www/html/SilverStripe
accessing my site using the url http://localhost/SilverStripe
accessing the CMS using the url http://localhost/SilverStripe/admin

Thanks.

Avatar
Sam

Administrator, 690 Posts

9 March 2009 at 5:17pm

It looks for the presence of a non-empty _config.php inside every top-level directory. It treats each directory that matches that criterion as "part of the silverstripe code".

After including each of the _config.php files, it then looks at the value of the $project variable, which is set to "mysite" in mysite/_config.php. It then treats that as the "project directory" and all the other folders as "module directories". In practise, the difference between the project directory and the module directories is very small: templates in the project directory will take precedence of those in other modules, if there's a conflict.

Avatar
bpesner

Community Member, 7 Posts

10 March 2009 at 1:09am

Sam,

Thanks for the prompt and thorough reply. It leaves open one question though: what happens if more than one top-level _config.php has a $project defined with different values?

Of course, ny installation is consistent: I have a number of top-level _config.php files:

auth_openid
cms
sapphire
tutorial

but only tutorial has $project.

Avatar
Sam

Administrator, 690 Posts

10 March 2009 at 10:36am

"what happens if more than one top-level _config.php has a $project defined with different values?"

Bad things. Don't do it. :-P

Technically, it would use the $project value of the last _config.php file that gets included, which I believe would be the last one in the alphabet. But, like I say, a site with two $project values set is better thought of as a broken site.

Modules and core never set $project.

Avatar
bpesner

Community Member, 7 Posts

10 March 2009 at 11:48am

Sam,

Excellent. Thanks so much for your help. If your attention is typical of the way things work with SilverStripe, I will enjoy working with it a lot.