Friday, April 25, 2008

Another method for changing your edit template

This is more advanced and serves as a guide on installing your own tweaks as a theme.
  • Under tags tab click systemTheme
  • Click 'new here' and create 'MyCustomTheme'
  • Paste in the following:
|Name|MyCustomTheme|
|Description|My Custom Theme|
|PageTemplate|MptwTheme##PageTemplate|
|ViewTemplate|MptwTheme##ViewTemplate|
|EditTemplate|##EditTemplateTweaked|
|StyleSheet|##StyleSheet|

!EditTemplateTweaked
<!--{{{-->
<div class="toolbar" macro="toolbar +saveTiddler saveCloseTiddler closeOthers -cancelTiddler cancelCloseTiddler deleteTiddler"></div>
<div class="title" macro="view title"></div>
<div class="editLabel">Title</div><div class="editor" macro="edit title"></div>
<div macro='annotations'></div>
<div macro="showWhenExists EditPanelTemplate">[[EditPanelTemplate]]</div>
<div class="editLabel">Tags</div><div class="editor" macro="edit tags"></div> <!--- moved this above content --->
<div class="editorFooter"><span macro="message views.editor.tagPrompt"></span><span macro="tagChooser"></span></div>
<div class="editLabel">Content</div><div class="editor" macro="edit text"></div>
<!--}}}-->

!StyleSheet
/*{{{*/
[[MptwTheme##StyleSheet]] /* include MPTW styles */

.title { color:red; } /* or whatever */

/*}}}*/

  • Click done
  • Under options >> click 'select theme' and select your new theme
Notice that we're using the ViewTemplate and PageTemplate from the original MptwTheme. Cool huh? This kind of stuff has only become possible since TiddlyWiki 2.3.

5 comments:

simon said...

I made a mistake here and didn't move the editorFooter element. Thanks ariels for pointing that out. Also, note that you can quickly apply your new theme by clicking 'apply' in the tiddler toolbar.

Patrick said...

Any reason why these lines at the top of MptwUserConfigPlugin do not call MptwThemeCustom ?

config.options.txtTheme = 'MptwThemeCustom';

if (config.options.txtTheme == 'MptwTheme')
config.options.txtTheme = 'MptwThemeCustom';

thanks,

Patrick said...

yes, there is a reason.

The reason is the following:

In the MptwThemeCustom tiddler, replace the line:

[[MptwTheme##ViewTemplateToolbar]]

with:

[[MptwThemeCustom##ViewTemplateToolbar]]

simon said...

glad you figured it out. i think you could do it like this also

[[##ViewTemplateToolbar]]

Patrick said...

noted with thanks Simon!