Jump to:

791 Posts in 369 Topics by 303 members

Widgets

SilverStripe Forums » Widgets » [INFO] Widgets folder

Discuss SilverStripe Widgets.

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

Page: 1
Go to End
Author Topic: 1685 Views
  • FungshuiElephant
    Avatar
    Community Member
    57 Posts

    [INFO] Widgets folder Link to this post

    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.

  • FungshuiElephant
    Avatar
    Community Member
    57 Posts

    Re: [INFO] Widgets folder Link to this post

    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.

  • joshy
    Avatar
    Community Member
    57 Posts

    Re: [INFO] Widgets folder Link to this post

    The way I do it is:

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

    ./widgets/themes/MyWidget.ss (etc)

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

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