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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Only show content on some pages


Go to End


3 Posts   1882 Views

Avatar
raamklaza

Community Member, 182 Posts

14 July 2009 at 10:47pm

Hello,

i want to add a section for commercial banners on a website.

I want this banner to be shown on some pages but not all.

How can i arrange this? Can i do this in the .ss file? Like
if page != home {
fkjjfjfdjfgdgf
}
endif

Avatar
Willr

Forum Moderator, 5523 Posts

15 July 2009 at 9:21am

You can use the URLSegment, ClassName, Title, or anyother identifier. I personally always have a HomePage.php page type so I prefer to use classname but your could use urlsegment. Negation is not supported currently by SS so you have to do a bit of a work around

<!-- based on classname -->

<% if ClassName = HomePage %><% else %> <!-- DO SOMETHING --> <% end_if %>

<!-- based on url -->

<% if URLSegment = home %><% else %> <!-- DO SOMETHING --> <% end_if %>

For a list of template actions see http://doc.silverstripe.com/doku.php?id=built-in-page-controls

Avatar
raamklaza

Community Member, 182 Posts

15 July 2009 at 9:31am

Thnx willr!