Custom fields; server-side implementations

3 views
Skip to first unread message

Brianna Laugher

unread,
Jun 25, 2008, 1:39:04 AM6/25/08
to Tiddl...@googlegroups.com
Hi,

I am dabbling in TiddlyWiki again :) Two questions.

1) Custom fields - I followed the first two instructions at
<http://www.tiddlywiki.org/wiki/Getting_started_with_custom_tiddler_fields>
(editing EditTemplate and ViewTemplate), and the field appears both in
view and edit mode. However the text I enter in the field is not saved
with the tiddler and never actually shows up in view mode (just the
label). Any ideas?

I am interested in quickly mocking up something kind of database-like.
I imagine each entry (tiddler) having attributes such as type, theme
and location. I could mark all these attributes through tags, possibly
using prefixes like loc:foo, theme:bar etc... but I am wondering if it
is better to separate those things into three separate fields (or
three separate tag fields?! would that be possible? seems like it
might be).

Say I were to use prefixes with tags; then I want to be able to list
all tiddlers that miss a particular prefixed tag. Is that possible?
Like 'list all tiddlers that have no tag with a loc: prefix'

2) Would any server-side implementation of TW result in smaller page
sizes? Or is the benefit just in multiple editors over http & (a
dubious benefit) storage in a database?

thanks,
Brianna


--
They've just been waiting in a mountain for the right moment:
http://modernthings.org/

Eric Shulman

unread,
Jun 25, 2008, 1:55:22 AM6/25/08
to TiddlyWiki
> 1) Custom fields - I followed the first two instructions at
> <http://www.tiddlywiki.org/wiki/Getting_started_with_custom_tiddler_fi...>
> (editing EditTemplate and ViewTemplate), and the field appears both in
> view and edit mode. However the text I enter in the field is not saved
> with the tiddler and never actually shows up in view mode (just the
> label). Any ideas?

Despite what is written in the TiddlyWiki.org article, custom fields
are case-sensitive... and, due to a bug in the core (see
http://trac.tiddlywiki.org/ticket/356), must currently be **all lower-
case**. If you use any upper-case letters in a field name, the value
isn't stored/retrieved properly, producing the (lack of) results that
you observed.

Except for this one limitation, custom fields work great.

enjoy,
-e

FND

unread,
Jun 25, 2008, 5:13:52 AM6/25/08
to Tiddl...@googlegroups.com
> 2) Would any server-side implementation of TW result in smaller page
> sizes?

At this point, I don't think any of the server-sides provide on-demand
loading (as that requires certain adjustments in the client-side
TiddlyWiki core).
This will be tackled at some point, but it's not a trivial issue to solve.

However, the IncludePlugin might be something to look into:
http://www.tiddlywiki.org/wiki/On-demand_Loading


-- F.

Brianna Laugher

unread,
Jun 25, 2008, 9:18:15 AM6/25/08
to Tiddl...@googlegroups.com
2008/6/25 Eric Shulman <elsd...@gmail.com>:

Brilliant, thanks. I updated the examples on the wiki page.

Thanks also to FND for your answer re: server side wikis.

cheers,

Brianna Laugher

unread,
Jun 25, 2008, 10:52:39 AM6/25/08
to Tiddl...@googlegroups.com
Another Q about custom fields.
I got them working thanks to Eric's advice.

Now I want to only display the label text in ViewTemplate, if the
field actually has some value.

I installed <http://mptw.tiddlyspot.com/#HideWhenPlugin> and tried this:

<div class="fieldurl" macro="hideWhen tiddler.fieldurl == ''">Link:
<span macro="view fieldurl"></span></div>

but still the text "Link:" always displays, even when the field is empty.

What should I have instead of <code> tiddler.fieldurl == '' </code> ?

FND

unread,
Jun 25, 2008, 10:57:24 AM6/25/08
to Tiddl...@googlegroups.com
> What should I have instead of <code> tiddler.fieldurl == '' </code> ?

Try this:
t.fields["url"] == ""

HTH.


-- F.

Eric Shulman

unread,
Jun 25, 2008, 10:58:18 AM6/25/08
to TiddlyWiki
> <div class="fieldurl" macro="hideWhen tiddler.fieldurl == ''">Link:
> <span macro="view fieldurl"></span></div>
> but still the text "Link:" always displays, even when the field is empty.
> What should I have instead of <code> tiddler.fieldurl == '' </code> ?

try

tiddler.fieldurl == null

-e

Brianna Laugher

unread,
Jun 25, 2008, 11:08:25 AM6/25/08
to Tiddl...@googlegroups.com
2008/6/26 FND <FN...@gmx.net>:

>
>> What should I have instead of <code> tiddler.fieldurl == '' </code> ?
>
> Try this:
> t.fields["url"] == ""
>

Syntax error.
Really - double quotes? This expression is already in a double quotes string.

Is 't' the same as 'tiddler'?

Brianna Laugher

unread,
Jun 25, 2008, 11:08:51 AM6/25/08
to Tiddl...@googlegroups.com
2008/6/26 Eric Shulman <elsd...@gmail.com>:

This succeeds in hiding the field permanently, not just when it is empty.

FND

unread,
Jun 25, 2008, 11:11:26 AM6/25/08
to Tiddl...@googlegroups.com
> Really - double quotes? This expression is already in a double quotes string.

Oh, I hadn't considered that - try single quotes then.

> Is 't' the same as 'tiddler'?

Sorry, my bad - that's supposed to be "tiddler".

If none of this works, could you provide us with a simple demo please
(e.g. on Tiddlyspot)?


-- F.

Brianna Laugher

unread,
Jun 25, 2008, 11:29:53 AM6/25/08
to Tiddl...@googlegroups.com
2008/6/26 FND <FN...@gmx.net>:

My housemate got it working, seems to be a matter of getting the right
nesting of single and double quotes. :)

<div class="fieldurl" macro='hideWhen tiddler.fields["fieldurl"] ==


""'>Link: <span macro="view fieldurl"></span></div>

Brianna

FND

unread,
Jun 25, 2008, 11:58:30 AM6/25/08
to Tiddl...@googlegroups.com
> My housemate got it working, seems to be a matter of getting the right
> nesting of single and double quotes. :)

Good.
By the way, it doesn't matter whether you nest single quote inside
double quotes or vice versa:
"foo 'bar' baz"
'foo "bar" baz'


-- F.

Reply all
Reply to author
Forward
0 new messages