Hi Tobbe,

A) You could use HideWhenPlugin[1] to configure your ViewTemplate such
that for a tiddler tagged "person" you would have two div elements
floating-left, populated with the contents of certain sections of your
person-tiddler.

<div macro="showWhenTagged person">
  <div class="p_birth" macro="tiddler {{tiddler.title+'##Birth'}}"></
div>
  <div class="p_death" macro="tiddler {{tiddler.title+'##Death'}}"></
div>
  <div class="p_more" macro="tiddler {{tiddler.title
+'##SomeOtherSectionToBeShownBelow'}}"></div>
</div>
<div macro="else">
  <div class='viewer' macro='view text wikified'></div>
</div>

So your StyleSheet could read:

.p_birth, .p_death{float:left;width:48%;margin:0;padding:5px 1%;}
.p_birth {backgorund:#dfd;}
.p_death {backgorund:#fdd;}
.p_more{clear:both;}

Note how this would mean that for a person-tiddler you would only show
those sections that are specifically declared to be shown in your
ViewTemplate.


B) However, all of this wouldn't be helpful if you would have to
extract your information from tiddler fields... if that were so, I
would probably set up a transclusion called BirthDeathInfo using
InlineJavascriptPlugin [2] that would be fed with an input parameter
of the person-tiddler that you want to display information for, then
have it fetch the data from the fields while outputting the
information into pre-formatted blocks, like so...

<script>
var tid='$1';if (tid=='$'+'1')return; //tiddler title -> none? -> get
out!
var out="{{p_birth{\n''birth:'' %0\n}}}{{p_death{\n''death:''
%1\n}}}"; //output format
var b=store.getValue(tid,'birth_field_name"); //get birth
var d=store.getValue(tid,'death_field_name");  //get death
return out.format([b,d]); //insert info into template and output
results
</script>

...and then invoke that script in the ViewTemplate again using
HideWhenPlugin, just like above, via:

<div macro="showWhenTagged person">
  <div macro="tiddler BirthDeathInfo with: {{tiddler.title}}"></div>
</div>
<div class='viewer' macro='view text wikified'></div>

This is a much better approach as any additional tiddler text would be
shown as usual. I hope, all that wasn't too confusing.


Tobias.


[1] http://mptw.tiddlyspot.com/#HideWhenPlugin
[2] http://tiddlytools.com/#InlineJavascriptPlugin

-- 
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