Designers and developers don't use the same tools: designers usually use an HTML editor (for instance, Dreamweaver or Amaya) and developers use a text editor and CherryPy.
<div py-include="header.html">header</div> (CHTL form) or <py-include="header.html"> (CGTL form)
The template file will be included in the code by the CherryPy preprocessor (very much like an "#include" directive in C). To find the template files, the preprocessor will look in the same directories as for the other source files (/lib, /src, directories specified with the -I flag, etc.)
Let's go step by step
******************* * File header.html ******************* <html><body> Welcome to the CherryPy py-include demo.<br> You are here: home<br><br> ******************* * File footer.html ******************* <br><br><small>Don't forget to eat cherry pie every day</small> </body></html> ******************* * File page1.html ******************* Header Welcome to page1.<br> Click <a href="page2">here</a> to go to page 2. Footer ******************* * File page2.html ******************* Header Welcome to page2.<br> Click <a href="page1">here</a> to go to page 1 Footer
CherryClass Root: mask: def page1(self, youAreHereLabel='page1'): <py-include="page1.html"> def page2(self, youAreHereLabel='page2'): <py-include="page2.html">
We now have a working version of the web site: just compile the CherryPy source file, run the server and test it.
See About this document... for information on suggesting changes.