We modified the blog-posts-titles.vm which in confluence-advanced-macros-x.x.x.x.jar to fulfill our needs.
One requirement is to show an icon if the blogpost's creation date + 14d <=current date.
But i cannot find out how to get current date in velocity template and use it in if-then syntax.
In http://www.java2s.com/Code/Java/Velocity/HowtouseDateinVelocity.htm<sup></sup> it seems to use "$date" can get it, but i failed.
Can you tell me how to get current date?
Thanks a lot!.
Community moderators have prevented the ability to post new answers.
To get hold of the current date in java you would create a new Date() object, unfortunatley it's not possible to construct new objects in velocity without a factory method.
If you were able to use wiki-markup and had the builder theme installed then I would suggest the following:
{code}
{builder-show:olderthan=14d}Content is more than 14 days old{builder-show}
{code}
http://www.adaptavist.com/display/Builder/builder-show+macro
Than you for the advice, Builder theme is a great plugin.
As the velocity factory method, did you mean velocity-tools-x.x.jar? Can i just copy the jar file to \lib directory and use "$date" to get current date? But I cannot find velocity-tools-1.x.jar, I'm afraid velocity-tools-2.0.jar cannot work with Confluence 3.0.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for your advice.
Builder theme is a great plugin and we using it in other situation.
But in this case, it seem's can not add an icon to some blogpost titles in a list.
As the velocity factory method, did you mean velocity-tools-x.x.jar? Can i just copy the jar file to \lib directory and use "$date" to get current date? But I cannot find velocity-tools-1.x.jar, I'm afraid velocity-tools-2.0.jar cannot work with Confluence 3.0...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.