Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

Template "inheritance" or reuse?

I have an html template that I use for almost every page of my web site.  Every page, in fact, except for the dynamic php pages, which are currently not part of the citydesk site.  I want to consolidate the whole site under citydesk, and so I'm bringing the php pages in.  I would like these php pages to use the same template as the rest of the site.  Is it possible to define a php template (with .php as the extension) that references an html template, so that they are both really the same template, or do I need to copy the html template into the php template, and recopy every time I change it?

Wednesday, November 03, 2004

you can put the whoe template in a variable. then reference it in each template

joel goldstick
Wednesday, November 03, 2004

I don't know if this helps but here is one of mine. Doing it this way saves me a lot of trouble on one particular site (thanks to John Conner):

{$ .A_HtmlTop $}
{$ .A_BannerTable_Gray $}
{$ .A_AboveMenu $}
<!-- Menu starts here -->
{$include "AAMenuHomepage"$}
<!-- Menu ends here -->
{$ .A_BetweenMenuAndBody $}
<!-- Main body starts here -->
<p>{$if nonblank .sidebar$}<b><a href="{$.sidebar$}">Click here for print friendly version</a></b></p>
<p class="bodytitle">{$if nonblank .teaser$}{$.teaser$} - {$endif$}{$.headline$}<br /><br /></p>
<!-- Main body ends here -->
{$ .A_EndBodyTable $}
{$include "StyleSheets/Footer"$}
{$ .A_HtmlBottom $}</body>

Wednesday, November 03, 2004

Sorry, I mispasted. That last "</body> " shouldn't be there.

Wednesday, November 03, 2004

I do the same but with {$ include ... $}. This is important to me because my site is bilingual.


Janek Schwarz
Thursday, November 04, 2004

I also use include.  I have a folder named variables where I have a bunch of articles with the template set to None.  I then create one variable, named the same as the article name, which includes the article.

This way, I have the flexability of inserting each variable, plus I can view and edit each article using the article's full screen HTML/Normal views which is lacking the variable editor.

David Burch
Thursday, November 04, 2004

If I have something that normal view screws up, I put it in a variable.

If normal view doesn't screw it up, I use includes.

Thursday, November 04, 2004

*  Recent Topics

*  Fog Creek Home