ViewTemplate question

200 views
Skip to first unread message

History Buff

unread,
Nov 17, 2020, 3:57:44 PM11/17/20
to TiddlyWiki
Hello all,

I'm trying to put some content into a ViewTemplate and am having some difficulties with positioning. The attached screenshot is a single tiddler from my railroad research wiki. The infobox on the right is transcluded material. The text to the right of that is in the body of the tiddler. The tabs and stuff at the bottom are part of a ViewTemplate. What I would like to do, is to put the infobox into a ViewTemplate, but when I do, it won't position like it is in the screenshot. It is either above the body text or below the body text and not to the right of it. Is there a way to accomplish this? 

Thanks,

Damon
Screenshot 2020-11-17 135209.png

TW Tones

unread,
Nov 17, 2020, 6:07:49 PM11/17/20
to TiddlyWiki
Damon,

Have you tried changing the order of the items tagged $:/tags/ViewTemplate using the tag pill?

<<tag $:/tags/ViewTemplate>>

Once you resolve it you can use the list-before or list-after fields to set the order in place
eg
list-before $:/core/ui/ViewTemplate/body

Regards
Tones

History Buff

unread,
Nov 17, 2020, 6:11:22 PM11/17/20
to TiddlyWiki
Hey Tones,

Yes, I did try changing the order using the tag pill. That's how I moved it from above the body text to below.  There was no order that would put it in the position that I wanted. It seems that each ViewTemplate takes up its own horizontal space within the tiddler and that space occupies the full width.

Thanks,

Damon

TW Tones

unread,
Nov 18, 2020, 12:49:44 AM11/18/20
to TiddlyWiki
Ahhh,

Yes, you need to find a way to have the text you require inside the tiddler, as in your image, it is inside the tiddler.
  • You can hide the default body with a field hide-body=yes on a give tiddler, 
  • Then you introduce a replacement to display "the body" <$transclude field=text mode=block/> along side your extra content.
    • Perhaps create a table
    • or use the html aside tag.
Alternatively you could look at modifying the current $:/core/ui/ViewTemplate/body tiddler to include your additional content along side the existing <$transclude> therein.

Tones
Message has been deleted

History Buff

unread,
Nov 18, 2020, 6:15:33 PM11/18/20
to TiddlyWiki
Tones,

The aside element worked as long as it was above the transcluded body. The table didn't really work the way I wanted becuase, if the body text was very long, it wouldn't wrap around the infobox.

Now the only issue I have remaining is the map within the infobox. The link to the map is defined with a define statement within the body text, but using the method you outlined above prevents the link from being seen by the infobox. Is there another way I can define the link to the map that would work with your using the <transclude field=text mode=block/>?

History Buff

unread,
Nov 18, 2020, 6:16:59 PM11/18/20
to TiddlyWiki
I've also noticed that the styling I had with the infobox didn't get applied.

Damon

History Buff

unread,
Nov 18, 2020, 6:37:33 PM11/18/20
to TiddlyWiki
Here's an updated screenshot. I just now noticed that the bottom of the infobox overlaps the footer. 
Screenshot 2020-11-18 163614.png

TW Tones

unread,
Nov 18, 2020, 9:21:12 PM11/18/20
to TiddlyWiki
Buff,

If you place \defines in a tiddler tagged $:/tags/Macro it can be used by name globally, similarly css placed in a tiddler tagged $:/tags/Stylesheet will also be usable globally, this is the approach to use when you want to reuse.

Remember when using the  <transclude field=text mode=block/>  it assumes tiddler=<<currentTiddler>>, what is the current tiddler at the time? 
You do not show how you have coded the click here for map legend, but it sounds like to need to set or reference the correct tiddler.

I hope this is helping.

Tones 

History Buff

unread,
Nov 18, 2020, 10:27:22 PM11/18/20
to TiddlyWiki
You're right, I forgot to show my code which I now have below:

<aside style="float: right; margin-top: 0;">
<$transclude tiddler="Infobox">
</$transclude>
</aside>

<$transclude field=text mode=block/>

I can't have a globally defined map link because each railroad has a unique map.

I misspoke earlier. My infobox stylesheet is being used.

Damon

TW Tones

unread,
Nov 18, 2020, 11:09:24 PM11/18/20
to TiddlyWiki
Damon,

So as I understand it when you transclude  Infobox it is rendered with the current tiddler set to the tiddler in which your code snipit is written unless you take other steps to alter the currentTiddler, this is supported by the idea that  you subsequently transclude the text field presumable of the same tiddler.

How does Infobox determine the correct map tiddler to link to?

A global macro that references a field in the currentTiddler, will adapt to local content.

I do not have enough to help address your specific issues, but best of luck. Feel free to ask more.

Tones

History Buff

unread,
Nov 18, 2020, 11:16:35 PM11/18/20
to TiddlyWiki
I'm always terrible at giving enough information and I apologize. After some thinking about it, I finally figured out a way to do it. I put the map link in a field named maplink and then put {{!!maplink}} in the appropriate area of the infobox table. Works like a charm. Whether you directly solve my issue or not, you always get me thinking in the right direction for which I thank you. Highest regards, sir.

Damon
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
0 new messages