I'm sure this has been covered before but I cannot seem to find a solution for my problem.
I have followed the tutorials over at Umbraco.TV regarding adding custom sections and trees and I got the section part right. However, the tree I want to create is not shown. Only the top node with no child nodes is displayed.
Here is the code I am using to add a single test node to the tree:
namespace BAS { public class loadBAS : BaseTree { public loadBAS(string application) : base(application) { }
I'm getting this too; I copied the code exactly from a site I got it working on, and the new site is not showing anything but the top level node. I remember having difficulty with this but I can't remember what I did, annoyingly. Any pointers?
The treeHandlerType in the one that works has no namespace part, oddly. However it doesn't work either way in the new site - either with just the type name or a namespace qualified typename. How is the type loaded?
For some obscure reason when I went to work on this today it had started working. Web server not restarted. App was restarted but then it should have been when I copied the tree handler DLLs in anway, so no idea what got it working.
I am using Umbraco 4.6.1. Did you guys manage to translate the section labels? Instead of hardcoding the label titles in the code, I would like to get access the Umbraco dictionary. My current code tries to access dicitonary items in english) this way:
But all my section tree labels are empty.Some posts mention to use:
conf.Text = new umbraco.cms.businesslogic.Dictionary.DictionaryItem("onlinequestion.configure").Value(0);
but this results in compilation errors. Any ideas on how to do this? Or should I not go with dictionary items, but with a resource file or another way?
Woo! I think I have it, by jingo! Either that, or it's working completely coincidentally.
Did a bit of devling through the code, and found the class umbraco.cms.presentation.Trees.TreeDefinitionCollection which registers all of your app trees.
This contains the code:
//find the Application tree's who's combination of assembly name and tree type is equal to //the Type that was found's full name. //Since a tree can exist in multiple applications we'll need to register them all. List<ApplicationTree> appTreesForType = appTrees.FindAll( delegate(ApplicationTree tree) { return (string.Format("{0}.{1}", tree.AssemblyName, tree.Type) == type.FullName); } );
Which looked odd to me; you wouldn't create a fully qualified type / assembly name like that, and Type.FullName doesn't include the assembly anyway; this implies that in umbracoAppTree, what is stored in treeHandlerAssembly is actually the namespace of the type, and treeHandlertype is the simple type name.
So, my tree type is MyProject.Umbraco.MyProjectTree, in assembly MyProject.
treeHandlertype = MyProjectTree (simple type name)
You don't need to put the assembly in anywhere.
The reason I was getting odd results before was that my namespace and assembly names were identical on the site that worked; and I suspect that I was messing around with the namespace names in despair for the one that seemed to start workign suddenly.
This now all works for me, but I haven't gone into the Umbraco core in massive depth, so if a dev could confirm this, that'd be cool :o)
I have namespace MyProject.Umbraco and class ProApp within it. It is what I have put into umbracoAppTree table for treeHandlerAssembly and treeHandlerType respectively.
Custom tree in custom section not working
Hi,
I'm sure this has been covered before but I cannot seem to find a solution for my problem.
I have followed the tutorials over at Umbraco.TV regarding adding custom sections and trees and I got the section part right. However, the tree I want to create is not shown. Only the top node with no child nodes is displayed.
Here is the code I am using to add a single test node to the tree:
And I added the following line to the umbracoAppTreeTable:
But it just won't work. Can someone please point me in the right direction?
Thanks!
I'm getting this too; I copied the code exactly from a site I got it working on, and the new site is not showing anything but the top level node. I remember having difficulty with this but I can't remember what I did, annoyingly. Any pointers?
The treeHandlerType in the one that works has no namespace part, oddly. However it doesn't work either way in the new site - either with just the type name or a namespace qualified typename. How is the type loaded?
For some obscure reason when I went to work on this today it had started working. Web server not restarted. App was restarted but then it should have been when I copied the tree handler DLLs in anway, so no idea what got it working.
I am using Umbraco 4.6.1. Did you guys manage to translate the section labels? Instead of hardcoding the label titles in the code, I would like to get access the Umbraco dictionary. My current code tries to access dicitonary items in english) this way:
But all my section tree labels are empty.Some posts mention to use:
but this results in compilation errors. Any ideas on how to do this? Or should I not go with dictionary items, but with a resource file or another way?
Thanks,
Jaco
Never used the dictionary, sorry!
Oh my God, now it's doing it on another site, and this time it hasn't fixed itself, anyone got any ideas?
Woo! I think I have it, by jingo! Either that, or it's working completely coincidentally.
Did a bit of devling through the code, and found the class umbraco.cms.presentation.Trees.TreeDefinitionCollection which registers all of your app trees.
This contains the code:
I have the same problem.
I have namespace MyProject.Umbraco and class ProApp within it. It is what I have put into umbracoAppTree table for treeHandlerAssembly and treeHandlerType respectively.
I have added relevant data to umbracoApp and umbracoUser2app as well followinng tutorial on http://www.geckonewmedia.com/blog/2009/8/3/how-to-create-a-custom-section-in-umbraco-4
And it's still not working for me.
Not sure what else to do :(
Ok.
I have managed to make it working based on this sample: http://www.nibble.be/?p=71
Still not sure what was wrong with the other one though because looking at the code they look similar.
Comment author was deleted
@Rob Watkins, Dude you helped me out thx!
is working on a reply...