Search a database

We create a form that will submit the title of a page to the search SQLReport. This will search for an url in the WebGUI database wich looks like the title you submit.

Search for a page with title:

The form html looks like:

<form>
Search for a page with title: <input name="searchtitle" type="text" />
<input value="submit" type="submit" />
</form>

The placeholders are:

form:searchtitle
form:searchtitle

The query is: 

SELECT
title,
url
FROM
assetData
WHERE
title like concat('%',?,'%')
AND
? <> ''
AND
assetData.revisionDate = (SELECT MAX(maxAssetData.revisionDate) FROM assetData as maxAssetData where assetData.assetId=maxAssetData.assetId)

The template looks like:

<a name="id<tmpl_var assetId>" id="id<tmpl_var assetId>"></a>

<tmpl_if session.var.adminOn>
<p><tmpl_var controls></p>
</tmpl_if>

<tmpl_if displayTitle>
<h2><tmpl_var title></h2>
</tmpl_if>

<tmpl_if description>
<tmpl_var description>
<p />
</tmpl_if>

<tmpl_if debugMode>
<ul>
<tmpl_loop debug_loop>
<li><tmpl_var debug.output></li>
</tmpl_loop>
</ul>
</tmpl_if>

<tmpl_loop rows_loop>
<a href="<tmpl_var row.field.title.value>"><tmpl_var row.field.title.value></a><br />
</tmpl_loop>

Gadgets