Jump to:

23379 Posts in 18298 Topics by 2867 members

General Questions

SilverStripe Forums » General Questions » Includes or Sidebars based on page name

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: 645 Views
  • edwardlewis
    Avatar
    Community Member
    32 Posts

    Includes or Sidebars based on page name Link to this post

    Hey everyone.. I'm fairly new to Silverstripe but have used it to create a few websites so far.

    I have searched Google and on the forum but I havent really found an answer.

    Is is possible? or how is it possible to specify include files based on page name?

    This may not be the best way to solve the problem I have though, it may be best solved by adding a secondary editable section on each page.

    I'm trying to add an icon to the right hand side of each page on a website which relates to the specific service the client offers. At the moment the image has a class on it which floats it right, but the client has requested that the text does not flow around it, they want it to be all justified and stop short of the graphic.

    Thanks in advance for any help )

  • sajok
    Avatar
    Community Member
    82 Posts

    Re: Includes or Sidebars based on page name Link to this post

    Tutorials 2 explains how you can extend your page

    you can extend page with ex: ClientPage.php which contains a new image field ( your service icon). Now when you create an ClientPage type in the admin, you can create ClientPages with an option to include an icon. You can then put a call the icon in ClientPage.ss

    hope that works for you

  • Ryan M.
    Avatar
    Community Member
    309 Posts

    Re: Includes or Sidebars based on page name Link to this post

    If you were looking to do this in the templates:

    <% if ClassName = PageClass %>place your image or css class here<% end_if %>

    or

    <% if URLSegment = url-segment %>place your image or css class here<% end_if %>

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