[xwiki-devs] Velocity in title
Hi all! Please, is possible to include Velocity script in documents' title of a 1.3.8295 installation? Thanks! Cheers, Ricardo -- Ricardo Rodríguez CTO eBioTIC. Life Sciences, Data Modeling and Information Management Systems
On Oct 6, 2010, at 11:32 AM, [Ricardo Rodriguez] eBioTIC. wrote:
Hi all!
Please, is possible to include Velocity script in documents' title of a 1.3.8295 installation? Thanks!
Do I assume that you've tried and it doesn't work? What did you try and what happens? Thanks -Vincent
Cheers,
Ricardo
Hi! Vincent Massol wrote:
Do I assume that you've tried and it doesn't work? What did you try and what happens?
Sorry for being too poor in my previous message. I've tried and all what I see is the code. For instance, if I set a value of a variable in the body of document and I include it in the title, I see the name of the variable, not its value. Please, see: http://xepecnet.environmentalchange.net/xwiki/bin/view/Draft/VelocityConcate... It must be related with how the use of different renderers work with different parts of a document. We are moving to a 2.x environment, so, in this case, it will be great to have this working in this plain old 1.3.x installation and I think that it will be good for my own understanding of the new rendering architecture, but is by no means a blocker for us. Thanks for your insight! Ricardo -- Ricardo Rodríguez CTO eBioTIC. Life Sciences, Data Modeling and Information Management Systems
The same in a 2.4.x installation... clearly I'm failing to understand something. I'll be back to this issue in a couple of hours! http://core.ebiotic.net/bin/Draft/VelocityConcatenation Thanks! [Ricardo Rodriguez] eBioTIC. wrote:
Hi!
Vincent Massol wrote:
Do I assume that you've tried and it doesn't work? What did you try and what happens?
Sorry for being too poor in my previous message. I've tried and all what I see is the code. For instance, if I set a value of a variable in the body of document and I include it in the title, I see the name of the variable, not its value. Please, see:
http://xepecnet.environmentalchange.net/xwiki/bin/view/Draft/VelocityConcate...
It must be related with how the use of different renderers work with different parts of a document. We are moving to a 2.x environment, so, in this case, it will be great to have this working in this plain old 1.3.x installation and I think that it will be good for my own understanding of the new rendering architecture, but is by no means a blocker for us. Thanks for your insight!
Ricardo
-- Ricardo Rodríguez CTO eBioTIC. Life Sciences, Data Modeling and Information Management Systems
One thing is sure: this can't work in 1.x, since the title is displayed before the content is parsed, so the velocity variables get their values after you display the title. In 2.4 the title is printed after rendering the content, so it does work, but the breadcrumbs are still printed before the content, so that fails. So, to see if Velocity does work in your version, try using $doc.author as the title and see what gets printed. If it's the literal '$doc.author', then velocity isn't interpreted. If it prints a username, like 'XWiki.Admin', then it is interpreted, and the problem is that you're trying to use not-yet-defined variables. On 10/06/2010 12:40 PM, [Ricardo Rodriguez] eBioTIC. wrote:
The same in a 2.4.x installation... clearly I'm failing to understand something. I'll be back to this issue in a couple of hours!
http://core.ebiotic.net/bin/Draft/VelocityConcatenation
Thanks!
[Ricardo Rodriguez] eBioTIC. wrote:
Hi!
Vincent Massol wrote:
Do I assume that you've tried and it doesn't work? What did you try and what happens?
Sorry for being too poor in my previous message. I've tried and all what I see is the code. For instance, if I set a value of a variable in the body of document and I include it in the title, I see the name of the variable, not its value. Please, see:
http://xepecnet.environmentalchange.net/xwiki/bin/view/Draft/VelocityConcate...
It must be related with how the use of different renderers work with different parts of a document. We are moving to a 2.x environment, so, in this case, it will be great to have this working in this plain old 1.3.x installation and I think that it will be good for my own understanding of the new rendering architecture, but is by no means a blocker for us. Thanks for your insight!
Ricardo
-- Sergiu Dumitriu http://purl.org/net/sergiu/
Hello, I took a look over this document: http://core.ebiotic.net/bin/edit/Draft/VelocityConcatenation and what I saw there is the fact that in the title there are 2 variables that you defined in the page content. The issue here is related to (as Sergiu said) some undefined variables. The title can contain only XWiki default variables (like $doc, $msg, $context ...) unless you define the variables somewhere in a template in a way that they will be available (defined) before displaying the title. See for example contentview.vm template. It contains the code for displaying the title of the current document. If you define those 2 variables in this template (before displaying the title), you will get the expected result. Raluca. On Wed, Oct 6, 2010 at 1:52 PM, Sergiu Dumitriu <[email protected]> wrote:
One thing is sure: this can't work in 1.x, since the title is displayed before the content is parsed, so the velocity variables get their values after you display the title.
In 2.4 the title is printed after rendering the content, so it does work, but the breadcrumbs are still printed before the content, so that fails.
So, to see if Velocity does work in your version, try using $doc.author as the title and see what gets printed. If it's the literal '$doc.author', then velocity isn't interpreted. If it prints a username, like 'XWiki.Admin', then it is interpreted, and the problem is that you're trying to use not-yet-defined variables.
On 10/06/2010 12:40 PM, [Ricardo Rodriguez] eBioTIC. wrote:
The same in a 2.4.x installation... clearly I'm failing to understand something. I'll be back to this issue in a couple of hours!
http://core.ebiotic.net/bin/Draft/VelocityConcatenation
Thanks!
[Ricardo Rodriguez] eBioTIC. wrote:
Hi!
Vincent Massol wrote:
Do I assume that you've tried and it doesn't work? What did you try and what happens?
Sorry for being too poor in my previous message. I've tried and all what I see is the code. For instance, if I set a value of a variable in the body of document and I include it in the title, I see the name of the variable, not its value. Please, see:
http://xepecnet.environmentalchange.net/xwiki/bin/view/Draft/VelocityConcate...
It must be related with how the use of different renderers work with different parts of a document. We are moving to a 2.x environment, so, in this case, it will be great to have this working in this plain old 1.3.x installation and I think that it will be good for my own understanding of the new rendering architecture, but is by no means a blocker for us. Thanks for your insight!
Ricardo
-- Sergiu Dumitriu http://purl.org/net/sergiu/ _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
Raluca Stavro wrote:
Hello,
I took a look over this document: http://core.ebiotic.net/bin/edit/Draft/VelocityConcatenation and what I saw there is the fact that in the title there are 2 variables that you defined in the page content. The issue here is related to (as Sergiu said) some undefined variables. The title can contain only XWiki default variables (like $doc, $msg, $context ...) unless you define the variables somewhere in a template in a way that they will be available (defined) before displaying the title.
As stated in previous messages, the title seems no be the problem here: variables defined in the content are usable in the title of a document because, as Sergiu said, the title is rendered after the contents. He problem seems to be how to do the same in the breadcrumbs taking into account that is information contained in the document and/or properties of classes instantiated in it which I'm trying to show there. Does it makes sense to you to printed both title and breadcrumbs after document content? Thanks!
See for example contentview.vm template. It contains the code for displaying the title of the current document. If you define those 2 variables in this template (before displaying the title), you will get the expected result.
I've used this idea to recover visibility of attachments, history, comments and information in EPECnetwork by setting showattachments, showcomments, showinformation and showhistory to yes conditioned by #if($hasEdit) in contentview.vm I'm still not able to discover how the visibility of these panes are controlled ther. Thank you soon much for your help!
Raluca.
On Wed, Oct 6, 2010 at 1:52 PM, Sergiu Dumitriu <[email protected]> wrote:
One thing is sure: this can't work in 1.x, since the title is displayed before the content is parsed, so the velocity variables get their values after you display the title.
In 2.4 the title is printed after rendering the content, so it does work, but the breadcrumbs are still printed before the content, so that fails.
So, to see if Velocity does work in your version, try using $doc.author as the title and see what gets printed. If it's the literal '$doc.author', then velocity isn't interpreted. If it prints a username, like 'XWiki.Admin', then it is interpreted, and the problem is that you're trying to use not-yet-defined variables.
On 10/06/2010 12:40 PM, [Ricardo Rodriguez] eBioTIC. wrote:
The same in a 2.4.x installation... clearly I'm failing to understand something. I'll be back to this issue in a couple of hours!
http://core.ebiotic.net/bin/Draft/VelocityConcatenation
Thanks!
[Ricardo Rodriguez] eBioTIC. wrote:
Hi!
Vincent Massol wrote:
Do I assume that you've tried and it doesn't work? What did you try and what happens?
Sorry for being too poor in my previous message. I've tried and all what I see is the code. For instance, if I set a value of a variable in the body of document and I include it in the title, I see the name of the variable, not its value. Please, see:
http://xepecnet.environmentalchange.net/xwiki/bin/view/Draft/VelocityConcate...
It must be related with how the use of different renderers work with different parts of a document. We are moving to a 2.x environment, so, in this case, it will be great to have this working in this plain old 1.3.x installation and I think that it will be good for my own understanding of the new rendering architecture, but is by no means a blocker for us. Thanks for your insight!
Ricardo
-- Sergiu Dumitriu http://purl.org/net/sergiu/
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Ricardo Rodríguez CTO eBioTIC. Life Sciences, Data Modeling and Information Management Systems
Sergiu Dumitriu wrote:
One thing is sure: this can't work in 1.x, since the title is displayed before the content is parsed, so the velocity variables get their values after you display the title.
In 2.4 the title is printed after rendering the content, so it does work, but the breadcrumbs are still printed before the content, so that fails.
So, to see if Velocity does work in your version, try using $doc.author as the title and see what gets printed. If it's the literal '$doc.author', then velocity isn't interpreted. If it prints a username, like 'XWiki.Admin', then it is interpreted, and the problem is that you're trying to use not-yet-defined variables.
I think the situation is clear and Velocity does work here. As you said and coming back to the example... http://core.ebiotic.net/bin/Draft/VelocityConcatenation ... the variables defined in the content of the document are correctly printed in the title but not in the breadcrumbs. It works as expected because, as you said, the title is printed after rendering the content but the breadcrumbs are printed before that. As what I'm looking for is to include in the breadcrumbs variables defined in the content or values of properties of classes instantiated in the current document, I think the only solution is to get the breadcrumbs printed after the contents. Please, does it make sense for you? Could this be possible/advisable with the current rendering architecture? Thanks! Ricardo
On 10/06/2010 12:40 PM, [Ricardo Rodriguez] eBioTIC. wrote:
The same in a 2.4.x installation... clearly I'm failing to understand something. I'll be back to this issue in a couple of hours!
http://core.ebiotic.net/bin/Draft/VelocityConcatenation
Thanks!
[Ricardo Rodriguez] eBioTIC. wrote:
Hi!
Vincent Massol wrote:
Do I assume that you've tried and it doesn't work? What did you try and what happens?
Sorry for being too poor in my previous message. I've tried and all what I see is the code. For instance, if I set a value of a variable in the body of document and I include it in the title, I see the name of the variable, not its value. Please, see:
http://xepecnet.environmentalchange.net/xwiki/bin/view/Draft/VelocityConcate...
It must be related with how the use of different renderers work with different parts of a document. We are moving to a 2.x environment, so, in this case, it will be great to have this working in this plain old 1.3.x installation and I think that it will be good for my own understanding of the new rendering architecture, but is by no means a blocker for us. Thanks for your insight!
Ricardo
-- Ricardo Rodríguez CTO eBioTIC. Life Sciences, Data Modeling and Information Management Systems
participants (4)
-
[Ricardo Rodriguez] eBioTIC. -
Raluca Stavro -
Sergiu Dumitriu -
Vincent Massol