Hi!
I found a snippet of some code of how to create a new Tree/BaseTree..
However.. I know that if you create a new section in Umbraco, umbraco then automatically adds the new section to the applications.config.. this BaseTree implementation didnt add anything to the trees.config.. so Im not quite sure if Im doing this the right way... also after manually manipulating the trees.config it seems like umbraco for some reason have created a context menu for me containing a create-action...
This is my current code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Xml;
using umbraco.BusinessLogic.Actions;
using umbraco.cms.presentation.Trees;
using umbraco.interfaces;
using Umbraco.Core;
using Umbraco.Web.Trees;
namespace Site
{
[Tree(Constants.Applications.Developer, "udev", "UDev")]
public class loadUDev : BaseTree
{
public loadUDev(string application)
: base(application)
{ }
protected override void CreateRootNode(ref XmlTreeNode rootNode)
{
rootNode.Icon = FolderIcon;
rootNode.OpenIcon = FolderIconOpen;
rootNode.NodeType = TreeAlias;
rootNode.NodeID = "-1";
}
public override void RenderJS(ref StringBuilder Javascript)
{
}
public override void Render(ref XmlTree tree)
{
}
}
}
I guess I should mention that Im using Umbraco 7... but Im quite sure the approach for this is the same for 6 and 7 so all input is more than welcome!
Hi!
Yeah.. already checked that.. however.. it seems like the built project already contains a full-blown trees.config.. so maybe its not even supposed to be built up dynamically?.. can anyone confirm that?
The problem is not that the new tree isnt displayed.. its is displayed and works great, the problem is that I manually have to add the
Hi again!
Just copy pasted your code above to try it out.. and it doesn't seems to work in Umbraco v7 :(
I added it in a an referenced assembly.. might that cause any problems?
As far as my guess goes I would say that it shouldn't matter if HQ has done their part :)
How to create a custom BaseTree-tree?
Hi! I found a snippet of some code of how to create a new Tree/BaseTree.. However.. I know that if you create a new section in Umbraco, umbraco then automatically adds the new section to the applications.config.. this BaseTree implementation didnt add anything to the trees.config.. so Im not quite sure if Im doing this the right way... also after manually manipulating the trees.config it seems like umbraco for some reason have created a context menu for me containing a create-action...
This is my current code:
I guess I should mention that Im using Umbraco 7... but Im quite sure the approach for this is the same for 6 and 7 so all input is more than welcome!
Br, Inx
You should change as follow:
Hope it work
Hi! Thanks for the reply, Still seems like umbraco wont add my new tree to the trees.config :(.. I still have to do that manually :(..
You should restart your application pool to check it work or not.
For sure, let download their source code & find how did they do it: https://codeload.github.com/umbraco/Umbraco-CMS/zip/release-7.0.0
Good luck
Hi! Yeah.. already checked that.. however.. it seems like the built project already contains a full-blown trees.config.. so maybe its not even supposed to be built up dynamically?.. can anyone confirm that?
The problem is not that the new tree isnt displayed.. its is displayed and works great, the problem is that I manually have to add the
Br, Inx
In my project, I can add my custom tree via code. And I'm sure the tree is built up dynamically. But about tree.config. I don't see any change
Hi again! Just copy pasted your code above to try it out.. and it doesn't seems to work in Umbraco v7 :( I added it in a an referenced assembly.. might that cause any problems? As far as my guess goes I would say that it shouldn't matter if HQ has done their part :)
is working on a reply...