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 >> trouble with offset references
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1433101656

Message started by Demogorgon on May 31st, 2015, 3:47pm

Title: trouble with offset references
Post by Demogorgon on May 31st, 2015, 3:47pm

Mark,

I'd like my export to be as tidy as your aTbRef, but I don't want the root of my TBX to be so crowded with so much auxiliary export stuff—just a ASDF.COM container and a CSS container and then a few of my main containers.

So I've managed to do this but my index ends up inside the ASDF.COM folder on export.  I'd like it to be outside, so that the final export nesting looks like this:

ASDF.COM
 index.html
 index [folder]
 css [folder]

My TBX looks like this:

ASDF.COM
 ASDF POSTS
 About ASDF
 @Categories [agent]
 @Archives [agent]
 @Home [agent]

$AgentQuery = $Container=="/ASDF.COM/Mapself POSTS/"

ASDF POSTS:
The children are categories, and the children of the categories are posts.

@Categories:
This collects just the categories of my blog.
$AgentQuery = $Container=="/ASDF.COM/Mapself POSTS/"

@Archives [agent]
This collects just the posts and sorts them by date from new to old.
$AgentQuery = descendedFrom("ASDF POSTS")&($blogReady)

@Home [agent]
This picks out the most recent 6 from @Archives.
$AgentQuery = first("/MAPSELF.COM/Archives",6)

My index.html page was nice: it contained the first 50 words of the 6 most recent posts.  It was simply the export of the @Home agent, using a template that contained the line:

^children(blogTruncPost)^

It worked great.  But now I want my index.html to export alongside (not inside) the massive "index" directory.  How to do this?

First, I thought I could just change the export path of @Home to "/index.html" instead of "ASDF.COM/index.html".  But it looks like this is impossible.

Then I decided that I could just make a special template for the ASDF.COM container—one that designated the children of @Home.  But designators don't allow offset references.  

So I decided to use this line in my template but it exports as whitespace:

^include(^value(first("@Archives",6))^,blogTruncPost)^

This fails.  [BTW, I notice that a lot of code that works in agents fails when using the ^value^ method inside an export template.  I wish I understood the logic behind what's going on.]

What code in my template will let me export ASDF.COM so that it includes text from the latest 6 posts?

Title: Re: trouble with offset references
Post by Mark Anderson on May 31st, 2015, 4:51pm

A basic rule of Tinderbox is that export follows the outline structure - there's no way around that. Items that export at root level, need to be at outline root level.

^include^ can pull in data from another note but there is no code to make a note export itself to a different outline location … without an include form that location.

But, why note put everything else one level lower and have only your index note and ASDF.com container at root level. I'm not set up to try that now but it might work.

If agents aren't returning the results you expect it might be because they aren't populated correctly at time of export.  This is even more likely if the agent is looking at other agents.  If so, make sure you use File -> Update Now a few times before export - or wait a while after opening the doc before trying export.

If you're trying to do things relating to children/descendants of items via an agent, see this.

I helped Ted G design a TBX that generates four discrete sites out of one TBX, so I've a hunch what you're trying is possible. Just remember the opening point about expert in relation to TBX outline structure. You can't break that concept but with thought you can design around it in a manner that delivers an outcome.

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.