Putting it together one Note at a time

*protoTyping

A Tinderbox Toolshed

protoTyping

The Front Door


There's No Place Like Home


Quick Notes


About Me


A Picture's Worth a Thousand Words


Recent Notes


The Workbench


My ToDo List


The Storage Shed


The Junkdrawer


Drop Me a Line


Read More of the Story II: The Templates


As I mentioned in Part 1, I started with the Trainblogging template. The two templates I modified for the multi-level story effect are trainTemplate.html and trainItem.html. I've added a lot of additional customization but for now I'll try to keep it simple. So, let's Read More of the Story!



My Tinderbox document is made of notes organized like this (more detail in Part I).

--Stories

---Story 1

----StoryItem 1

----StoryItem 2

-Index (Agent, collects Story 1, Story 2, etc but not StoryItems using Query: Prototype=protoStory)

The trainTemplate is called by each note where the attributes HTMLDontExport=false and HTMLExportTemplate=trainTemplate.html. The trainTemplate has code to export the title and the text of the note to HTML using a second template, the trainitem.html template. It also collects the children that are nested one level below the container note. The code for all this appears after the sidebar portion of the table ( ^include(sidebar)^) and looks like this.

^title(this, trainitem.html)^

^text(this, trainitem.html)^

^justchildren(trainitem.html)^

You may want to add line breaks or whatever. I am not skilled at html, so I just used PageSpinner to put in whatever seems to get me the format right (or close enough!).

The trainitem template then exports the title of the container note, the text (which is the story summary) and tests for children:

^title^

^text^

^if(exists)

<a href="^path(this)^" title="Read More of the Story" onMouseOver="status='Read More of the Story'; return true;" onMouseOut="status=''; return true;">Read More...</a>

endif

This conditional means that only stories that have children, get the Read More link which links to the note that is exported, children and all, to its own page (HTMLExportChildren of the container of the Stories is true). The path to that page is defined by ^path(this)^

Finally, an Agent collects the top level Stories and their summaries and is defined as the index.html by HTMLExportFileName=index. This Agent collects notes by prototype-- Query: Prototype=protoStory . Because of this query, the index only contains the Story notes, and not their children. Consequently, the index page is just the Story titles, summaries and links to the full stories, each of which was exported to its own page by the trainTemplate and trainitem template.

Start simply and build up slowly. This is the structure I use for *protoTyping, and more recently, Exploring Kenya. It is a nice way to build a multilevel website.




 

--- Ryan Holcomb 2005 --

A Shed with a View


Tinderbox Help


GTD on the Web


My Toolbox


The Bookshelf


Tinderbox



tinderbox