On Feb 12, 2012, at 11:10 AM, <ricardo.julio.rodriguez.fernan...@sergas.es> 
wrote:

> 
> Good morning!
> 
> I'm trying to move a simple script from XWiki 1.0 Syntax to 2.0 one. It 
> includes this lines with which I can easily use SQL to retrieve pages and 
> present a list of URLs to reach those pages:
> 
> db2 = Sql.newInstance("jdbc:mysql://hostname/schema", "ROuser", "readonly", 
> "com.mysql.jdbc.Driver")
> List areas = db2.rows('select...
> println areas.collect{"<a 
> href='../XWiki/${it.XWD_NAME}'>${it.XWD_TITLE}</a>"}.join("<br>")

This will generate HTML so you'll need to wrap it in the {{html}} macro.

{{groovy}}
…
println "{{html}}<your html here<{{/html}}"
{{/groovy}}

Hope it helps,
-Vincent

> As I'm having problems to include both Velocity (for instance, to control the 
> information panel visibility) and Groovy scripts in the same page when using 
> 1.0 syntax, I'm trying to move it to 2.0. But using the same lines results in 
> that exact text being displayed in the page, but not the URL showed in 1.0 
> syntax.
> 
> Please, could you tell me how could I get the same results with XWiki 2.0 
> syntax? Thanks!!!
> 
> I know there are a lot of different methods to get the same results within 
> XWiki, but using SQL in this case is useful to me now as kind of probe of 
> concept showing how easily could we link to "external" datasources by using 
> XWiki.
> 
> --
> Ricardo Rodríguez
> Research Management and Promotion Technician
> Health Research Institute of Santiago de Compostela (IDIS)
> http://www.idisantiago.es
> 
> Nota: A información contida nesta mensaxe e os seus posibles documentos 
> adxuntos é privada e confidencial e está dirixida únicamente ó seu 
> destinatario/a. Se vostede non é o/a destinatario/a orixinal desta mensaxe, 
> por favor elimínea. A distribución ou copia desta mensaxe non está autorizada.
> 
> Nota: La información contenida en este mensaje y sus posibles documentos 
> adjuntos es privada y confidencial y está dirigida únicamente a su 
> destinatario/a. Si usted no es el/la destinatario/a original de este mensaje, 
> por favor elimínelo. La distribución o copia de este mensaje no está 
> autorizada.
> 
> See more languages: http://www.sergas.es/aviso_confidencialidad.htm
> _______________________________________________
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users

_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to