Jump to:

3447 Posts in 1032 Topics by 872 members

Template Questions

SilverStripe Forums » Template Questions » Template <% include %>

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

Page: 1
Go to End
Author Topic: 449 Views
  • Mackodlak
    Avatar
    Community Member
    95 Posts

    Template <% include %> Link to this post

    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?

  • Devlin
    Avatar
    Community Member
    215 Posts

    Re: Template <% include %> Link to this post

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

  • simon_w
    Avatar
    Forum Moderator
    474 Posts

    Re: Template <% include %> Link to this post

    Assuming your forum's URLSegment is forum:

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

  • Mackodlak
    Avatar
    Community Member
    95 Posts

    Re: Template <% include %> Link to this post

    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

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