Creating a new page layout, centered edition

As a follow-up to my topic for creating a centered layout, I was able to adapt this into a layout using the $:/tags/Layout alternative page layouts mechanism. It works by using a modified $:/core/ui/PageTemplate/story , that combines the sidebar with an additional div.

CenterPageLayout.tid (1.4 KB)
CenterPageStory.tid (695 Bytes)

My only problem is I would like to re-write this line in CenterPageLayout so it does not rely so heavily on using the title operator. I would like to store this list of tiddlers in a field in the same CenterPageLayout tiddler, but I haven’t been able to get this to work.

<$list filter="[title[$:/core/ui/PageTemplate/topleftbar]] [title[$:/core/ui/PageTemplate/toprightbar]] [title[CenterPageStory]] [title[$:/core/ui/PageTemplate/alerts]] [title[$:/core/ui/PageTemplate/drafts]] [title[$:/core/ui/PageTemplate/pluginreloadwarning]]" variable="listItem">

You don’t need write title operator every time becuase it is the default operator, and it a tiddler doesn’t have spaces in their title then you don’t need to use the square brackets either.

For you can use the list (of titles) of tiddlers stored in a field you can use the enlist operator. if I have understood correctly you would need something like [enlist{!!your_field}] where your_field is the field that stores the list of tiddlers

Here the documentation of both operators

Ditto what @Alvaro says.

Since System tiddlers do not normally contain spaces we can do this;

$:/core/ui/PageTemplate/topleftbar $:/core/ui/PageTemplate/toprightbar CenterPageStory $:/core/ui/PageTemplate/alerts $:/core/ui/PageTemplate/drafts $:/core/ui/PageTemplate/pluginreloadwarning

Or turn it into a macro, even a global macro;
\define tiddler-list() $:/core/ui/PageTemplate/topleftbar $:/core/ui/PageTemplate/toprightbar CenterPageStory ..........

Then to use the list in the variable use the enlist-input
{{{ [<tiddler-list>enlist-input[]] }}}

Other notes:

I these tiddlers were all ones created by you for the new layout,

  • Perhaps you should not use the prefix $:/core/ui/PageTemplate/ as this implies your tiddlers are in the $:/core plugin. I may use my “brand” PSaT and use $:/PSaT/centre-story/PageTemplate/… where centre-story is the project name.
  • You could create your own tag to replace $:/tags/PageTemplate with your own and tag the above tiddlers thus access the list with;
    • {{{ [all[shadows+tiddlers]tag[$:/tags/PageTemplate]] }}} we used shadows in case you package it in a plugin.

However if all you wanted to do is to replace $:/core/ui/PageTemplate/story with CenterPageStory you could do this by inserting it in the list. I am working through this now but it seems not to be what you need.

[Edited]

Here is an example of replacing one item in a list

<$list filter="[all[shadows+tiddlers]tag[$:/tags/PageTemplate]] +[search-replace[$:/core/ui/PageTemplate/story],[CenterPageStory]]">

</$list>

Inserting an item in a list

<$list filter="[all[shadows+tiddlers]tag[$:/tags/PageTemplate]] [[inserted title]] +[putafter[$:/core/ui/PageTemplate/story]]">

</$list>

As you can see with the examples of @TW_Tones you can do it in many ways, it depends on how you plan to change the filter.

We can also use enlist operator → [enlist<tiddler-list>]

Thank you for your suggestions. Unfortunately I’m having a bit of trouble getting any other solution to work other than a list of the tiddlers as the input of the filter. I would like to store the list in a field and use the enlist filter operator.

<$list filter="$:/core/ui/PageTemplate/topleftbar $:/core/ui/PageTemplate/toprightbar $:/core/ui/PageTemplate/story $:/core/ui/PageTemplate/alerts $:/core/ui/PageTemplate/drafts $:/core/ui/PageTemplate/pluginreloadwarning" variable="listItem">

I’ve tried it on TiddlyWiki.com so I know maybe there’s something influencing the list widget? Attached is a tid of the progress I’ve made so far.

CenterPageLayout-1.tid (1.6 KB)

Mark, It unfortunately remains unclear what you hare having difficulty with;

There are a few ways to set the list field;

  • Manually enter the list in a list field
  • Use a tag to represent a lists, all items have that tag. Re-ordering that list in the tagpill popup creates a list field on the tag tiddler.
  • Given a list in a variable, assign it to a field with actionsSetFeild in a button or trigger.
  • Using listops operators or widgets to add items to a list field.
  • Never store the list just generate it where needed as per many of my previous examples.

Could this be what you are looking for?

<$list filter={{CenterPageLayout!!list}} variable="listItem">

Warning I lost control of the wiki testing the above, no access the sidebar, return to the previous layout with ctrl-shift-L

Yes this works perfectly for me. I suppose I was trying to do it just with {{!!list}}, but doing it with {{CenterPageLayout!!list}} seems to work just fine.

It’s weird. It should work the field transclusion without indicate the name of the current tiddler. The transclusion works in the render of the tiddler and preview in edit mode but it doesn’t work in the layout.

Alvaro.

The layout is a wiki wide object like the side bar arguably currenttiddler is only within tiddlers in the story or within a list widget unless you set it with the tiddler widget.

So i am not supprised currentTiddler is not set in a layout which does not belong to a single tiddler.

I hope that helps expain it?

2 Likes