Copied to clipboard

Flag this post as spam?

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


  • Richard Walters 14 posts 51 karma points
    Aug 21, 2009 @ 16:58
    Richard Walters
    0

    Can't Save Templates

    New to Umbraco… loving it so far, but…

    While I can create Templates, I can't save them. When I click on the "Save" button, the message bubble says "Template Not Saved. Please make sure that you do not have 2 templates with the same alias". I can work around the template contents right now using an external editor, but can't change the settings (Name, Alias, Master Template).

    I've tried messing with permissions in the "/masterpages" directory (even giving "Full Control" to "Everyone") but that accomplished nothing.

    Any suggestions are greatly appreciated…

    Thank you!

    (Umbraco 4; ASP.NET 3.5; Win XP; IIS 6)

  • Bert 128 posts 251 karma points
    Aug 21, 2009 @ 17:51
    Bert
    0

    Can't help you, but you can still change the master templates, just change:

        <!--
            @page { margin: 2cm }
            P { margin-bottom: 0.21cm }
        -->
        

    <%@ Master Language="C#" MasterPageFile="/masterpages/yourMasterpage.master" AutoEventWireup="true" %>

  • Chris Koiak 700 posts 2626 karma points
    Aug 21, 2009 @ 17:58
    Chris Koiak
    0

    Can I confirm you don't have 2 templates or doctypes with the same alias?

  • Richard Walters 14 posts 51 karma points
    Aug 21, 2009 @ 23:54
    Richard Walters
    0

    Bert: thank you, I didn't understand that the "MasterPageFile" attribute corresponded to the drop-down in Umbraco. I'm planning a heavy-duty integration project here, and so I'm going to need to get further under the hood immediately than the Runway/CWS solutions will take me… I'm still trying to figure out, therefore, what's stored in the db, and what's read out of the file structure.

    Chris: No duplicates… although my doctype and its corresponding default template have the same alias. I'm assuming that's okay, though, since Runway does it…?

    Thanks again.

  • Chris Koiak 700 posts 2626 karma points
    Aug 22, 2009 @ 09:52
    Chris Koiak
    102

    Duplicates

    You can have doctype and templates with the same name. You don't have any duplicatly named xslt, css, js, etc?

    After investigation it seems the error message is a generic failure message and may have nothing to do with duplicate templates. What it really means it that either

    • Umbraco got false to BasePage.ValidaeUserContextID()
    • Calling 'new Template(templateId)' resulted in a null object.

    You could try calling the above methods from your code, might provide some insight.

    To running this sql statement on your DB and check it returns the right row

    Select alias, design, master from cmsTemplate where nodeId = <<your id>>

    Is saying that I still feel this is a permissions error. Check the permissions on each template file (not the directory) you are trying to edit. Check the 'owner' on each template is set correctly. Am I right in saying you can create templates, but just not edit them?

    Database Storage:

    All DocType information is stored in the DB, including what templates are associated with each DocType.This is required to provide the relavant template selection when you're editing a page.

    The template name, alias are stored in the DB. The master page option is also stored but only used for the construction of the templates tree, not for the construction of the rendered page. The declaration in the template file is used for this (Standard ASP.NET master pages). The template content is stored on the file system in a .master file.

    There is talk of removing these dependancies in 4.1 (or was it v5) and making saving tempalte config to a config file, avoiding DB storage.

  • Richard Walters 14 posts 51 karma points
    Aug 22, 2009 @ 17:25
    Richard Walters
    1

    Chris,

    Your line:

    Select alias, design, master from cmsTemplate where nodeId = <<your id>>

    … provided the right clue.

    I ran this, eliminating the "WHERE" statement and adding and "ORDER BY alias", and discovered that I had two templates with the alias "CWS_Contact". Different pk's and nodeID's, but the same master value (0). The second had an empty "design" field. I went back to my Templates list in the Umbraco interface, and sure enough there were two "Contact" templates (don't know how I missed that). From within the interface, I determined which had the nodeID corresponding to the row with the empty "design" field, and deleted it.

    Voila! Now I can save templates. So…

    The apparent cause: I had a crash during an installation of the CWS package, and attempted a reinstall (which also failed). It seems this left a (broken) duplicate of the CWS Contact template in my templates list. In all fairness to CWS (and Warren Buckley, etc.) I don't believe these problems were in any way the fault of the CWS installer.

    The lesson learned (by me, at least, even if it's already known by others): the duplicate-template error will get thrown if you have any two templates with the same alias, not just if you have an alias conflict with the particular template you're currently trying to save.

    Thanks very much for all your help Chris, and thank you to both of you for all of the useful additional info.

     

Please Sign in or register to post replies

Write your reply to:

Draft