In Part I, we learned a new technique for templating. Now as you may know, Ultradev has a system for templating in place... it basically copies all of the text in a template to every page, and if you need to change anything, it goes a mad copy and paste-a-thon.
Now keep in mind that I'm not arguing the fact that this works, because it does, but there may be situations where this may hinder your productivity.
In my experience, there has been more that one situation where I've been at a friend or family member's house (who doesn't have UD), and for one reason or another need to change something in the template. If I had implemented the UD Templates, I'd be stuck like chuck. But, since I was using the include file based template, I was able to bust the ever trustworthy Notepad and make my changes unhindered.
Now, keeping in the scope if Ultradev... the main reason that I've written this second part to the Article is to keep inline with one of UD's most attractive features... WYSIWYG.
When I started using this new templating technique, I would make the header and footer files, and edit them with notepad. Then I got a job that gave me the opportunity to start using Ultradev, and it became apparent that the technique didn't work too well within the graphical editor. The main reason being that most of the corresponding tags of the design where stuck in another file, so UD didn't know how to render them. This cause some pretty horrid looking broken tags and misaligned elements.
To avoid this, you got to do things a bit differently. Using the original methodology, I would make a design, create the files (header & footer) and then discard the original file because I didn't need it. All editing was done in notepad, so there was no need for the original file. The ultradev environment is a visual one, so in order to be able to make changes to the original design, you simply name the original template something like *rootTemplate.asp. * Then future changes can be made to the rootTemplate in a visual fashion, and copied to the header and footer files. Since the whole system is based on include files, updating the template automatically updates the whole site.
There is still one issue though. Say you have a file in a subFolder that you apply the template to... boom, all your links and images are broken. Why you ask? because all links in the template are relative to the rootTemplate, so if you make a file in a subfolder, then the web server wont find anything.
To go around this issue, you can simply create two templates, one that is used in the root, and one used in a subfolder. All you have to do is:
- ** copy the rootTemplate to a subfolder (like global or something)**
good old ultradev will change all the links and images for you, making them
relative to a file in a subfolder.
Create two more Header and footer files, but change the name to subHeader.asp & subFooter.asp
Use these new files in any subdirectories that need the template applied.
Simple as that... so there you have it. Hopefully this will be helpful to someone out there in webLand.
if you have any questions, you can Email me at joel@workablesolutions.com
Good Luck