Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

How to inherit content from another page?

How can I automatically populate part of a page based on an attribute specified in another article?

As a CD newbie and amateur web designer let me try to explain my dilemma...(hope this makes sense!)...

Assume I use two templates - SubindexTemplate for all subindex articles (one in every folder and subfolder) and NormalTemplate for other articles.

For design flexibility across folders my SubIndexTemplate uses the Teaser field to determine the content of the right hand column of each subindex page.

I have created variables for different design elements (web poll, latest news, etc) - by inserting selections of these  variables into the Teaser field of different Subindex's I am able to change the look of each subindex page.

My normalTemplate is set up so that articles in the same folder as the subindex can automatically inherit the variables that were entered into the subindex teaser field.

This is the script written into the template code:

{$ forEach 1x in (and (thisFolder) (filename "subindex")) $}
{$x.teaser$}
  {$next}

This seems to work fine - except where the variable called by {$x.teaser$} uses a forEach loop. Citydesk apparently does not allow nested forEach statements which is what this setup creates.

Is there another way to create the automatic inheritance I want to achieve, without having to manually re-insert the variables into each Normal article?

Many thanks!
Davy

Davy Ivins
Thursday, September 18, 2003

I think I found the solution to nested forEach 's. 

http://discuss.fogcreek.com/CityDesk/default.asp?cmd=show&ixPost=2593&ixReplies=1

Thanks to TK's Hep Reference at
http://tk-jk.net/city/Articles/fog0000000006.html

Davy
Friday, September 19, 2003

*  Recent Topics

*  Fog Creek Home