Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » different template per page

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1266 Views
  • itlinux
    Avatar
    Community Member
    40 Posts

    different template per page Link to this post

    Hello I wonder if there is a way to have a separate template per page or category

    Thanks

  • Nivanka
    Avatar
    Community Member
    395 Posts

    Re: different template per page Link to this post

    this can be done easily, create different page types,

    lets say my page type is DefaultPage so I am going to save my page in the /mysite/code folder

    now to have a separate leyout from the others I am creating a new template for the DefaultPage and save it as DefaultPage.ss in the /mysite/templates folder.

    Then when the site is being retrieved the DefaultPages are viewed with that Default.ss file you created not with the /themes/<your theme>/templates/Page.ss

  • itlinux
    Avatar
    Community Member
    40 Posts

    Re: different template per page Link to this post

    Thanks, where do you set the page type.

  • Liam
    Avatar
    Community Member
    470 Posts

    Re: different template per page Link to this post

    Generally in the mysite/code/ directory.

    I'd suggest reading the tutorial which gives an introduction to this:

    http://doc.silverstripe.com/doku.php?id=tutorial:2-extending-a-basic-site

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: different template per page Link to this post

    An upcoming feature in 2.4 will be the ability to select a custom template without a page type which will be quite handy for those pages which don't 'need' any custom code just a separate template. There is a ticket on open.silverstripe.com for this.

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