Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com)
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi
Tinderbox Users >> Exporting from Tinderbox >> Using several export templates for blog export
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1374936669

Message started by Jack Baty on Jul 27th, 2013, 10:51am

Title: Using several export templates for blog export
Post by Jack Baty on Jul 27th, 2013, 10:51am

My Tinderbox-based blog has 2 different types of posts, "book" and "post". I would like each to render differently. For example, the book type has an image and ISBN attribute that I want included in the output.

How do I render each item using different templates that works both when calling Children() and when its individual document is exported? If the HTMLExportTemplate is a full HTML page, it shouldn't be used with Children() but if the HTMLExportTemplate is only the note's contents, the individual pages aren't complete HTML pages.

What I thought I could do is use a variable in the template parameter of Children(), something like Children(/Template/^value($PostType)^) but that doesn't seem to be how it works.

I must be approaching this wrong.


Title: Re: Using several export templates for blog export
Post by Jack Baty on Jul 27th, 2013, 2:51pm

For now I've just moved the logic into the "post" template. This works, but I'd still like to find a way of having individual templates representing each post type but that felt like I was swimming upstream.


Title: Re: Using several export templates for blog export
Post by Mark Bernstein on Jul 28th, 2013, 10:04am

I think exporting

   ^children(^value($PostType))

might get work.

For modest changes, I prefer to embed the variation in the post template.  For example:

CSS styles:

   <h1 class="^value($PostClass)"> ... </h1>


Adding supplementary information:

   ^if(^value($PostClass="book"))
         <h2 class="author">^value($Author)</h2>
   ^endif




Title: Re: Using several export templates for blog export
Post by Jack Baty on Jul 28th, 2013, 10:47am

Thanks Mark, that's how I handled it. There's always a way!

Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com) » Powered by YaBB 2.2.1!
YaBB © 2000-2008. All Rights Reserved.