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.

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   1681 Views

Avatar
rohitbanerjee

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.

Avatar
rohitbanerjee

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??