Hi All, I am new to extending Umbraco and I am specifically trying to add a new section to an Umbraco 7 installation. I have found some tutorials that mention running a snippet of code at Umbraco startup, which has lead me to the 'application startup' process, which I am also unfamiliar with.
From what I can gather, I need to add this code to my global.asax file, but whatever I write in there (be it from a tutorial or Umbraco documentation) I always get a server error with "The content in the application file is not valid." so I must be doing something wrong!
Thanks for the reply! I did find that tutorial as well but unfortunately for me it assumes that I know my way around the application startup process, which I don't! The following sentence from that article says the following:
The first thing I’ll need to do is to create a class that implements the IApplication-interface so that Umbraco will initialize this class on start up.
But how do I create this class? Where does it go etc...?
easiest way, if you don't know your way around creating a class library with c# and producing a dll, is to create a .cs file in the app_code folder which will get JIT compiled at runtime.
contents are something like this just to get the section added... (not fully tested, but should I think point you in the right direction...)
(CustomSection.cs)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using umbraco.businesslogic;
using umbraco.interfaces;
[Application("CustomSection", "CustomSection", "icon-car", 15)]
public class CustomSectionApplication : IApplication { }
I am trying to add a new section to an umbraco 7 installation using the SectionService.MakeNew, yes i can see that it adds a new entry to the application.config. but the section never appears in the backend when you log back in.
Am i missing a trick here????
Instead of using the application startup code to register the new section could i not just add it manually to the application.config?
If you add a a new record into the umbracoUser2App database table then the section appears. But is does not appear as an item in the edit user page until you manually add the record, surely if you add the new section then it should appear as a new unticked checkbox in the edit user page.
Did you enable the custom section for your User? If you go to Users > YourUser, your custom section is probably unticked! If that fails, maybe restart your application but I'm afraid I can't be of much more help!
Adding a new section with Application Startup
Hi All,
I am new to extending Umbraco and I am specifically trying to add a new section to an Umbraco 7 installation. I have found some tutorials that mention running a snippet of code at Umbraco startup, which has lead me to the 'application startup' process, which I am also unfamiliar with.
From what I can gather, I need to add this code to my global.asax file, but whatever I write in there (be it from a tutorial or Umbraco documentation) I always get a server error with "The content in the application file is not valid." so I must be doing something wrong!
Quick google and found this that might enlighten?
http://www.enkelmedia.se/blogg/2013/11/22/creating-custom-sections-in-umbraco-7-part-1.aspx
http://www.enkelmedia.se/blogg/2013/11/22/custom-sections-in-umbraco-7-%E2%80%93-part-2-the-views.aspx
Hi Mike,
Thanks for the reply! I did find that tutorial as well but unfortunately for me it assumes that I know my way around the application startup process, which I don't! The following sentence from that article says the following:
But how do I create this class? Where does it go etc...?
Many thanks,
pronto
easiest way, if you don't know your way around creating a class library with c# and producing a dll, is to create a .cs file in the app_code folder which will get JIT compiled at runtime.
contents are something like this just to get the section added... (not fully tested, but should I think point you in the right direction...)
(CustomSection.cs)
Hi Mike,
That's perfect, thanks a million! I might actually be able to follow that guide now, wish me luck!
pronto
Hi Folks,
I am trying to add a new section to an umbraco 7 installation using the SectionService.MakeNew, yes i can see that it adds a new entry to the application.config. but the section never appears in the backend when you log back in.
Am i missing a trick here????
Instead of using the application startup code to register the new section could i not just add it manually to the application.config?
Regards Darren
Hi Again,
If you add a a new record into the umbracoUser2App database table then the section appears. But is does not appear as an item in the edit user page until you manually add the record, surely if you add the new section then it should appear as a new unticked checkbox in the edit user page.
Regards Darren
Hi Darren,
Did you enable the custom section for your User? If you go to Users > YourUser, your custom section is probably unticked! If that fails, maybe restart your application but I'm afraid I can't be of much more help!
pronto
Hi Pronto,
The custom section was not visible, looked like it was a caching issue.
Cheers
I found other solution using code downloaded by webmatrix using the following steps.
Umbraco version: 7.5.4 1
steps:
is working on a reply...