This question is answered. Helpful answers available: 0. Correct answers available: 1.


Permlink Replies: 29 - Pages: 2 [ 1 2 | Next ] - Last Post: 19 Apr 21, 14:52 Last Post By: JeffTucker Threads: [ Previous | Next ]
MarkusD

Posts: 567
Registered: 13-Apr-2006
How to use ${currentDate} ?
Posted: 16 Apr 21, 18:26
 
  Click to reply to this thread Reply
Hi,

I would like to include the creation date of the album in a comment of a folder. I use:

This album was created at: ${currentDate}.


What I get is:
This album was created at: ${currentDate}.


Not what I want. ;-)

I use jAlbum 23.2.4 an Tiger 2.14.5. Project file attached.

Thanks, Markus
JeffTucker

Posts: 7,905
Registered: 31-Jan-2006
Re: How to use ${currentDate} ?
Posted: 16 Apr 21, 18:34   in response to: MarkusD in response to: MarkusD
Helpful
  Click to reply to this thread Reply
Attachment ss008443.png (251.5 KB)
Works when I do it. In fact, I can't get it not to convert that variable into the current date. It uses the date format specified under Settings > Advanced > General > Date format.

ETA: It doesn't work if you use it in the Album description, however. Tiger doesn't pass that through the template processor (works in my skins, and in Laza's other skins).
MarkusD

Posts: 567
Registered: 13-Apr-2006
Re: How to use ${currentDate} ?
Posted: 16 Apr 21, 18:53   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
JeffTucker wrote:
ETA: It doesn't work if you use it in the Album description, however. Tiger doesn't pass that through the template processor (works in my skins, and in Laza's other skins).
Ahh, I would like to use that variable in the comment of a folder. A pity, that this is not possible. @Laza: Any chance to use variables also for folder comments? Thanks
JeffTucker

Posts: 7,905
Registered: 31-Jan-2006
Re: How to use ${currentDate} ?
Posted: 16 Apr 21, 18:55   in response to: MarkusD in response to: MarkusD
 
  Click to reply to this thread Reply
MarkusD wrote:
Ahh, I would like to use that variable in the comment of a folder.

That works just fine. See my screenshot. It works as a folder comment. Upon testing again, I find that it works in the Album description, as well.
JeffTucker

Posts: 7,905
Registered: 31-Jan-2006
Re: How to use ${currentDate} ?
Posted: 16 Apr 21, 19:01   in response to: JeffTucker in response to: JeffTucker
Helpful
  Click to reply to this thread Reply
A quick demo album:

(demo album deleted)
JeffTucker

Posts: 7,905
Registered: 31-Jan-2006
Re: How to use ${currentDate} ?
Posted: 16 Apr 21, 19:04   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Works in the title field as well as the comment field. Works in the Album title, too.
MarkusD

Posts: 567
Registered: 13-Apr-2006
Re: How to use ${currentDate} ?
Posted: 16 Apr 21, 19:08   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
JeffTucker wrote:
Works in the title field as well as the comment field. Works in the Album title, too.
I just used the variable in the sample album, and yes, it works. I attached my project file in my first post, can you see any option which might be the cause that this does not work in my current project? Thanks
MarkusD

Posts: 567
Registered: 13-Apr-2006
Re: How to use ${currentDate} ?
Posted: 16 Apr 21, 19:32   in response to: MarkusD in response to: MarkusD
 
  Click to reply to this thread Reply
JeffTucker

Posts: 7,905
Registered: 31-Jan-2006
Re: How to use ${currentDate} ?
Posted: 16 Apr 21, 20:20   in response to: MarkusD in response to: MarkusD
 
  Click to reply to this thread Reply
Well, whatever is going on, it appears to be specific to Tiger, so I'll move this thread.
JeffTucker

Posts: 7,905
Registered: 31-Jan-2006
Re: How to use ${currentDate} ?
Posted: 16 Apr 21, 20:29   in response to: MarkusD in response to: MarkusD
 
  Click to reply to this thread Reply
Attachment wrong.png (22.5 KB)
Attachment right.png (22.8 KB)
MarkusD wrote:
Strange. It works, in some way.

The failure is occurring when you have custom content that just calls ${description}. The skin doesn't do two passes through the template processor. See screenshots.
MarkusD

Posts: 567
Registered: 13-Apr-2006
Re: How to use ${currentDate} ?
Posted: 17 Apr 21, 10:11   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
JeffTucker wrote:
MarkusD wrote:
Strange. It works, in some way.
The failure is occurring when you have custom content that just calls ${description}. The skin doesn't do two passes through the template processor. See screenshots.
I fear that we are still talking past each other. My intention is to insert "${currentDate}" in a single comment of a folder/page, not on all pages. I've taken a few more screenshots that I hope show exactly what I mean.

http://www.markus-drueck.de/JA/How%20to%20use%20currentDate.zip

Thanks
Laza

Posts: 2,366
Registered: 6-Sep-2005
Re: How to use ${currentDate} ?
Posted: 17 Apr 21, 11:00   in response to: MarkusD in response to: MarkusD
 
  Click to reply to this thread Reply
If this doesn't work in the current Tiger it will in v3. All my other skin double-process captions.

End Jeff is right too. In order to use a variable in a comment the skin needs to double-process the template caption:

Template:
<h3>${title}</h3><p>${description}</p>

Now if the description contains ${currentDate} the final caption will show "${currentDate}", not the value of the currentDate variable.
<h3>Folder title</h3><p>Album made on: ${currentDate}</p>

A second round of processing is needed for this to work.

Edited by: Laza on 17 Apr 2021, 11:01
MarkusD

Posts: 567
Registered: 13-Apr-2006
Re: How to use ${currentDate} ?
Posted: 17 Apr 21, 11:02   in response to: Laza in response to: Laza
 
  Click to reply to this thread Reply
Laza wrote:
If this doesn't work in the current Tiger it will in v3. All my other skin double-process captions.
Prefect! So I'll wait for Tv3. :-)
JeffTucker

Posts: 7,905
Registered: 31-Jan-2006
Re: How to use ${currentDate} ?
Posted: 17 Apr 21, 13:49   in response to: Laza in response to: Laza
 
  Click to reply to this thread Reply
Laza wrote:
All my other skin double-process captions.

Instead of each skin having to do this, perhaps processTemplate() should do two passes. Or even better, it should be recursive. It would have to guard against endless recursion, of course - I could send it into a loop with little effort. ;)
RobM

Posts: 3,728
Registered: 4-Aug-2006
Re: How to use ${currentDate} ?
Posted: 17 Apr 21, 15:32   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Why can’t title, description and comment variables all be processed by the core, so any variables used are already translated to their values?
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums