This plugin lets create pages with SQL statements and Freemarker HTML templates. Each page may contain one or more SQL fragments. Each fragment has its own HTML template.
Call an SQLPage is very simple :
jsp/site/Portal.jsp?page=sqlpage&sqlpage=mypage[¶m1=myparam1 ... ¶mN=myparamN]
Optional parameters can be passed to be used by SQL queries.
Templates are using Freemarker Template Engine syntax.
Table sample
The query : SELECT first_name, last_name FROM core_admin_user
The template :
<table> <thead> <tr> <th>Firstname</th> <th>Lastname</th> </tr> </thead> <tbody> <#list rows as row> <tr> <td>${row.cols[0]}</td> <td>${row.cols[1]}</td> </tr> </#list> </tbody> </table>
Form sample
The query : SELECT first_name, last_name FROM core_admin_user WHERE id_user = @param1@
This query shows how parameter given in the HTTP request can be used in the query.
The template :
<h1>User</h1> Firstname : ${rows[0].cols[0]} <br> Lastname : ${rows[0].cols[1]} <br>