Jump to:

10989 Posts in 2726 Topics by 1817 members

All other Modules

SilverStripe Forums » All other Modules » can you clear this up for silverstripe noob?

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 1045 Views
  • natron
    Community Member
    3 Posts

    can you clear this up for silverstripe noob? Link to this post

    Currently i have one template .ss file named 'Page.ss.' This is the first basic page template I've made by converting my html.
    It's a basic two column page.

    I just installed the calendar module and it's running fine but it appears to be based on "Page.ss" or at least the two columns from "Page.ss" are still present resulting in three columns when the calendar is viewed.

    I'd like to disregard 'Page.ss' when viewing the calendar page. Is this possible? I was under the impression that the .ss files were templates for pages and assigned to actual pages in the cms. Seems to me that the calendar is somehow being forced into the 'Page.ss' template...

    probably missing something obvious here.. but no clue at this point!

  • UncleCheese
    4085 Posts

    Re: can you clear this up for silverstripe noob? Link to this post

    Each template is composed of at least two parts -- the main template, and the layout.

    In the root of your templates/ directory, you'll have a Page.ss. This is the main "wrapper" for your site, that is, all the elements that essentially never change from page to page. On this site, the Page.ss probably ends after the grey strip under the main nav, for instance.

    In the Layout/ subfolder, you can define custom templates for each of the page types. A Calendar page will use Calendar.ss, for instance.

    However, these templates all use inheritance and overrides to make the design fully customizable for you. For instance, if your calendar page requires its own wrapper for some reason -- maybe it looks totally different than the rest of the site -- you can create Calendar.ss in the root templates/ directory and include the doctype, main nav, etc as part of that template.

    The template parser (SSViewer) will also "fall back" on the most logical choice for a template if one is not found. If you have a Calendar page type and no Layout/Calendar.ss exists, it will fall back on Layout/Page.ss because the Calendar object is a subclass of Page.

    Further, if you have a module installed, e.g. EventCalendar, SSViewer will always look in your theme directory first for the template, and then fallback on the module. To create a custom template for EventCalendar, for instance, you would copy the file /event_calendar/templates/Layout/Calendar.ss to /your_theme_dir/templates/Layout and make the changes you want. That way, you can safely upgrade the module when new releases come out and have the peace of mind that you have insulated all of your customizations.

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.