Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bex 444 posts 555 karma points
    Mar 07, 2011 @ 15:58
    Bex
    0

    Help! All Templates vanished, deleted something I shouldn't!

    Hello!

    Ok, I need someone who knows the umbraco database..

    Here's what happened;

    I tried creating a new template called "Product" and it told me one already existed but it created it calling it's self as "Product1".

    I tried to find the exisiting template called "Product" but compeltely missed it (duh!) so renamed my "Product1" to "Product" (both name and alias). Then it threw an error "Key already exists" but saved it, I then noticed I had two templates called "Product" listed in the tree.

    My existing page linked to the "Product" template lost it's reference to it.
    I thought I'd be able to fix it by creating a new template again called "Product1" as this name no longer existed and relink it, but it threw the "Key already exists" error again but created it anyway!

    My final hope (or so I thought) was to go into the DB and find the extra templates and delete them.. so I went into "cmsTemplate" and deleted 2 extra ones.

    Now all my templates have vanished from the tree!!!

    So ok, I know I really shouldn't have done this but I though It'd work! 

    Luckily this isn't a live site, but I have no backup and it's going to take me ages to recreate it all! 

    Can someone help me put it right!

    Thanks so much!

     

    Bex

     

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Mar 07, 2011 @ 16:35
    Ismail Mayat
    0

    bex,

    I had similar issue recently client had deleted a master template.  Can you do a sql select query in the cmstemplates table and paste the results also can you paste list of templates you have in your templates dir.  It probably needs some fiddling for one of the missing parents and that should get your templates loading again.

    Regards

    Ismail

  • Bex 444 posts 555 karma points
    Mar 07, 2011 @ 16:44
    Bex
    0

    It wont let me post my reply.. or it's not showing!

  • Bex 444 posts 555 karma points
    Mar 07, 2011 @ 16:45
    Bex
    0

    Ok template rows from templates table are: (assume you don't need to see the design column?)

     

    1 1045 1049 umbBlogDatefolder

    2 1046 1049 umbBlogpost

    3 1047 NULL CommentRss

    4 1048 NULL Rss

    5 1049 NULL umbMaster

    6 1050 1049 umbTextpage

    7 1051 1049 umbHomepage

    8 1077 1049 Home

    9 1080 1049 Shop

    11 1083 1049 Cart

    12 1084 1049 Frontpage

    13 1085 1049 MainMaster

    14 1086 1049 Page

    15 1087 NULL Product

    16 1088 1049 ProductList

     

    Templates in folder

    Same as above but also 

    P
    Product1
    ProductPage (forgot I tried calling it this too...)
    Test (two i tried testing and then stupidly also deleted from DB)
    test1

     

    Can you help with these?

    Thanks so much!

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Mar 07, 2011 @ 16:55
    Ismail Mayat
    0

    try updating the db table so that for Product the parent id is 1049.

    Regards

    Ismail

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Mar 07, 2011 @ 16:56
    Ismail Mayat
    0

    Ps after doing that touch the web.config (open it in editor and put space or press return so that we get rebuild) as the template list in the tree is cached.

    Regards

    Ismail

  • Bex 444 posts 555 karma points
    Mar 07, 2011 @ 17:06
    Bex
    0

    Hi Ismail!

    I changed the "Master" Id (assume thats what you meant) but it made no different!

    I touched the webconfig.. even restarted my machine for good measure but still doesn't show my templates.

    if it helps when I try adding a template I get an error:

    Object reference not set to an instance of an object.

    [NullReferenceException: Object reference not set to an instance of an object.] umbraco.cms.businesslogic.template.Template.get_MasterPageFile() +37 umbraco.cms.businesslogic.template.Template.getMasterPageContent() +14 umbraco.cms.businesslogic.template.Template.setupNode() +201 umbraco.cms.businesslogic.CMSNode..ctor(Guid uniqueID) +175 umbraco.cms.businesslogic.template.Template.GetAllAsList() +215 umbraco.cms.presentation.settings.editTemplate.Page_Load(Object sender, EventArgs e) +195 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35 System.Web.UI.Control.OnLoad(EventArgs e) +91 umbraco.BasePages.BasePage.OnLoad(EventArgs e) +14 System.Web.UI.Control.LoadRecursive() +74 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint

    Do you know what the realtionsships are in the Db so I can try working through them to wrok out whats going on?
    Or do you have anoher suggestion?

    Thanks

    Bex

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Mar 07, 2011 @ 17:09
    Ismail Mayat
    0

    bex,

    the error is that new i.e. it started happening after the db change you just made or was it already occuring? also what version of umbraco are you using?

    Regards

    Ismail

  • Bex 444 posts 555 karma points
    Mar 07, 2011 @ 17:10
    Bex
    0

    No the error was happening before.. should have said!

    I am using 4.6.1.

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Mar 07, 2011 @ 17:39
    Ismail Mayat
    0

    try creating manually in the templates directory template called Product.Master if not already there see if that fixes the problem if fact make all the templates in table have corresponding file.

    Regards

    Ismail

  • Bex 444 posts 555 karma points
    Mar 07, 2011 @ 17:42
    Bex
    0

    I have the opposite problem! I have more template files than templates listed in the database!

    I've been trying to find the source for 4.6.1 so I can debug it but can't seem to find it! Think I'm going to start over at the rate :((((

  • Bex 444 posts 555 karma points
    Mar 07, 2011 @ 17:54
    Bex
    0

    I FIXED IT! YAAAAAAAAAAAAAAAAAAAAAAAAAAAAY!

    All but given up hope and came across this post:

    http://our.umbraco.org/forum/core/general/14341-Make-mistake-in-SQL-Database

    All I need to do was delete the offending row(s) from the umbracoNode table and all my templates reappeared!

    Thanks for all your help Ismail!

  • Kims 25 posts 34 karma points
    Jun 27, 2011 @ 04:19
    Kims
    0

    Hi Bex,

    How did you know which row(s) was the offending one?

    I'm having a similar problem where my templates are lost and doc types are spitting out that same error as yours after upgrading from 4.0.4.2 to 4.5.2.

    Thanks

    Kim

Please Sign in or register to post replies

Write your reply to:

Draft