SSbits - Home page
Site by Carbon Crayon
Submit a Post >

Snippets - Little bits of code to make you happy

Spice up Your CMS Sitetree

SSBsitetreeicons

So you have created your own page types, but they all look the same in your CMS site tree. Time to make them more recognizable! This is quite easy, but it can make your site tree a lot more attractive.

First grab some icons, buy them or create you own custom aesthetic icon set. They only thing you have to keep in mind, is that your icons need to be saved as youriconname-file.gif.

Next create a folder in mysite, like /images/icons, to store your icons.

To assign a icon to your page class, add the a static $icon var to your page class like.

MyCustomPage.php

class MyCustomPage extends Page {
 
    static $icon = 'mysite/images/icons/mycustomicon';
}

See that I don't add -file.gif to it. This is actually not necessary.

You can also specify a particular class's icon from your _config file:

_config.php

RedirectorPage::$icon = array('mysite/images/icons/redirector',"file");

 

Now go to your your CMS admin and see the result.

Martijn van Nieuwenhoven avatar

Martijn van Nieuwenhoven

Martijn van Nieuwenhoven is a freelance Silverstripe developer based in the Netherlands and runs the largest Dutch Jobboard for Media, Marcom and Graphic related jobs.

  • Chris Hope
    15/10/2010 2:26am (4 years ago)

    I generally use the famfam icons which are all png. However, I've found if you rename them with a .gif extension (which is what SS is expecting) then they're still rendered in the browser, even though they're actually pngs. I've checked in various browsers and versions and all work OK.

  • MRKDevelopment
    21/11/2010 2:59pm (4 years ago)

    you can always do a bulk conversion using an image editor if you need to convert the fam fam icons. I use Fireworks for this as it is my favorite graphics program.

    You might also be able to use smush.it from yahoo but I havent checked.

    the famfamfam site for thise looking is here: http://www.famfamfam.com

  • Darren-Lee
    09/04/2011 1:15pm (3 years ago)

    Great tips all of you! Recently, I've been using this a lot to spice the SiteTree for my clients - and they love it! I've also used icons from here: http://www.iconfinder.com

Post a comment ...

You cannot post comments until you have logged in. Login Here.

Advertisement

Site of the Month

Find SSbits on

Top Contributers

Rank Avatar Name
1 article image Aram Balakjian
2 article image Daniel Hensby
3 article image Marcus Dalgren
4 article image Hamish Campbell
5 article image Ty Barho
6 article image Martijn van Nieuwenhoven
7 article image Darren-Lee
8 article image Roman Schmid
9 article image Matt Clegg
10 article image dalesaurus

View full leaderboard


Advertisement