How to Use Include Files in Templates – SilverStripe CMS

One of the thing you want to use as an included template files is mostly 2nd level menu (sidebar menu).

Include files must be in themes/yourtemplatename/templates/Includes folder it’s the same level as Layout folder.

2nd level menu example code u add to themes/yourtemplatename/templates/Includes/Menu2.ss:

<% if Menu(2) %>
    <ul id="Menu2">
        <% control Menu(2) %>
            <li class="$LinkingMode"><a href="$Link" title="Go to the $Title page">$MenuTitle</a></li>
        <% end_control %>
    </ul>
<% end_if %>

And to include the Menu2.ss use in your themes/yourtemplatename/templates/Layout/Page.ss code:

<% include Menu2 %>

Looking for quality SilverStripe Web Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , , , , | Posted under SilverStripe CMS | RSS 2.0

Author Spotlight

Teet Bergmann

Teet Bergmann

I'm a freelance web designer from Estonia. Mostly doing sites using Silverstripe, magento, prestashop, wordpress.

Leave a Reply

Your email address will not be published. Required fields are marked *


2 − 2 =

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>