Jump to:

1030 Posts in 805 Topics by 311 members

Forum Module

SilverStripe Forums » Forum Module » Special Template for ForumHolder

Discuss the Forum Module.

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

Page: 1
Go to End
Author Topic: 624 Views
  • DeklinKelly
    Avatar
    Community Member
    197 Posts

    Special Template for ForumHolder Link to this post

    I want to use a special template named "ForumHolderFeed.ss" if the get paramager ?feed=1 is passed.

    For example, this should be rendered with ForumHolderFeed.ss:
    http://www.example.com/forums/?feed=1

    I tried modifying ForumHolder.php, as shown below however that does not render the data in my template.

  • simon_w
    Avatar
    Forum Moderator
    471 Posts

    Re: Special Template for ForumHolder Link to this post

    This is usually done using actions, so http://example.com/forums/feed would use the ForumHolder_feed.ss template file.

    Getting it to consistently use ForumHolderFeed.ss for a specific get switch takes a lot more effort that most people realise. You can get it working in some cases by adding the check to an index() method, and returning $this->renderWith('ForumHolderFeed.ss'), though that won't work as soon as someone tries it on an action.

  • DeklinKelly
    Avatar
    Community Member
    197 Posts

    Re: Special Template for ForumHolder Link to this post

    Thanks, simon_w for your reply.

    How can I do this with an action? Do you have some sample code I could use or a link to documentation?

  • simon_w
    Avatar
    Forum Moderator
    471 Posts

    Re: Special Template for ForumHolder Link to this post

    The only thing you may need to do is add the action to the $allowed_actions array. SilverStripe looks for ClassName_action.ss first when deciding which template to use.

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