This might be my own fault, but in the Umbraco backoffice, when I try to go to the templates, they're no longer there...
They are available on disk and in the database, but not through the UI.
I've actually done some cleaning up in the database and I might've deleted a little too much. Specifically, I deleted two templates that were not in use.
How do I get Umbraco to recognize my templates again?
Also, when I try to edit a document type, I get the following exception, I do believe that this is due to the fact that there is something wrong with the templates:
Server Error in '/' Application.
Object reference not set to an instance of an object.
Description:
An unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the error and
where it originated in the code.
Exception Details:
System.NullReferenceException: Object reference not set to an instance of an
object.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
umbraco.cms.businesslogic.template.Template.get_MasterPageFile() +159
umbraco.cms.businesslogic.template.Template.getMasterPageContent() +29
umbraco.cms.businesslogic.template.Template.setupTemplate() +330
umbraco.cms.businesslogic.template.Template..ctor(Guid id) +45
umbraco.cms.businesslogic.template.Template.GetAllAsList() +255
umbraco.settings.EditContentTypeNew.bindTemplates() +324
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +24
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +41
System.Web.UI.Control.OnLoad(EventArgs e) +131
umbraco.BasePages.BasePage.OnLoad(EventArgs e) +20
System.Web.UI.Control.LoadRecursive() +65
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2427
Version Information: Microsoft .NET Framework Version:2.0.50727.4016;
ASP.NET Version:2.0.50727.4016
I just don't get why Umbraco is not able to build a list of templates any more. They're there on disk, when I change them, they change on the frontend.. I just can't list them in the backoffice any more.
How could I have broken some relations somewhere? What database tables should I be looking at? Or is something stored in a config file somewhere?
It's always good to triple-check the file permissions on the templates folder and all the files (including the main masterpage file under the /umbraco folder). If you've changed them by hand the ownership may have changed?
It's always possible the database is now a bit messed up... never a good idea to work in the db directly. But let's assume it isn't for the time being.
Be sure to save off the template files, just in case anything else happens :) Wouldn't want to lose them entirely.
A couple strange things you might try...
- re-create the deleted files (even if empty) so that anything being referenced can again be found
- check the event log to see if you can determine which file is having a problem
- any chance you have two templates with the same name?
That's it for ideas at the moment. Hopefully this will help or someone else will have more ideas. Worst case, restore from backups.
I just had this issue again after a long time. It definitely is due to deleting a template which is still referenced by a content node. This is very easy to do e.g. if you were making some test pages/templates one day.
The easiest way to fix this is to restore a prior backup.
The hard way is to manually track down the id of the deleted template that used to be in the cmsTemplates table. Thereafter you are best off restoring it with the correct alias and nodeIs in cmsTemplates. The pk field is autogenerated and doesn't seem to be used.
I believe this works - it did in my case but I am not 100% sure this alone was the solution.
My templates are gone.. :(
This might be my own fault, but in the Umbraco backoffice, when I try to go to the templates, they're no longer there...
They are available on disk and in the database, but not through the UI.
I've actually done some cleaning up in the database and I might've deleted a little too much. Specifically, I deleted two templates that were not in use.
How do I get Umbraco to recognize my templates again?
You could try rebuilding your index.
Go to data >> _systemUmbracoIndexDontDelete and delete out all the files within.
Then go to ~/umbraco/reindex.aspx
Thanks Chau, I did actually try that (should've mentioned it). No luck there :-)
Also, when I try to edit a document type, I get the following exception, I do believe that this is due to the fact that there is something wrong with the templates:
I just don't get why Umbraco is not able to build a list of templates any more. They're there on disk, when I change them, they change on the frontend.. I just can't list them in the backoffice any more.
How could I have broken some relations somewhere? What database tables should I be looking at? Or is something stored in a config file somewhere?
It's always good to triple-check the file permissions on the templates folder and all the files (including the main masterpage file under the /umbraco folder). If you've changed them by hand the ownership may have changed?
It's always possible the database is now a bit messed up... never a good idea to work in the db directly. But let's assume it isn't for the time being.
Be sure to save off the template files, just in case anything else happens :) Wouldn't want to lose them entirely.
A couple strange things you might try...
- re-create the deleted files (even if empty) so that anything being referenced can again be found
- check the event log to see if you can determine which file is having a problem
- any chance you have two templates with the same name?
That's it for ideas at the moment. Hopefully this will help or someone else will have more ideas. Worst case, restore from backups.
cheers,
doug.
I just had this issue again after a long time. It definitely is due to deleting a template which is still referenced by a content node. This is very easy to do e.g. if you were making some test pages/templates one day.
The easiest way to fix this is to restore a prior backup.
The hard way is to manually track down the id of the deleted template that used to be in the cmsTemplates table. Thereafter you are best off restoring it with the correct alias and nodeIs in cmsTemplates. The pk field is autogenerated and doesn't seem to be used.
I believe this works - it did in my case but I am not 100% sure this alone was the solution.
Hi all,
I've just come across this issue out of the blue - has anyone had any other solutions?
I've gone through all the suggested solutions above barring restoring (I have just completed a lot of work and don't wish to lose it all now)
Saying this - I haven't deleted any templates, which seems to be the suggested cause of this, and haven't been playing in the DB.
I was due to have a client meeting tomorrow, but it looks like I may have to delay this one :(
Never mind - I've just done a restore.... all working now... just the re-work to do :(
is working on a reply...