?
Solved

Error coming while saving Dreamweaver template...

Posted on 2009-02-21
9
Medium Priority
?
797 Views
Last Modified: 2012-05-06
Hi friends !

I am designing my website using HTML / Advance HTML and CSS. I am also using Server Side Includes for my webpages. That is why even there is no or less asp code , I am saving them with .asp extension as it is mandatory to save them with either .asp or .php extensions. Am I right ? (Please corrent me if I am worng)

As usual, the first challenge that comes in web development is "Design template". For this, I first coded a file named: temp.asp (THE CODE IS ATTACHED). I have configured my own webserver (kie.ac.rw) in my local testing machine using Microsoft IIS. DNS entries and all server configurations are ok.

When I browse to http://www.kie.ac.rw/temp.asp, I am able to see tha pages. (means server configurations and inclusion of INC files are correct.)

I want these sections in my template:

My template will have these sections.
1. Header (For banner)
2. Menu (Drop-down menu bar)
3. Top pane
4. Left pane
5. Right pane
6. Bottom pane
7. Footer (For footer)

Now, I opened this file temp.asp using Dreamweaver 8 and saved it as "general.dwt" template. When IIt stated that "there is no editable region", so I tried to make editable regions for Top, Left, Right and Bottom pane, but it when I do so, DW gives me a this warning message: (The screenshot is also attached)

********************************************************************************************************************
You have added or changed code outside the <html> tag. This change will not be copied to documents based on the template unless you insert this tag in the <head> section of your template.
<!--TemplateInfo codeOutsideHTMLIsLocked-"true"-->
********************************************************************************************************************

I ignored the message and continued making editable regions for my editable regions for Top pane, Left pane, Right pane and Bottom pane in this way:
********************************************************************************************************************
<!-- InstanceBeginEditable name="toppane" -->
         <div class="toppane">
         
         </div>
       <!-- InstanceEndEditable -->
     
         <!-- InstanceBeginEditable name="leftpane" -->
         <div class="left">
         
         </div>
       <!-- InstanceEndEditable -->
   
       <!-- InstanceBeginEditable name="rightpane" -->
         <div class="right">
      
       </div>
       <!-- InstanceEndEditable -->
********************************************************************************************************************
 I am also able to use the template to create webpages and it seems OK to me. But I am fear about that message. Why that message came ? Is there any thing wrong in my template code ?

Please help me in this regard.

Hemant




 
//The temp.asp file that I used to create the general.dwt template
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
 
<head>
 
<title></title>
<meta http-equiv="Content-Language" content="English" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="http://kie.ac.rw/style.css" media="screen" />
 
</head>
 
<body>
 
<div id="wrap">
 
   <div id="top">
   </div>
 
   <div id="content">
 
     <!--#include VIRTUAL="Templates/inc/header.inc"-->
 
     <!--#include VIRTUAL="Templates/inc/menu.inc"-->
 
     <div class="toppane">
     </div>
 
     <div class="left">
     </div>
		
     <div class="right">
     </div>
 
     <div class="bottompane">
     </div>
		
     <div id="clear">
     </div>
 
   </div>
 
   <div id="bottom">
   </div>
 
</div>
 
<!--#include VIRTUAL="Templates/inc/footer.inc"-->
 
</body>
 
</html>

Open in new window

warning.JPG
0
Comment
Question by:JatinHemant
  • 5
  • 4
9 Comments
 
LVL 19

Assisted Solution

by:v2Media
v2Media earned 1500 total points
ID: 23702871
DW templates are different beasts to the 'template' approach that you're taking. When you decide to use scripted includes, either asp or php, you're essentially creating your own template system.

Just keep the file temp.asp, with all the necessary include statements, as the site's main template. When you want to create a new file for the site, open temp.asp and immediately 'save as' the new file.

A tip for naming conventions when taking this approach for using templates; rename your temp.asp to content.tpl.asp. the 'tpl' suffix indicates a template, the 'content' is the type of template. In any given site that I use this approach for, I wind up with a few tpl files: -

homepage.tpl, content.tpl, pop.tpl, utility.tpl, form.tpl etc...
0
 

Author Comment

by:JatinHemant
ID: 23704073
Thanks for your reply.

You mean to say that if I use "Server Side Includes" to bring some INC files in particular areas of my webpages, then I MUST NOT save "temp.asp" as template "general.dwt" in DW. I should just use my temp.asp file (with INC inclusion) and rename it as temp.tpl.asp

Ok, I will follow your tips. BUT...

Just to clear my doubts, tell me why a software like DW 8 doesn't provide this support and what is wrong if I do it in the same way as I was doing, as I told you that though I am  getting that warning message, the alteration in general.dwt is reflecting in all the pages made with the template.

But as it seems to me that you have long experience, definately there may be some reasons you are saying to use this new method of using homepage.tpl, content.tpl, pop.tpl, utility.tpl, form.tpl etc. PLEASE EXPLAIN ME WHAT MAY BE THE FUTURE PROBLEMS IF I DON"T FOLLOW YOUR SUGGESTION AND USE THE SAME GENERAL.DWT METHOD !!!!!

In line to this please tell me whether it is also possible to put meta tags for "Keywords for searching" in a INC file. (How you do this ???) For example I have footer.inc and the contents of footer.inc are:

**************************************************************************************************************
<html>
<link rel="stylesheet" type="text/css" href="http://kie.ac.rw/style.css" media="screen" />

<div id="footer">
Kigali Institute of Education, P.O. Box 5039, Remera, Kigali, Rwanda<br/>
Copyright 2009 KIE - All rights reserved<br/>
Designed by <a href="http://www.kie.ac.rw">Hemant Uppadhyay, Webmaster, KIE</a>
</div>

</html>
**************************************************************************************************************

and I am calling the file in the code (In my first post) at the end of my temp.asp. All other INC files are made. I want to code only the inc file for "Keywords".

Please help me in this regard.

Thanks again,

Hemant
0
 
LVL 19

Accepted Solution

by:
v2Media earned 1500 total points
ID: 23704169
Nope; I've been literal in my explanation; no reading in between the lines.

The DW template system is a substitute for server side includes. If you're going to use SSIs and dwt's, DW will cope with that too. However it simply isn't required unless you want to lock out other DW users from changing parts of the template.

When you modify a SSI, all pages that include that file are automatically updated by virtue of including it. **The DW template system duplicates that functionality with non-SSIs**. The difference being that DW template mark-up provides editable and non-editable regions.

You can use DW template markup within the main template page, however if the includes are not also turned into dwt's, they'll be fully editable. So basically you're making more work for yourself and complicating the dw template system by using SSIs.

The downside of using both DW templates and SSIs? None if you're going to be the only one working on and in charge of the website. During the course of my career in web development though, I've found the DW template system more of a hinderance than a production boost. When I inherit a site that includes DW template mark-up, the very first step before touching that site is to run it through some regex filters to strip that garbage out.

How do I handle meta keyword and desc tags? In small sites with fewer than 12 pages or so, I use a switch->case in the document.meta.tpl file. For sites larger than that, the document title, meta desc, keyword and revised dates are held in a database.



0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:JatinHemant
ID: 23704484
Got your point.

You explained me in a nice way. I got everything except about keywords and desc tags. Would you please explain with some dummy code. What is that switch-->case terminology ?

I want these keywords in search engine:

KIE, Kigali Institute of Education, Educational Institute in Rwanda, Kigali Institute, KIE - Rwanda, Best educational institute in Rwanda, Courses in KIE

I want to make an include file (let it be meta.inc) for this so that I don't need to change it in all pages (same as header.inc, menu.inc, footer.inc)

How to code this inc file with keywords (I know basic way, I want to know professional way) and where in template, I should  put the <!--#include VIRTUAL="Templates/inc/meta.inc"--> statement.

Regards,

Hemant






0
 
LVL 19

Assisted Solution

by:v2Media
v2Media earned 1500 total points
ID: 23704563
Unfortunately I'm a php coder, so I cant translate into asp; however I can post the logic that gets the idea across.

meta.inc

1. get name of file from url, split off extension to just leave file name
2. place file name into variable called 'pageName'
3. create a switch to hold all cases of meta tags for the site. e.g.
4. output the title and meta variables into each template header
//meta.inc
 
switch(pageName) {
 
  case 'index':
    title = 'web page title';
    meta_keys = 'one, two, three, keywords';
    meta_desc = 'one two three keywords';
  break;
 
  case 'products':
    title = 'widgets';
    meta_keys = 'widgets, small, medium,large';
    meta_desc = 'more widgets than you can poke a stick at';
  break;
 
  default:
    title = 'website default title';
    meta_keys = 'website, company, widgets';
    meta_desc = 'company's widget website';
 
//EOS
}
 
//example usage
 
//content.tpl
<html>
<? include('includes/meta.inc') ?><!-- include statement before opening head tag -->
<head><title><? print(title) ?></title>
<meta name="keywords" content="<? print(meta_keys) ?>" />
<meta name="description" content="<? print(meta_desc) ?>" />
</head>
<body>
------etc------

Open in new window

0
 

Author Comment

by:JatinHemant
ID: 23704708
Thanks for your quick reply. I got the switch-case statement

It is very nice hearing from you that you are a php coder. The one and last thing. As you can see in my code, for inclusion I used:

<!--#include VIRTUAL="Templates/inc/header.inc"-->

BUT, you have used php script and it is like this:

<? include('includes/meta.inc') ?>

I am little confused here. Please see the following link:
http://ask-leo.com/how_do_i_include_one_html_file_inside_another.html

Here, at this link you will find the SSI method for PHP. Then how it is different from your code ? Why there it is:
<? readfile("b.inc"); ?>

Also, would I have to change all the paths for INC (see Remote Includes on the same page) when I will really upload it to my ISP. As right now I will be using local test Apache, XAMPP or EasyPHP locally.

You also didn't use FILE or VIRTUAL !!!

Regards,

Hemant
0
 

Author Comment

by:JatinHemant
ID: 23704733
Ok...for your kind information, I am also going to use .php extension as here everybody wants Open Source Technology.

So, our ISP also has Apache Servers and the .php extension will be compatible with Apache. That's why I want to know...

Why you used <? include('includes/meta.inc') ?> while in the link it is <? readfile("b.inc"); ?>          ???

Do they perform the same task ? And what to do when I will have to put it really on the ISP web server. Will it also work there ? Won't I have to use something like:

<? readfile("http://kie.ac.rw/includes/meta.inc"); ?>

Please help me as these things are confusing me.

Regards,

Hemant
0
 
LVL 19

Assisted Solution

by:v2Media
v2Media earned 1500 total points
ID: 23704876
I was using psudo code, it's not actual code that would work; not even in php. This little nugget looks like japanese to me: - "<!--#include VIRTUAL="Templates/inc/header.inc"-->". I know it's an include statement, but why the syntax requires all the extranious characters is beyond me.

As for why my paths do not match yours, same reason; it's psudo code. You should be able to interpret that the include path needs to be changed to suit the directories used in your site.

Why does my include statement look different to the link you provice? Again, it's psudo code. The point of psudo code is to illustrate programatic logic, not syntax.

The php syntax for including a file is: -

<?php include('path/file.php') ?>

include() is the proper function to use in php for this purpose, readfile() isn't. The fellow who wrote that article in the link is mis-informing you.

Hemant, if we progress any further along these lines, you're only going to get more confused. I'd like to finalise this question before it turns into a step by step, "how do I ... in php". I apologise for leading you down a path that's a bit advanced for you at this stage.

The bottom-line is this...

If you're going to use SSIs and DW templates together, **the SSIs should be for html content that does not change from page to page.** If you're going to have distinct title and meta tags, dont use an SSI and make the <head> tag an editable region in the template.

To answer your original question, the warning displayed by dreamweaver is merely telling you that you have made changes to the code outside of the template tags and in doing so, the other pages in your site will not receive the changes. In other words, keep all html of the webpage INSIDE template tags. The best thing to do is to open up DW help pages and re-read the introduction to DW templating system. A quick refresh from the manual will set you straight.
 
0
 

Author Comment

by:JatinHemant
ID: 23705005
Thanks again for your continuous and quick replies.

Well...let me go through the documentation.

Regards,

Heamant
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
Suggested Courses

750 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question