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.

Template Questions /

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

Template <% include %>


Go to End


4 Posts   1171 Views

Avatar
Mackodlak

Community Member, 95 Posts

7 October 2011 at 1:24am

Hey guys,

I have this issue, I have a Page.ss that every other page extends and it has all of the fetures and includes iwish to show on every page, except <% include breadcrumbs %> that i want to include in every page EXCEPT forum. Now, it's a bit frustrating, but I don't rly want it to be shown in forum and it is, on the other hand i don't want to remove the include from Page.ss and place it on every other page except forum. How do I block it from being included in forum?

Avatar
Devlin

Community Member, 344 Posts

7 October 2011 at 3:46am

If you are using the forum module, then simply delete "<p>$Breadcrumbs</p>" from Includes/ForumHeader.ss.

If your Page.ss in your root template folder contains this breadcrumb include, then copy this file, rename the copy to ForumHolder.ss and delete the include line from this file. Duplicate ForumHolder.ss again and rename it to Forum.ss. So now we have two new 'root' templates responsible for both ForumPage classes.

... Although it is probably a better idea to move this include from templates/Page.ss to the appropriate layout templates in tempate/Layout/.

Avatar
(deleted)

Community Member, 473 Posts

7 October 2011 at 8:14am

Assuming your forum's URLSegment is forum:

<% if InSection(forum) %><% else %>
	<% include breadcrumbs %>
<% end_if %>

Avatar
Mackodlak

Community Member, 95 Posts

7 October 2011 at 9:30pm

Thank you Simon, I've handeled it in a similar way. The thing is include shouldn't be moved to Layout pages cause there are like 20 different pages so it's better to leave it in a single place on Page.ss and just use the if clause to ban the pages you don't want to include it. I've done it with if ClassName!=Forum or sth similar