Snippets - Little bits of code to make you happy
Spice up Your CMS Sitetree
Tweet27 August 2009 | | | Supports v2.4, v2.3
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.
3 Comments
RSS feed for comments on this page RSS feed for all comments
Chris Hope
15/10/2010 2:26am (3 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 (2 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 (2 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.