Jump to:

22978 Posts in 11759 Topics by 2827 members

General Questions

SilverStripe Forums » General Questions » What type of page am I?

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 529 Views
  • sebastiankozub
    Avatar
    Community Member
    40 Posts

    What type of page am I? Link to this post

    Hi,

    Is there a way to check in Page.ss template what page is displayed? or what type of page is displayed, for example HomePage etc.

    I'm looking for somethink like <% if Homepage %>

    I don't want to change whole template system for one little change on HomePage.
    Because this change is in header so I have to do it in main - Page.ss template.

    Thanks

  • lerni
    Avatar
    Community Member
    80 Posts

    Re: What type of page am I? Link to this post

    hi

    <% if ClassName == HomePage %> $ClassName <% end_if %>

    luk

  • banal
    Avatar
    Community Member
    901 Posts

    Re: What type of page am I? Link to this post

    The equality operator in templates is just =, not ==. Therefore it should be:

    <% if ClassName = HomePage %> $ClassName <% end_if %>

  • Ryan M.
    Avatar
    Community Member
    309 Posts

    Re: What type of page am I? Link to this post

    You can also use this if you're trying to target a particular page:

    <% if URLSegment = page-url %>do something here...<% else %>or something else here...<% end_if %>

  • sebastiankozub
    Avatar
    Community Member
    40 Posts

    Re: What type of page am I? Link to this post

    Thanks for every replay, it looks works fine

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