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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page Type Dropdown


Go to End


6 Posts   4090 Views

Avatar
JoshuaLewis

Community Member, 81 Posts

1 September 2009 at 11:45am

Edited: 04/09/2009 2:21am

I have several questions :

The names that appear in the option box when creating a new page are based on the class name. This creates a problem when names that would mean something to someone working in the CMS aren't so useful to a developer maintaining the code. I found one solution in an archived thread and was curious to hear if anyone has alternative/better solutions.
http://silverstripe.org/archive/show/130387#post130387

The ability to designate custom icons to be shown beside pages in the site tree is great for usability. This would be even better if those icons also showed up beside their respective page types in the dropdown box. Has this come up before and does anyone done it?
Edit - http://open.silverstripe.org/ticket/4540

Another usability issue is that there doesn't seem to be a way to organize items in the list. Any more than 5 or so custom page types and grouping can start to have a real benefit so does anyone know of a way to make this happen?
Edit - http://open.silverstripe.com/ticket/4541

Has anyone figured out how to control what page types are shown depending on what page is highlighted in the site tree? Going along with that idea, am I crazy to think that an $allowed_parent setting would be as useful as $allowed_children is?

Avatar
Hamish

Community Member, 712 Posts

1 September 2009 at 4:14pm

The names that appear in the option box when creating a new page are based on the class name. This creates a problem when names that would mean something to someone working in the CMS aren't so useful to a developer maintaining the code. I found one solution in an archived thread and was curious to hear if anyone has alternative/better solutions.
http://silverstripe.org/archive/show/130387#post130387

Set the 'nice' name with:

<?php
class MyCrazyPageName extends Page {

	static $singular_name = "Nice Page";

	static $plural_name = "Nice Pages"

	...

The ability to designate custom icons to be shown beside pages in the site tree is great for usability. This would be even better if those icons also showed up beside their respective page types in the dropdown box. Has this come up before and does anyone done it?

Don't think so, but bare in mind that this means you can't use a standard html select element. You would have to employ some sort of javascript select script, which means more overhead and a slower experience in general. Not a bad idea though. Worth looking at once the latest round of improvements (mostly javascript related) are complete.

Another usability issue is that there doesn't seem to be a way to organize items in the list. Any more than 5 or so custom page types and grouping can start to have a real benefit so does anyone know of a way to make this happen?

Good point. I'm not aware of a way, although you could name them as above so you get the sorting you want.

Has anyone figured out how to control what page types are shown depending on what page is highlighted in the site tree? Going along with that idea, am I crazy to think that an $allowed_parent setting would be as useful as $allowed_children is?

Hmm, that is getting into some quick fine-grained control.

You should submit these are feature requests to the bug tracker at:

http://open.silverstripe.com

Avatar
JoshuaLewis

Community Member, 81 Posts

1 September 2009 at 6:26pm

Thanks Hamish. I'm surprised I haven't come across $singular_name and $plural_name before. After searching the documentation and forums for those specific names though I only found a handful of references, none of them very informative.

I did some playing around earlier with placing icons and it can be done without javascript by setting them as background images using CSS. This would probably mean having the function creating the dropdown place the CSS as style attributes in the <option> elements.

I'll look into submitting those tickets.

Avatar
Martijn

Community Member, 271 Posts

3 September 2009 at 10:57am

@ Hamish:

I can't remember where I read it, but aint static singular and plural name vars deprecated and shoudn't we use singular and pluralname in our language files?

@JoshuaLewis :

$allowed_children does limit the pagetypes in the dropdownmenu?

Avatar
JoshuaLewis

Community Member, 81 Posts

3 September 2009 at 11:30am

Martijn, that's true but there may be some cases where being able to write an $allowed_parent rule in one file would be more simple and easier to maintain than setting $allowed_children on everything else.

Avatar
AlexBeka

Community Member, 21 Posts

8 October 2009 at 1:57am

Edited: 08/10/2009 3:14am

if someone is interested in having icons in the dropdown menu, just put the following code into cms/css/layout.css; but unfortunately the images are just shown in Firefox browser, not in IE, Chrome, Opera...; Testpage for styling single selection menu control options (option elements) with CSS

#PageType option, #ClassName option {
	padding-left: 18px;
	height: 16px; /*height of tree icon files*/
}
	#PageType option[value=Page], #ClassName option[value=Page] {
		background: url(../../jsparty/tree/images/page-file.gif) no-repeat;	
	}
	#PageType option[value=PageWithBanner], #ClassName option[value=PageWithBanner] {
		background: url(../../themes/dummytheme/images/treeicons/PageWithBanner-file.gif) no-repeat;	
	}
	#PageType option[value=RedirectorPage], #ClassName option[value=RedirectorPage] {
		background: url(../../cms/images/treeicons/page-shortcut-file.gif) no-repeat;	
	}
	#PageType option[value=VirtualPage], #ClassName option[value=VirtualPage] {
		background: url(../../cms/images/treeicons/page-shortcut-gold-file.gif) no-repeat;	
	}
	#PageType option[value=ErrorPage], #ClassName option[value=ErrorPage] {
		background: url(../../cms/images/treeicons/errorpage-file.gif) no-repeat;	
	}