Updating/refreshing embedded tiddlers.

3 views
Skip to first unread message

kaerazu

unread,
Feb 2, 2008, 10:31:47 AM2/2/08
to TiddlyWiki
This might be a really stupid question but I'm hoping someone can help
me out rather than me searching aimlessly until I get an answer.

Basically I have altered the load tiddler function so it alters a
global variable lastopenedtiddler.

I have a tiddler embedded in the page template file called
'historyviewer' which shows the history of pages that have been opened
and the display of it is determined by the variable lastopenedtiddler.

The problem is whenever I load a page I want to reload this tiddler.
Any ideas on any easy way to do this?
Cheers!

(code is below)
--------------

<html>
<div class='header' macro='gradient vert
[[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></
span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></
span>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></
span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></
span>
</div>
</div>

<!-- Added following div for hypergraph applet menuGraph custom shadow
tiddler -->
<div id='historyviewer' refresh='content' tiddler='historyviewer'></
div>

<div id='mainMenu' refresh='content' tiddler='MainMenu'></div>
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></
div>
<div id='sidebarTabs' refresh='content' force='true'
tiddler='SideBarTabs'></div>
</div>
<div id='displayArea'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
</html>

Eric Shulman

unread,
Feb 2, 2008, 10:54:10 AM2/2/08
to TiddlyWiki
> Basically I have altered the load tiddler function so it alters a
> global variable lastopenedtiddler.
> I have a tiddler embedded in the page template file called
> 'historyviewer' which shows the history of pages that have been opened
> and the display of it is determined by the variable lastopenedtiddler.
> The problem is whenever I load a page I want to reload this tiddler.

Have you tried:
http://www.TiddlyTools.com/#BreadcrumbsPlugin

This plugin tracks the *display* (not "load") of each and every
tiddler during the current browser session by 'hijacking' the core's
story.displayTiddler() function.

It renders a list of previously viewed tiddlers that can be
*automatically* added to the page layout without changing the
[[PageTemplate]], and/or added to specific tiddler content via the
<<breadCrumbs>> macro.

Also:
http://www.TiddlyTools.com/#BreadcrumbsCommand
which uses BreadcrumbsPlugin and InlineJavascriptPlugin to create a
"crumbs" command link that, when clicked, shows the current
breadcrumbs using a TW standard *popup* display. This command can be
easily added to any tiddler content (e.g., MainMenu) just by writing:
<<tiddler BreadcrumbsCommand>>
and can also be added to EVERY tiddler as a *toolbar command*, by
adding the following into your [[ViewTemplate]]:

<span class='toolbar' macro='tiddler BreadcrumbsCommmand'></span>

HTH,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

kaerazu

unread,
Feb 2, 2008, 10:59:40 AM2/2/08
to TiddlyWiki
Thanks Eric I will look at this however it's only a small part of the
plugin I'm trying to develop...

Is there any easy way to refresh a tiddler as above? I am quite new to
Tiddlywiki so would be good if I could work out how to do this.

Eric Shulman

unread,
Feb 2, 2008, 11:19:59 AM2/2/08
to TiddlyWiki
> Is there any easy way to refresh a tiddler as above? I am quite new to
> Tiddlywiki so would be good if I could work out how to do this.

Basically, you have to "hijack" displayTiddler to ADD functionality to
the standard handling, so that your 'historyviewer' DIV can be
refreshed each time a tiddler is displayed.

Something like this (note: untested code)

if (Story.prototype.myID_displayTiddler==undefined)
Story.prototype.myID_displayTiddler=Story.prototype.displayTiddler;
Story.prototype.displayTiddler = function()
{
// perform core display action
this.myID_displayTiddler.apply(this,arguments);
// refresh 'history viewer' DOM element
config.refreshers.content(document.getElementById('historyviewer'));
}

"myID" should be any UNIQUE text, used to ensure that YOUR hijack
doesn't collide with any other plugins that *also* hijack
displayTiddler().

kaerazu

unread,
Feb 2, 2008, 12:31:04 PM2/2/08
to TiddlyWiki
Brilliant! That seems to have done the trick. Thanks Eric
Reply all
Reply to author
Forward
0 new messages