Adding a new/custom section to umbraco, sample project 1
Simon Justesen, has a great post describing how to add new sections and trees inside umbraco (part 1, part 2).
To make it easier to get started, I thought I would provide some starter sourcecode for a demo custom section.
You can download the sourcecode here
Steps to get this running on your umbraco installation:
- Copy the assembly (CustomUmbracoSection.dll) to the \bin directory
- Copy the file custom.gif to \umbraco\images\tray\ directory
- Make a ‘custom’ directory in \umbraco and copy the editCustom.aspx page to \umbraco\custom directory
- Insert a new row in the umbracoApp table
INSERT INTO [umbracoApp]
([sortOrder]
,[appAlias]
,[appIcon]
,[appName])
VALUES
(9
,‘custom’
,‘custom.gif’
,‘custom’)
- Insert a new row in to umbracoAppTree table
INSERT INTO [umbracoAppTree]
([treeSilent]
,[treeInitialize]
,[treeSortOrder]
,[appAlias]
,[treeAlias]
,[treeTitle]
,[treeIconClosed]
,[treeIconOpen]
,[treeHandlerAssembly]
,[treeHandlerType])
VALUES
(0
,1
,0
,‘custom’
,‘custom’
,‘custom’
,‘.sprTreeFolder’
,‘.sprTreeFolder_o’
,‘CustomUmbracoSection’
,‘Trees.LoadCustomTree’)
- Update the \umbraco\config\create\UI.xml file, add:
<nodeType alias=”initcustom”>
<header>Custom</header>
<usercontrol>/create/simple.ascx</usercontrol>
<tasks>
<create assembly=”CustomUmbracoSection” type=”Tasks.CustomTasks” />
<delete assembly=”CustomUmbracoSection” type=”Tasks.CustomTasks” />
</tasks>
</nodeType>
After these steps are completed you will have to enable the new section for your user.
Then it should show up as the last icon in the sections (called custom, with a HAL’s camera eye icon).
In the custom section you’ll find this:
So just a sample node that will open a demo edit page.
