Link with variable field to point URL in list tiddler ?

129 views
Skip to first unread message

Sylvain Naudin

unread,
Mar 8, 2020, 5:41:44 PM3/8/20
to TiddlyWiki
Hello,

I can't figure how to do this after many attempts, sorry if the title is not clear ^-^'

I'm working on a Contact TiddlyWiki, to store mail, phone, and other ID of people.
I'm store a login forum user in a field called forum, for example PrenomNom.
Then, in a html table, I list all tiddler by filter with a tag to view this field, but I want a direct link to profile user URL of the forum.
For now I store long URL in my fields, but wanted it shorter an try without success with a macro or template tiddler.


Cheers,
Sylvain

Mat

unread,
Mar 8, 2020, 5:50:37 PM3/8/20
to TiddlyWiki
Your description is somewhat unclear but here's a guess:

\define mymacro() [[shortname|$(url)$]]

<$list ...... >
<$vars url={{!!url}}><<mymacro>></$vars>
</$list>

<:-)

Sylvain Naudin

unread,
Mar 8, 2020, 6:35:28 PM3/8/20
to TiddlyWiki
Yes sorry if it is not clear, I'll upload an example soon.

Just to complete, URL is static, so I'll not use !!url but !!user instead.

Sylvain Naudin

unread,
Mar 9, 2020, 2:40:34 AM3/9/20
to tiddl...@googlegroups.com


Le dimanche 8 mars 2020 23:35:28 UTC+1, Sylvain Naudin a écrit :
Yes sorry if it is not clear, I'll upload an example soon.

Just to complete, URL is static, so I'll not use !!url but !!user instead.


So, for example, I've several tiddlers member of organisation, and most of then have a forum account :


I my 'forum' fiel, today I have to put long URL, but I want only to store user.

So instead https://forum.tiddlywiki.fr/u/Sylvain, I want Sylvain.

After that, in a tiddler witch filter my tag and field, I want that my user forum field to be accessible via URL, but not like that :



But like this :


So I have to store somewhere kind a macro or transclude code to concatenate static URL with my user forum in a URL, so it's simple, but can't do that.. :(

My actual code on Forum tiddler :


<table class="ms-table ms-striped">
<thead><tr>
<th><<fa user-circle>> Intervenant·e·s</th>
<th>Forum</th>
</tr></thead>
<tbody>
<$list filter="[tag[Annuaire]sort[title]]">
<tr>
<td><$link><$view field="title"/></$link></td>
<td><$transclude field="forum"/></td>
</tr>
</$list>
 
</tbody>
</table>



Best regards
Sylvain

Mat

unread,
Mar 9, 2020, 12:32:38 PM3/9/20
to TiddlyWiki
OK, so maybe this:



\define mymacro() [[user|$(nom)$]]

....

<$list filter="[tag[Annuaire]sort[title]]">
<tr>
<td><$link/></td>
<$set name=nom filter="[{!!url}removeprefix[https://forum.tiddlywiki.fr/u/]]>
<$set name=prettylink value=<<mymacro>>>
<td><<prettylink>></td>
</$set>
</$set>
</tr>
</$list>
...

<:-)

Sylvain Naudin

unread,
Mar 9, 2020, 5:36:17 PM3/9/20
to TiddlyWiki
Nope, sorry, it gives me error about <$set and don't execute it, also it seem to don't understand removeprefix.

And I guess in your example user is not a variable, but it's my !!forum user in my example, so it's dynamic to and I have no !!url field, bref.. ;-)

At the moment, I can just return URL like this (but not like I want) :

\define link(site, user)
$site$$user$
\end

\define url(site:"https://forum.tiddlywiki.fr/u/", user)
<$macrocall $name="link" site="$site$" user="$user$" />
\end



<$list filter="[tag[Annuaire]sort[title]]">
<tr>
<td><$link/></td>
<td><$macrocall $name="url" user={{!!forum}} /></td>
</tr>
</
$list>

But it's not my first intention. Have to put a file to share and demo.
Sylvain

Sylvain Naudin

unread,
Mar 9, 2020, 5:59:27 PM3/9/20
to TiddlyWiki
I've upload an extract here : https://tw5.xyz/Annuaire/contact.html


I hope it will clearer :)
Sylvain

Mohammad

unread,
Mar 10, 2020, 12:21:22 AM3/10/20
to TiddlyWiki
Beautiful TW site! Good luck Sylvain!

I edited your Forum tiddler: https://tw5.xyz/Annuaire/contact.html#Forum as below

\define urln() $(forumUrl)$$user$

!<<fa id-card>> Tableau

<table class="ms-table ms-striped">
<thead><tr>
<th><<fa user-circle>> Intervenant·e·s</th>
<th>Forum</th>
</tr></thead>
<tbody>
<$list filter="[tag[Annuaire]sort[title]]">
<tr>
<td><$link/></td>
<td>
<$vars user={{!!forum}} >
<a target="_blank" href=<<urln>> >{{!!forum}}</a>
</$vars>
</td>
</tr>
</$list>
 </tbody>
</table>



and it works as you like :-)

--Mohammad

Sylvain Naudin

unread,
Mar 10, 2020, 2:20:39 AM3/10/20
to TiddlyWiki


Le mardi 10 mars 2020 05:21:22 UTC+1, Mohammad a écrit :
Beautiful TW site! Good luck Sylvain!


Thank you Mohammad :)



I edited your Forum tiddler: https://tw5.xyz/Annuaire/contact.html#Forum as below

\define urln() $(forumUrl)$$user$

!<<fa id-card>> Tableau

<table class="ms-table ms-striped">
<thead><tr>
<th><<fa user-circle>> Intervenant·e·s</th>
<th>Forum</th>
</tr></thead>
<tbody>
<$list filter="[tag[Annuaire]sort[title]]">
<tr>
<td><$link/></td>
<td>
<$vars user={{!!forum}} >
<a target="_blank" href=<<urln>> >{{!!forum}}</a>
</$vars>
</td>
</tr>
</$list>
 </tbody>
</table>



and it works as you like :-)

--Mohammad



I just test your proposal, but.. it gave me 'https://forum.tiddlywiki.fr/u/$user$' and no real address. This is madness ! :D Arrhhgg.
I've upload this version if you can check.
Thanks

Mohammad

unread,
Mar 10, 2020, 2:24:51 AM3/10/20
to TiddlyWiki
Lets see! I check the old version and it worked!
Wait few minutes!

Mohammad

unread,
Mar 10, 2020, 2:26:36 AM3/10/20
to tiddl...@googlegroups.com
Sylvain

replace
\define urln() $(forumUrl)$$user$



with
\define urln() $(forumUrl)$$(user)$

Let me know how's it going!

--Mohammad

Sylvain Naudin

unread,
Mar 10, 2020, 3:01:24 AM3/10/20
to TiddlyWiki


Le mardi 10 mars 2020 07:26:36 UTC+1, Mohammad a écrit :
Sylvain

replace
\define urln() $(forumUrl)$$user$



with
\define urln() $(forumUrl)$$(user)$

Let me know how it is going!

--Mohammad



Yes ! of course, thank you !

Later I'll do the same for my wiki user, and it's camel case, so I think I'll uncheck it in control panel.

Again, thank you, have a great day.
Sylvain
Reply all
Reply to author
Forward
0 new messages