silverstrap Git Source Tree


4A [SilverStripe]( theme based on the
5[Bootstrap]( front-end framework.
6It should work out of the box on basic sites, so you can drop it into
7your `themes` folder, enable it (either programmatically by using
8`SSViewer::set_theme('silverstrap')` or by switching it in the CMS) and
9check how your new site look.
11The master-1.0 branch is in maintenance mode and it is based on the
12deprecated (and no longer officially supported) Bootstrap version 2.
13The master and dev branches, released as silverstrap-2.x.x, are based
14on Bootstrap 3.
19* Should work out of the box.
20* No dependency on SASS or Ruby. This is a plain SilverStripe theme:
21 just unpack the tarball under `themes/` and enable it.
22* Out of the box support for dynamically generated tables of contents.
23 If you install the [silverstripe-autotoc](
24 module, silverstrap will generate on the fly the table of contents of
25 the current page (if possible) and it will present it in a _.navlist_
26 on the right side. Your site will gain table of contents for free.
27* Proper support for pages nested at arbitrary levels.
28* Quite extensible and customizable. This can be done by *overriding*
29 the default implementation instead of editing it: check the following
30 section for further details.
32Overriding silverstrap
35Let's say you want to use a custom Bootstrap CSS, such as the ones
36provided by [Bootswatch]( You can download and
37store it over the default CSS found in `silverstrap/css/bootstrap.css`.
38This works but it will overwrite the default CSS provided by
39silverstrap... and this is bad. You loose the possibility to update
40silverstrap with a `git pull`.
42Instead, you can use the SilverStripe template trick used by
44to override the templates *without touching a byte* of the original
45silverstrap folder:
471. put silverstrap under `themes` (as usual).
482. create a `silverstrap_Page` directory at the same directory level:
49 any page of type `Page` (hence the whole site) will look for
50 templates in this directory first;
513. copy the new bootstrap CSS in some place accessible by the web
52 server, e.g. under `themes/silverstrap_Page/css/mybootstrap.css`;
534. create `themes/silverstrap_Page/templates/Includes/`
54 and put the following code in it:
56 <%-- Override the default bootstrap CSS with the custom one --%>
57 <% require CSS(themes/silverstrap_Page/css/mybootstrap.css) %>
58 <%-- Re-include the default bootstrap javascript --%>
59 <% require javascript("//") %>
62is an extension to Silverstrap that uses this very same approach to
63override the default Bootstrap theme with
64[Cerulean]( You see the
65[source code](
66for technical insights.
68This trick can be used to override anything, such as to enhance the
69default page template, to set the favicon, to add or remove a feature
70or to put a watermark on every page. The templates in silverstrap are
71quite fragmented to make it easier to change only a single aspect.
73Accessing parent pages
76The default implementation provides support for custom nested levels
77in _.navbar_ but does not provide a way to access the parent pages, as
78commonly provided by vanilla SilverStripe. In other words, if you have
79subpages under `yoursite/contacts/` you can access them but there is no
80easy way to access `yoursite/contacts/` (apart from directly write the
83To alleviate the problems a *Sitemap* of the first two levels is put
84by default before the footer. This does not resolve the problem for
85further levels though.
87To be able to access the parent pages directly from the _.navbar_ you
88can override `` and add a fixed item at the beginning
89of the `<ul>` list, right before looping on `$Children`. The
90`` file does exactly that, so you should use
91it instead of the original template. By leveraging the override trick
92explained in the previous section, you can accomplish this by creating
93`themes/silverstrap_Page/templates/Includes/` under your
94website directory with the following content:
96 <% if $Children %><% if $Parent %>
97 <% include NavbarSubmenuAccessible %><% else %>
98 <% include NavbarMenu %><% end_if %>
99 <% else %>
100 <% include NavbarLink %>
101 <% end_if %>
106For bug reports or feature requests, please use the dedicated
107[development tracker](

Archive Download this file