homepage Welcome to WebmasterWorld Guest from 54.227.63.195
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / WYSIWYG and Text Code Editors
Forum Library, Charter, Moderator: open

WYSIWYG and Text Code Editors Forum

    
DW Template troubles
doctitle overwriting existing titles
Syzygy




msg:3420189
 4:11 pm on Aug 12, 2007 (gmt 0)

Iím trying to add a simple template to existing documents but am finding that the title on existing pages is being overwritten by the text I include within the ďdoctitleĒ template section.

The only "editable regions" in the template are doctitle, head and body.

When the template is applied to a page the dialogue box showing inconsistent regions appears, and I define head as head and body as body.

The template is applied; head and body are fine, but existing page titles are replaced by the text Iíve used in the template.

I donít recall having this situation with the previous template, but I canít seem to work out what needs to be done so that existing page titles remain in place.

What am I doing wrong/not understanding here?

Thanks.

Syzygy

 

sonjay




msg:3420248
 6:10 pm on Aug 12, 2007 (gmt 0)

In the template, is the title inside an editable-region tag? If it's not, it should be.

What version of DW?

Syzygy




msg:3420293
 7:12 pm on Aug 12, 2007 (gmt 0)

It is inside an editable region:

<!-- TemplateBeginEditable name="doctitle" -->
<title>My title text here</title>
<!-- TemplateEndEditable -->

DW is MX...

Syzygy

Wlauzon




msg:3420347
 8:39 pm on Aug 12, 2007 (gmt 0)

Check your case and make sure you don't have Doctitle or something instead of doctitle in your pages and the dwt.

sonjay




msg:3420349
 8:45 pm on Aug 12, 2007 (gmt 0)

Yeah, it sounds like you've got a mismatch between the template and the child pages. What does the editable tag code look like in a child page? Does it look exactly like this?


<!-- InstanceBeginEditable name="doctitle" -->
<title>Title Here</title>
<!-- InstanceEndEditable -->

Syzygy




msg:3421015
 6:46 pm on Aug 13, 2007 (gmt 0)

Here's how it looks:

<!-- InstanceBegin template="/Templates/Template New.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>My title text here</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- InstanceBeginEditable name="head" -->
<meta name="Description" content="My description here" />
<meta name="Keywords" content="My keywords here />
<style type="text/css">
</style>
<!-- InstanceEndEditable -->
</head>
<body>
<!-- InstanceBeginEditable name="Editable body region" -->
<!-- InstanceEndEditable -->
</body>
<!-- InstanceEnd -->

Anything wrong here?

sonjay




msg:3421137
 8:56 pm on Aug 13, 2007 (gmt 0)

Hmmm... without doing some testing, which I don't have time to do right now, I can't be sure, but I see a couple of things in your code that could be causing problems.

First, you should avoid using filenames that have spaces in them -- such as "Template New.dwt"

Second, you should avoid using names for editable regions that are the same as standard html tags -- such as "head"

And finally, I've always avoided using multi-word editable region names with spaces (such as "Editable body region"). I don't know if this would cause any problems, but my policy is always to avoid anything that might possibly confuse DW or cause a problem.

Syzygy




msg:3421584
 10:22 am on Aug 14, 2007 (gmt 0)

Okay, I've renamed the template and editable regions (apart from doctitle) and now have:

<!-- InstanceBegin template="/Templates/Templatenew.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>My title text here</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- InstanceBeginEditable name="tags" -->
<meta name="Description" content="My description here" />
<meta name="Keywords" content="My keywords here />
<style type="text/css">
</style>
<!-- InstanceEndEditable -->
</head>
<body>
<!-- InstanceBeginEditable name="stuff" -->
<!-- InstanceEndEditable -->
</body>
<!-- InstanceEnd -->

When applying this to an existing page the dialogue box identifies inconsistent regions as:

document body - <not resolved>
document head - <not resolved>

So what I've done is:

Move content to new region ->
document body - <stuff>
document head - <tags>

As editable regions <doctitle> and <tags> are both within <head></head>, does this create a problem or conflict?

Syzygy

Syzygy




msg:3424521
 10:16 am on Aug 17, 2007 (gmt 0)

A few days on and I still haven't been able to resolve this. Anyone..?

Syzygy

sonjay




msg:3424543
 10:50 am on Aug 17, 2007 (gmt 0)

Oh, I didn't see your last response.

This is looking like a conundrum -- I'm not sure what the problem is.

Let's try something, to narrow down whether it's a template issue or a child page issue. Create a new page from your template - New -> From Template, and place some content in it. Edit the title. Save it. Now make some minor harmless change to your template, save it, and have it update child pages. Then check your new child page and see if the title tag has been overwritten by what's in the template.

If the title tag in the child page has been overwritten, then there's a problem with the template, and I'll want to see the full template code. (Change any private information, of course.)

If the title tag hasn't been overwritten, then the template and your new child page are working exactly as supposed to, and the problem is with your existing child pages, and I'll want to see the full template code and the full code from one of the existing child pages.

Syzygy




msg:3424816
 3:52 pm on Aug 17, 2007 (gmt 0)

Thanks for that Ė thought Iíd been forsaken :)

Iím now at that frustrating stage where I canít see the wood for the trees and have no idea what Iím doing any more (not that I was particularly clued up before). What was slightly annoying a couple of days ago, has now become an all-consuming source of frustration Ė aaarrgh! Iíd swear that thereís a nefariously mischievous gremlin within DW having a laugh at my expense!

I expect though that the endless tinkering Iíve been doing in an attempt to find a solution to something thatís probably very straightforward and is staring me in the face (hopefully), has caused more problems than I had to start with!

Iíve done as suggested and can report that the problem appears to crop up when the template is added to existing child pages. Here then is the template code as it is presently:

------------------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<!-- TemplateBeginEditable name="doctitle" -->
<title>Page title here</title>
<!-- TemplateEndEditable -->
<!-- TemplateBeginEditable name="tags" -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Robots" content="all">
<meta name="MSSmartTagsPreventParsing" content="true">
<meta name="Description" content="Page title here: ">
<meta name="Keywords" content="keywords here,here,and here">
<!-- TemplateEndEditable -->
<style>
@import url("../wwwroot/css/filename.css");
@import url("../wwwroot/css/nameoffile.css");
</style>
</head>
<body>
<!-- TemplateBeginEditable name="maincontent" -->
[main content here]
<!-- TemplateEndEditable -->
<script>Gís Analytics Here
</script>
</body>
</html>

------------------

Below is the code from a current child page that has yet to have the template added:

------------------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Page title here</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="Description" content="Page title here:">
<meta name="Keywords" content="keywords here,here,and here">
<style type="text/css">
@import url("css/filename.css");
@import url("css/nameoffile.css");
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Robots" content="all">
<meta name="MSSmartTagsPreventParsing" content="true">
</head>
<body>
[main content here]
<script>Gís Analytics here
</script>
</body>
</html>

------------------

Need anything else? Iíll happily provide.

Thanks for taking the time to help. It's very much appreciated.

Syzygy

sonjay




msg:3425056
 7:48 pm on Aug 17, 2007 (gmt 0)

Oh, you're trying to apply the template to pages that are not already child pages of the template. The problem is, your existing pages don't have any editable areas already defined, so DW is doing its best -- which means it's putting all of the template's head code in the head of the document, because it doesn't know that there are any parts of the head code in the existing pages you want to keep.

The best, most surefire way to apply the template to all the existing pages is also quite inefficient -- create a new page from the template, then copy-and paste the existing code from each page into the appropriate editable areas in the new template-based page. Yes, you would have to do that for each page in the site. How many pages are you needing to apply the template to? There is another way, but it's fraught with danger unless you're very careful. If you only have a few pages you need to do this with, it's better to just spawn new pages from the template and copy-and-paste. If you have a lot of pages, we'll get into the faster, but more dangerous method.

But I have an important question first: It appears that your template holds nothing but the "housekeeping" code in the head section, and and G Analytics code at the end. Why are you bothering to apply a template to these pages? Is all of the sitewide structural code and global navigation going to be in the editable area of each individual page? It seems to me there's no real reason to bother applying a template to every page. I don't see any advantage here in what you're doing.

Wlauzon




msg:3425205
 11:46 pm on Aug 17, 2007 (gmt 0)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Page title here</title>

Your target pages have to have the "editable" string in there also in the same place approximately.

Syzygy




msg:3426931
 3:22 pm on Aug 20, 2007 (gmt 0)

Thanks for the help. All existing pages are being copied & pasted into template-based pages...

This is my first attempt at working with template pages in DW, and, whilst I agree that there's little or no advantage to having a template on the pages at present, at some stage extra elements will need to be added to pages and I'm hoping I'll have saved myself some time by having made the effort to template at an early stage. Well, that's the theory - the practice may be somewhat different. :-)

Thanks again.

Syzygy

[edited by: Syzygy at 3:23 pm (utc) on Aug. 20, 2007]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / WYSIWYG and Text Code Editors
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved