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 >> Sets to HTML Links
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1222397684

Message started by Craig Brown on Sep 25th, 2008, 10:54pm

Title: Sets to HTML Links
Post by Craig Brown on Sep 25th, 2008, 10:54pm

Hello,
Is it possible to export a Set of Tags as separate links? eg Cats;Dogs;Fish, as links to separate pages!

Thanks in advance for any help!
Craig Brown
NZ

Title: Re: Sets to HTML Links
Post by Mark Anderson on Sep 26th, 2008, 3:57am

Yes. Instead of looking for an 'export-set-as-list' command use the format action and a secondary attribute.  The process is described here. The slightly counter-intuitive leap is using a 'secondary' user attribute whose only purpose is to hold the output of format(). That 'extra' step can help keep the source set clean inside TB as well as not clutter your export code. It just seems odd creating an attribute for such a small task but don't worry as it won't impact TB performance.

Title: Re: Sets to HTML Links
Post by Craig Brown on Sep 26th, 2008, 4:58am

Thanks Mark,
Unfortunately your reply is way above my abilities with Tinderbox I'm not sure how to create a "attribute to hold the output of format()" I don't even know where to put the "format action" (an agent?) Sorry but my journey with Tinderbox has always been 2 steps forward and 1 step backwards!

Craig

Title: Re: Sets to HTML Links
Post by Mark Anderson on Sep 26th, 2008, 7:39am

OK, no problem. I'd be tempered to suggest you spend a little time getting comfortable with basic HTML export first to help you understand the process. However, I know we all like to get to an outcome as soon as possible, so here's the outline:

1. How to make a new (user) attribute.
  • Choose menu: Window -> Attributes )or click Cmd+2). If not selected click the 'User' tab of the panel that opens.
  • Click 'Create' button.
  • Type a name for the attribute in the top ('name') box.  I suggested using 'FormattedList' as your name - you can read up on attribute naming later.
  • If the 'type' pop-up list says 'string' leave it, otherwise open the list and select that value.
  • Click the 'OK' button, your attribute is added and available for use.

    2. Using the format() action operation.  The term 'action' here means TB's internal scripting code and an 'operator' is TB's term for a predefined code command that does something for you (think method, function, etc.). We'll make an action in the form Attribute = format(Attribute,"<ul>","<li>","</li>","</ul>"). We'll do this via a rule so the action applies to the note running the rule. i'll assume for now your set attribute is called MySet. Here's the Rule code:

     FormattedList = format($MySet,"<ul>","<li>","</li>","</ul>")

    3. Using the list in export. Open your HTML template and where you want the list to appear add this:

     ^get(FormattedList)^

      ... or put the code actuall in the body copy of the note.

    ~~~

    If you give that a try and are struggling you'll probably want to take a little time getting used to actions & rules and HTML export before trying the technique. Good luck!

    [Post-edit] Oops, actually this will export the set values as an HTML list, and we'll need to consdier a different approach. See this thread.]

Title: Re: Sets to HTML Links
Post by Craig Brown on Sep 26th, 2008, 4:41pm

Thanks Mark,
I understand the basics quite well, HTML exporting etc is no problem It's the "coding" side of things thats quite hard for me.I basically learn by back engineering working examples, I really appreciate your help! if your ever in NZ I'll buy you a beer!

Cheers
Craig Brown

Title: Re: Sets to HTML Links
Post by Mark Anderson on Sep 26th, 2008, 5:24pm

I may have a simpler route - not involving command line. Just passing a sample past Mark B.  If OK I'll post.

Title: Re: Sets to HTML Links
Post by Mark Anderson on Sep 28th, 2008, 8:54am

OK, here it is. Get the list_maker.tbx.zip from this page. The TBX should be fairly self explanatory.

Notes:
1. The technique assumes (and needs) that the set is holding actual note names.  If your desired source is a set based on some other attribute, make another user set attribute and use an action to make the latter hold the note name of all the notes in the former set.

2. Although initially I worked not allowing duplicate note names, if you enter paths where names might be duplicates the method seems to work.

Title: Re: Sets to HTML Links
Post by Craig Brown on Sep 29th, 2008, 3:44pm

Thanks Mark,
Have downloaded file and will have a good look at it as time allows.

Regards
Craig

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.