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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

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

Assign unique custom icons to individual pages of the same page type

Go to End

2 Posts   1286 Views


Community Member, 7 Posts

2 June 2011 at 7:29pm

Using the following code in "mysite/_config.php"

ErrorPage::$icon = array('themes/rohitbanerjee-blocko/images/icons/error',"file");

I was successful in overriding the default icon for any page type, where I didn't want to change any original code, but simply customize it in my way, in my code base.

However, I was wondering if I could similarly assign unique icons to unique pages with the same PageType/Class, rather than unnecessarily creating separate PageType/Class just for the icons.

Lets say I have 2 pages "About Us" and "Services" with the same PageType "Page", then can I assign an icon in the following similar fashion for the 2 pages as below:

Page::->$SomeFunctionToIdentifyPageObject("About Us")->$icon = array('themes/rohitbanerjee-blocko/images/icons/about',"file");
Page::->$SomeFunctionToIdentifyPageObject("Services")->$icon = array('themes/rohitbanerjee-blocko/images/icons/services',"file");

provided I have the relevant icon image files in place.

Any help is immensely appreciated.


Community Member, 7 Posts

11 June 2011 at 4:05am

I'm sure this was not a stupid question. But nobody attempted to answer at all??