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.

Customising the CMS

Changing Tree Icons for Error Pages


Reply

6 Posts   2214 Views

Avatar
DanStephenson

17 February 2009 at 9:13pm Community Member, 115 Posts

Hello,

Since I don't have a code page for Error Pages, is there a way to change their tree icons?

Avatar
ambient

17 June 2011 at 1:58am Community Member, 123 Posts

Did you ever figure this one out Dan?

I've tried by changing this line:

static $icon = array("sapphire/javascript/tree/images/page", "file");

to

static $icon = array("sapphire/javascript/tree/images/page", "error");

in sapphire\core\model\ErrorPage.php

I added page-error.gif and png to the sapphire\javascript\tree\images folder but it still displays the original page-file icon.

Whats weird is if I remove the line of code from the page then the error page icons disappear.

Any ideas??

Cheers :)

Avatar
rohitbanerjee

29 June 2011 at 1:26am Community Member, 7 Posts

Did you try doing this in the _config.php file?

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

It worked for me and this way you dont have to touch or modify your Error page php file.

Avatar
DanStephenson

23 September 2011 at 8:16am Community Member, 115 Posts

Much better solution! Thanks!

Avatar
Rossel

15 February 2014 at 7:41pm (Last edited: 17 February 2014 3:16pm), Community Member, 18 Posts

This no longer works for 3.1. how is it done now?

Edit:
I managed resolved this by extending my error & redirector pages.

<?php
class MyErrorPage extends ErrorPage {
// set new icon
private static $icon = 'mysite/images/icons/broken.png';
// remove old error page from list
private static $hide_ancestor = 'ErrorPage';

// set name and description to appear as before
private static $singular_name = 'Error Page';
private static $plural_name = 'Error Pages';
private static $description = 'Custom content for different error cases (e.g. "Page not found")';      
}

Avatar
RuthAdele

4 July 2014 at 12:02pm (Last edited: 4 July 2014 12:05pm), Community Member, 19 Posts

Hey Rossel, you now do this in the mysite/_config/config.yml file.
So it would be:

ErrorPage:
icon:
'mysite/images/icons/broken.png'

Note:
- there should be two spaces for each indentation. (2 in front of icon, and 4 in front of 'mysite... (formatting here is removing my preceeding spaces)
- also be sure not to have any other spaces or tabs after lines, as these will cause an error.