1.12.3 Dreamweaver MX

The web modules can also parse Dreamweaver MX templates as long as they only use standard Editable Regions and the regions are empty so that the tags look like this:

<!-- TemplateBeginEditable name="content" --><!-- TemplateEndEditable -->

DreamweaverMX templates are passed just like the others except you set type to 'dreamweaverMX'.

Warning: If you set the doctitle editable region please remembe to include <title> and </title> tags around the title you set as the template doesn't include these for you.

Here is an example Dreamweaver MX template:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- TemplateBeginEditable name="doctitle" -->
<title>PythonWeb.org - Dreamweaver MX Example</title>
<!-- TemplateEndEditable --> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable -->
</head>

<body>

<h1><!-- TemplateBeginEditable name="Title" -->Web Modules<!-- TemplateEndEditable --></h1>
            <!-- TemplateBeginEditable name="Content" -->
            <p>&nbsp;</p>
            <!-- TemplateEndEditable -->

</body>
</html>

Here is a program to manipulate it:

#!/usr/bin/env python

import sys; sys.path.append('../../../') # show python where the web modules are
import web.template

dict =  {
    'Content':'Welcome to the test page!',
    'doctitle':'Dreamweaver MX Example',
    'Title':'Dreamweaver MX Example',
}

print web.template.parse(
    type='dreamweaverMX', 
    file='file-web-template-dreamweaverMX.dwt', 
    dict=dict
)

And here is the output produced:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- InstanceBeginEditable name="doctitle" -->Dreamweaver MX Example<!-- InstanceEndEditable --> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
</head>

<body>

<h1><!-- InstanceBeginEditable name="Title" -->Dreamweaver MX Example<!-- InstanceEndEditable --></h1>
            <!-- InstanceBeginEditable name="Content" -->Welcome to the test page!<!-- InstanceEndEditable -->

</body>
</html>