Hi Eric and Okido

Had I known what Eric just told about the use of slices in this thread
- some few months ago - then I wouldn't even have bothered to start
learning how to make tables with fET...
With this simple script I can (almost) rewrite most of my fETs for
datavalues and fields in custom view and edittemplates to simple
slices instead...

My use of the script:
I have a TW for my students synopsisassignments which I share with a
censor...
In each students "tiddlercard" I have a <<notes>> - plugin for notes
and links to the synopsis which I share by link via DropBox.

I almost got a headache trying to figure out the fET for collecting
the data (which I would have to turn into filedvalues first) into a
sortable table. ;-)

Now I use Erics script instead - with slight modifications:

I write sth like this in a students <<notes>>tiddler:
Student: [[Studentname]]
Synopsis:[[Synopsis|http://dl.getdropbox.com/u/SomeName.pdf]]
/%
!Description
Some description
!end
%/

Then I make a tiddler for the collecting script:
<script>
   var out=[];
   var row='|%0|%1|%2|';
   out.push('| Student | Synopsis | Description |h'); // headings
   var tids=store.getTaggedTiddlers('Notes');
   for (var i=0; i<tids.length; i++) {
      var el=store.getTiddlerSlice(tids[i].title,'Student');
      var sy=store.getTiddlerSlice(tids[i].title,'Synopsis');
      var d='<<tiddler [['+tids[i].title+'##Description]]>>';
      out.push(row.format([el,sy,d]));
   }
   out.push('|sortable|k'); // table class
   return out.join('\n');
</script>

!One question:

One thing I miss though - it's numbers for rows and an endcount for
the table...
What would the script look like with numbers for each 'entry' and an
endcount for the table??

YS Måns Mårtensson

On May 29, 7:29 pm, Eric Shulman <[email protected]> wrote:
> > > I did something similar but used datatiddler plugin to store data in
> > > <data> .... </data>.
> > > Is there a particular reason why you use slices ?
>
> > Slices (and sections) are native TW syntax.  This makes it easier to
> > share your tiddlers with others without adding any extra plugin
> > dependencies.
>
> Addendum:
>
> If you want to *hide* the display of the slices or sections (similar
> to <data>...</data>), you can enclose them inside TW comment markers,
> like this:
>
> /%
> name:value
> name:value
> name:value
> %/
>
> and
>
> /%
> !sectionname
> ... multi-line content
> goes here...
> !end
> %/
>
> Note use of "!end" at the end of the section: each section in a
> tiddler starts with a line containing '!someName', and stops at the
> end of the tiddler OR at a line that contains another '!
> someOtherName'.  Thus, by putting !end following the section content,
> it ensures that the closing comment marker (%/) will not be included
> in that section when it is retrieved later on via <<tiddler
> TiddlerName##sectionname>>
>
> Also note that, if you are defining several sections in the same
> tiddler, you can write it like this:
>
> /%
> !sectionA
> foo
> !sectionB
> bar
> !sectionC
> mumble
> !end
> %/
>
> enjoy,
> -e
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/TiddlyWiki?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to