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.

Blog Module /

Discuss the Blog Module.

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

Rename Blog SideBar headings


Go to End


1526 Views

Avatar
stumck

Community Member, 9 Posts

11 August 2016 at 1:58pm

Hi there I have a Technical Issue I am trying to solve.
We have a website using Silverstripe v3.4 CMS.
We have installed the blog module and are using it on two pages. ‘News’ and ‘Projects’.
On the Projects page only we want to change the headings on the Blog Tag Widget and Blog Categories Widget.
From ‘Categories’ to ‘Facility Type’ and ‘Tags’ to ‘Location’.
The widget headings are located in the WidgetHolder.SS file below. In $Title variable

<div class="WidgetHolder $ClassName<% if FirstLast %> $FirstLast<% end_if %>">
<% if Title %><h3>$Title</h3><% end_if %>
$Content
</div>

What I was tiring to do was to have a If statement in the WidgetHolder.ss file to override the $Title variable.
But my problem is I can’t access the default page placeholder $Title variable which would tell me I am on the Projects page.

Cheers Stuart

Hi Stuart,

As suggested on the phone, you could try extending the Blog pagetype, calling the new one something like ProjectBlog, and configure the Projects page to use this new pagetype. You will then be able to use the $ClassName variable to determine whether you are on a ProjectBlog page or not. Here’s a quick example of how to extend the Blog pagetype (put this in a new file named something along the lines of mysite/code/ProjectBlog.php):

<?php

class ProjectBlog extends Blog { }

class ProjectBlog_Controller extends Blog_Controller { }

I hope this helps!

Thanks,
Garion

Garion Herman | Support Developer
SilverStripe
http://silverstripe.com/

I have created a new ProjectsBlog page type ok.
But I am a bit confused on where to use the $ClassName variable that Garion has suggested. I tried using it in the WidgetHolder.SS file.
It will display in my page sidebar the text words 'BlogCaegoriesWidget' for Categories and 'BlogTagsWidget' for Tags

Can anyone help please
Stuart