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.

Widgets /

Discuss SilverStripe Widgets.

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

[INFO] Widgets folder

Go to End

3 Posts   2127 Views


Community Member, 57 Posts

26 May 2009 at 3:06am

Edited: 26/05/2009 3:10am

I usually dump all of my widgets in the silverstripe folder which makes a bit of a mess. I tried putting them in a /silverstripe/widgets/ folder but SS couldn't find them in there.

But! I recently discovered that you can stick them in mysite/ and even in mysite/widgets/.

I prefer the latter - nice and tidy.

In fact SS seems to go on a little hunt through any old folder you create in mysite, so, should you feel inclined, you can probably rearrange other stuff too.
The downside to this is that you can't have an codeOld folder in mysite for example because SS will load that code too.


Community Member, 57 Posts

19 June 2009 at 9:30pm

Actually it seems there is a little flaw in my logic here; it seems that Silverstripe expects to find its config files (_config.php) in an immediate sub directory of silverstripe (eg silverstripe/mywidget/_config.php) so this doesn't actually work properly.

(It just looked like it did because all of the widgets I was using didn't have anything in their _config.php files so it didn't matter that thy weren't being found.)

It would be nice if SS did search for _config.php files in the same way it looks for normal .php files then you could organise you file structure as required.


Community Member, 57 Posts

2 August 2009 at 10:58pm

The way I do it is:

./widget/code/MyWidget.php (etc)

./widgets/themes/ (etc)

Works fine and you can put all the widgets in the same folder :).