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.

Themes /

Discuss SilverStripe Themes.

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

Themes and Code


Go to End


2 Posts   2094 Views

Avatar
Apophis

Community Member, 4 Posts

3 July 2013 at 3:07am

From the documentation:

A theme does not include any PHP: instead it should be separate from the code which allows the portability of a design. After all, this is an MVC framework!"

Currently I am developing an advanced theme for myself it's currently already pretty feature complete in comparison to most of the featured themes, however to ever think about posting it, I have a big Problem, and I'd like to know how you address it.

A theme gives the views and the presentation of functionality, but you only theme for certain functionaility, of course all the Base functionality, and some Themes even have templates for certain modules, but obviously thats it. After that you are on your own.

Example: My Theme has a HomePage class with a News Sliders on it, a Twitter feed and so on - this needs a backend, some code.

Currently it resides in the mycode directory, but it is hillarious, the twitter feed makes only sense with my Theme and If I would make the theme available somone would need to have the code too. Otherwise it is pretty useless. Of course I could make a module out of it, never done that before. But even then the Theme cannot say: I need Module x, otherwise I am pretty broken.

There needs to be some kind of control from the Theme to the code, at least in a declarative Manner. If you only do it for yourself or your projects this is only a small thing of course. But the documentation says this inconvienience is because of portability. I disagree without any control it makes the code less portable, a view is worthless without a controller, and to develop more advanced themes you need some information on what is available to display. Or the CMS itself needs more base functionality.

I'd like to hear opinions or solutions, and especially if there are any plans to help the developer in any way with this Problem.

Avatar
Willr

Forum Moderator, 5523 Posts

10 July 2013 at 11:05pm

This is my biggest issue with themes, themes in fact are pretty useless in SS. If you want to bundle code with your theme (say for sliders) then you either have to have the PHP code in a separate module for users to install, or tell users in the README to copy the classes from X to mysite/code.