Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

HTML as Value in Variable

Does anyone have an interesting or novel use of using HTML in a variable's value?

Gilles
Thursday, April 18, 2002

Consider this example: I have a website where the header and footers are the same, on every page. Furthermore, I would like to integrate CityDesk with some other Web Applications which should also have my usual page headers and footers.
I put the html for the header and the footer in a variable. Now in every template I insert these two variables at the beginning or the end. Furthermore, I create two articles called "HeaderHTML" and "FooterHTML" which use no template but contain a call to the respective variables only.
Now, if I want to change either the header or the footer, I only have to change one of the 2 variables: What I get: All my templates AND the external applications reflect the changes at well.
This is just one example, I can give you a 100 more...;-)

Stephan
Friday, April 19, 2002

Yup. The "menu" on the left side of the page at http://bstpierre.org/ is stored in a variable. (And like Stephan said, there are 100 more...)

Brian St. Pierre
Friday, April 19, 2002

My personal site has only one template and I haven't had much need to create other sites with a lot of templates at work, so I keep all my header/footer/leftnav stuff in the template.

I had my CSS in a variable, but decided a CSS file or the CSS in every page is easier.

Where variables would probably be the most useful is in editing articles, but the UI isn't good for that. If you could change every reference to something instantly that would be powerful. Say you link to articles on C|NET and then C|NET changes their architecture. All of your links break, but if they were stored as variables you could find/change them easily.

anon #3 (they might read this)
Friday, April 19, 2002

*  Recent Topics

*  Fog Creek Home