Concatenate fields

268 views
Skip to first unread message

Ulrik Stervbo

unread,
Apr 4, 2014, 8:52:02 AM4/4/14
to tiddl...@googlegroups.com
Hello list,

I'm trying to generate a template to link to external files (I know this defeats the purpose of a single HTML but I expect to have a lot of images, pdfs and other things). To include PDfs I use: <object data={{!!filename}} type="application/pdf" width="100%" height="500px"/>

I would like to have the field 'filename' to contain just the file name and have another field 'path' which contains the (unchanging) path to a directory next to the tiddlywiki. How can I combine these two fields to generate a path with file name pointing to the data?

Cheers,
Ulrik

Danielo Rodríguez

unread,
Apr 4, 2014, 9:34:08 AM4/4/14
to tiddl...@googlegroups.com
It depends on how do you are going to use that, but you can use.
{{!!path}}{{!!filename}}


The question is, where is the path defined?

Ulrik Stervbo

unread,
Apr 4, 2014, 9:39:24 AM4/4/14
to tiddl...@googlegroups.com
I did try that but that doesn't work (<object data={{!!path}}{{!!filename}} type="application/pdf" width="100%" height="500px"/>).

The path is defined in a field in the tiddly. The file name is also defined in a field in the same tiddly


--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/-5SPFwSesZc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

cmari

unread,
Apr 4, 2014, 11:03:24 AM4/4/14
to tiddl...@googlegroups.com, ulrik....@gmail.com
I'm sure someone else could come up with something more elegant, but I think the method in this thread
https://groups.google.com/forum/?hl=en#!searchin/tiddlywiki/linkimage$20tw5/tiddlywiki/T4iAJWt4CdE/MFeao7hpvokJ
would work.  E.g.,

\define linkpdf(title)
<object data="file:///C:/somefolder/somotherfolder/$title$.pdf" type="application/pdf" width="100%" height="500px"/>

\end

<$macrocall $name=linkpdf title={{!!filename}}/>


cmari

Eric Shulman

unread,
Apr 4, 2014, 12:41:55 PM4/4/14
to tiddl...@googlegroups.com, ulrik....@gmail.com
On Friday, April 4, 2014 6:39:24 AM UTC-7, Ulrik Stervbo wrote:
I did try that but that doesn't work (<object data={{!!path}}{{!!filename}} type="application/pdf" width="100%" height="500px"/>).
The path is defined in a field in the tiddly. The file name is also defined in a field in the same tiddly

HTML syntax usually expects quotes around attribute values (e.g., data="....").  I'm not sure if this will help at all, but try adding quotes, like this:
 <object data="{{!!path}}{{!!filename}}" ...

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

YOUR DONATIONS ARE VERY IMPORTANT!
HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY "TIP JAR"...

Professional TiddlyWiki Consulting Services...
Analysis, Design, and Custom Solutions:

Ulrik Stervbo

unread,
Apr 5, 2014, 6:41:44 AM4/5/14
to cmari, tiddl...@googlegroups.com
Thanks!

\define linkpdf(title)
<object data="file:///C:/somefolder/somotherfolder/$title$.pdf" type="application/pdf" width="100%" height="500px"/>

\end

<$macrocall $name=linkpdf title={{!!filename}}/>
 
works nicely!

Adding quotes (<object data="{{!!path}}{{!!filename}}" ...) doesn't (that I had already tried out after realizing {{!!path}}{{!!filename}} also didn't work) - can it be the transclusion is ignored?

Cheers,
Ulrik

Danielo Rodríguez

unread,
Apr 5, 2014, 10:45:02 AM4/5/14
to tiddl...@googlegroups.com
Glad you finally got it working.

Why people is using macrocall instead of the simplest and efficient <<macroname>>

Stephan Hradek

unread,
Apr 5, 2014, 11:38:36 AM4/5/14
to tiddl...@googlegroups.com
Just try it and you'll notice the difference.
Reply all
Reply to author
Forward
0 new messages