"Le cordonier est le plus mal chaussé" would be a great analogy of me and my web presence right now.

Monday, October 18, 2004

Dreamweaver Templates

I’ve been doing a fair bit of PHP hacking lately, and I’ve been thinking about workflow and methodology. How do I make something reusable and maintainable? Putting my coder’s hat on, I am tempted to break everything down into small components, and code them as such. I took my design, then started breaking the html down into chunks to be printed by functions like printHtmlHeader(), printNavBar(), etc. After everything has been made modular, printing out a page is easy. The code is elegant – reusable and maintainable. Any given page is just a series of calls to html-printing functions But is it the right way?

No it’s not. I’m the only one working on the project, so I’m both designer and coder. However, in most projects, the designer is not also the coder. The designer may not even know PHP. If the background colour needs to be changed, will you want the designer to have to hack your printHtmlHeader() function? No you don’t. Using functions to print out static bits on the page is not a good idea, because these static bits are typically maintained by a designer.

Enter Dreamweaver templates. Dreamweaver templates are to designers what classes are to the coders. You create a template, then ‘instantiate’ pages from them. If you change something in the template, the change also affects all the pages that use the template. You can also define editable regions in your template. Think of them as object attributes – these editable regions hold different things depending on the page. The best thing is that you are able, to a large extent, to separate design from business process. The PHP bits fit into the editable regions of the template, and the static bits remain as part of the template, to be maintained by the designer. It is much better to tweak the design from the WYSIWYG Dreamweaver environment than having to pore over html-printing PHP code. With Dreamweaver templates we achieve reusability and maintainability for the design while keeping the design environment designer-friendly.

1 Comments:

Blogger Shane said...

Hi Asvin. Thanks for your suggestion, I'll have a look at it :)

6:42 pm

 

Post a Comment

<< Home