Jump to:

5450 Posts in 1672 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Assign unique custom icons to individual pages of the same page type

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

Page: 1
Go to End
Author Topic: 611 Views
  • rohitbanerjee
    Avatar
    Community Member
    7 Posts

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

    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.

  • rohitbanerjee
    Avatar
    Community Member
    7 Posts

    Re: Assign unique custom icons to individual pages of the same page type Link to this post

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

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