Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Page (Menu Item) And Menu Groups View modes: 
User avatar
Member
Member
robert-tailor.co - 8/14/2012 9:54:25 PM
   
Page (Menu Item) And Menu Groups
Hi,

I am trying to create a menu and submenu, and want to use the built in 'Menu Item' functionality rather than code my own.

Normally, to add a menu page item, you would select to create a new 'Page (menu item)' and the 'Form' section has a drop down list so you can choose which menu group you want the page to appear in.

So far so good.

Now let's say I add pages under that 'Page (menu item)' document, and these are all normal content pages, and so do not inherit the 'Page (menu item)' fields.

How can I later designate one of those pages to be a menu item and add it to a specified menu group?

The document type General tab has a field labelled 'Behaves as Page (menu item) type:', but this applies across all documents of that type. Should I leave this enabled by default 'just in case'? What are the potential drawbacks?

Also, how can I then specify which menu group I want the page item to appear in? Is it just a matter of adding my own MenuItemGroup custom field and filling it with identical options to those found in the 'Page (menu item)' group?

Thanks for any advice you can offer.

User avatar
Kentico Support
Kentico Support
kentico_janh - 8/15/2012 2:25:21 AM
   
RE:Page (Menu Item) And Menu Groups
Hello,

Let's make is more clear for me and let's say you have following document structure:

root document
-- page 1 (menu item)
---- document 1.1 (custom doc. type)
---- document 1.2 (custom doc. type)
-- page 2 (menu item)
---- document 2.1 (custom doc. type)
---- document 2.2 (custom doc. type)
-- page 3 (menu item)
---- document 3.1 (custom doc. type)
---- document 3.2 (custom doc. type)


And you want to generate a menu which displays menu items from first level of document hierarchy and your document types from second, right? If so, there are many ways how to do that (including your mentioned 'Behaves as Page (menu item) type' functionality):

1) You can specify document types to be rendered in the menu by setting the Document types property of a navigation web part and in combination with menu group (described below) for menu items, only appropriate children will be displayed

2) You can add a new field (MenuItemGroup) or set Inherits fields from document type as 'Page (menu item)' for your document type

3) You can take advantage of the WHERE condition property of a navigation web part and specify documents to be rendered in a menu

You need to specify the WHERE condition property anyway to display just those documents which has set the MenuItemGroup field to some value like:

MenuItemGroup = 'top' OR MenuItemGroup IS NULL


Best regards,
Jan Hermann

User avatar
Member
Member
robert-tailor.co - 8/16/2012 5:18:30 PM
   
RE:Page (Menu Item) And Menu Groups
kentico_janh wrote:
1) You can specify document types to be rendered in the menu by setting the Document types property of a navigation web part and in combination with menu group (described below) for menu items, only appropriate children will be displayed

2) You can add a new field (MenuItemGroup) or set Inherits fields from document type as 'Page (menu item)' for your document type

3) You can take advantage of the WHERE condition property of a navigation web part and specify documents to be rendered in a menu

You need to specify the WHERE condition property anyway to display just those documents which has set the MenuItemGroup field to some value like:

MenuItemGroup = 'top' OR MenuItemGroup IS NULL


Best regards,
Jan Hermann

Hi Jan,

Thanks for the advice. I'm going with option (3) and setting a custom field (ShowInMenu) for each of the documents that I want to include in the menu at the selected level in the CMS Tree. I can then use:

WhereCondition="ShowInMenu = 1"


But I have 2 questions:

1. Is it possible to set some kind of wildcard for the ClassNames (Document Types) property, so it will pick up all files of my custom document type(s)?
So, for example, if all my custom document types have a code name in the format "MyPage.[Something]", is it possible to set the ClassNames property to:

ClassNames="MyPage.*"


?

2. The CMSListMenu now expects every page in my ClassNames list to include the 'ShowInMenu' custom field. Is it possible to stop the page from giving a compile error if the ClassNames property includes pages that do not contain the Field 'ShowInMenu'?

Thanks!

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 8/19/2012 12:44:49 AM
   
RE:Page (Menu Item) And Menu Groups
Hi,

1. It is very easy to test it :-) Your example is correct, you can use the "*" as a wild card. However, this wild card cannot be the first character.

2. There is no setting for it and I thing that the easiest way is to add this field to required document types. If you do not want to have this field on the editing form, just set the default value for the field in the field editor and hide it from the editing form.

Best regards,
Juraj Ondrus

User avatar
Member
Member
robert-tailor.co - 8/19/2012 5:41:39 PM
   
RE:Page (Menu Item) And Menu Groups
kentico_jurajo wrote: Hi,

1. It is very easy to test it :-) Your example is correct, you can use the "*" as a wild card. However, this wild card cannot be the first character.

2. There is no setting for it and I thing that the easiest way is to add this field to required document types. If you do not want to have this field on the editing form, just set the default value for the field in the field editor and hide it from the editing form.

Best regards,
Juraj Ondrus

Cool. Thanks for all your help Juraj!