Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

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

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

How do I get the page type from the templatesystem?


Go to End


2 Posts   2262 Views

Avatar
saimo

Community Member, 67 Posts

23 May 2008 at 6:03am

On my site I have a menu which is similar to a tree, which expands the nodes down to one level deeper than the current page. This is working fine, however, I don't want to show the children of a BlogHolder. Is this possible using only templating or do I have to subclass and override BlogHolder::Children (I'm using children for the menu)?

Avatar
Hamish

Community Member, 712 Posts

23 May 2008 at 3:10pm

Use the tag "ClassName"

Ie, if you put $ClassName in your template you'll see the page type.

Or, to display the menu conditionally:

<% if ClassName != BlogHolder %>

<!-- your menu here -->

<% end_if %>