Hi,
I’m new to TW and trying to get my head round transclusion and templates. Perhaps someone might be able to help.
The Use Case: I’m using TW to set up a system for managing online students and their lessons. For each student tiddler it should contain a list of the lesson they have received (links to tagged tiddlers with the student name as the tag. This works using:
<<list-links "[tag[Peter]tag[Lesson]]">>
where Peter is the name of the student as a tag.
But, I’ve been reading about templates etc … and have set up a StudentInformationTemplate and transcluded (?) that into each of the Student tiddlers (and set this to be included via the ViewTemplate).
Some success with showing the information fields for that student:
<table>
<tr>
<th>Email</th><td><a href="mailto:{{!!email}}">{{!!email}}</a></td>
</tr>
<tr>
<th>Parent</th><td>{{!!parent}}</td>
</tr>
<tr>
<th>Parent Email</th><td><a href="mailto:{{!!parent-email}}">{{!!parent-email}}</a></td>
</tr>
</table>
So what I’d also like to do is include a list of all the lessons for that student in the StudentInformationTemplate. Something like:
<h2> Lessons </h2>
<<list-links filter: "[tag[Lesson]!sort[lesson-date]]" >>
<ul>
<$list filter="[tag[Lesson]!sort[lesson-date]]" variable="lesson">
<li><$link to=<<lesson>>/></li>
</$list>
</ul>
But this displays all tiddlers tagged with “Lesson” of course. What I’d like is only those lessons for the selected student, so when displaying Peter’s tiddler it calls on the StudentInformationTemplate to show only the lessons for Peter or Bob or whoever. Each lesson is on a separate Tiddler - I suspect this is the issue that I cannot quote work out!
Can that be done?