Typowym zastosowaniem parametru _RowID jest użycie go do przekazywania w adresie URL identyfikatora rekordu w tabeli bazodanowej. Poniższy przykład demonstruje użycie metody url do prezentacji listy stron jPALIO oraz prezentacji szczegółów dotyczących każdej strony
$ifNull($_RowID, {
$=(@counter, 1)
$=(@page, (Object[])null)
<table border="1">
<tr>
<th>No</th>
<th>Page</th>
</tr>
$for(@page, $sql.read("select id, name from p_pages order by name", (Object[])null, [Long, String]), {
<tr>
<td align="right">$@counter</td>
<td align="left"><a href="$url($currentPageCode(), $@page[0])">$toHTML((String)$@page[1])</a></td>
</tr>
$++(@counter)
})
</table>
}, {
$=(@page, $sql.readLine("select name, code, is_protected, is_binary, no_checksum, req_unique_id from p_pages where id = ?", [$toLong((String)$_RowID)], [String, String, String, String, String, String]))
<table border="1">
<tr>
<td><b>Page name</b></td>
<td>$toHTML((String)$@page[0])</td>
</tr>
<tr>
<td><b>Page code</b></td>
<td>$@page[1]</td>
</tr>
<tr>
<td><b>Is protected</b></td>
<td>$if($==((String)$@page[2],"Y"),{yes},{no})</td>
</tr>
<tr>
<td><b>Is binary</b></td>
<td>$if($==((String)$@page[3],"Y"),{yes},{no})</td>
</tr>
<tr>
<td><b>Requires checksum</b></td>
<td>$if($==((String)$@page[4],"Y"),{no},{yes})</td>
</tr>
<tr>
<td><b>Requires unique identifier</b></td>
<td>$if($==((String)$@page[5],"Y"),{yes},{no})</td>
</tr>
</table>
<input type="button" value="Back" onclick="window.location='$url($currentPageCode())';">
})
Przykład użycia metod login i logout
$ifNull($user.userID(), {
$html.createForm("login_form", "login_form", $login($currentPageCode()), (String)null, (String)null, {
LOGIN: $html.loginField((String)null, 100, "LOGIN")
PASSWORD: $html.passwordField(100, "PASSWORD")
$html.submitButton("_UserLogin", "LOG IN")
}, {})
}, {
<input type="button" value="LOG OUT" onclick="window.location='$logout($currentPageCode())';">
})
Pobieranie aktualnych kursów walut
$=(@exchangeRatesHTML, $urlContent("http://www.nbp.pl/Kursy/KursyA.html"))
$=(@exchancheRatesXMLURL, $findRegex($@exchangeRatesHTML, "href=\"([^\\.]+.xml)\""))
$ifNotNull($@exchancheRatesXMLURL, {
$=(@exchangeRatesXML, $urlContent($+("http://www.nbp.pl", $@exchancheRatesXMLURL[1])))
$=(@exchangeRatesCodes, $xml.evaluateXPathAsNodesText($@exchangeRatesXML, "//pozycja/kod_waluty"))
$=(@exchangeRatesMultipilers, $xml.evaluateXPathAsNodesText($@exchangeRatesXML, "//pozycja/przelicznik"))
$=(@exchangeRatesAverages, $xml.evaluateXPathAsNodesText($@exchangeRatesXML, "//pozycja/kurs_sredni"))
$=(@exchangeRates, $emptyList())
$=(@exchangeRateCounter, 0)
$for($length($@exchangeRatesCodes), {
$util.add($@exchangeRates, [
$get($@exchangeRatesCodes, $@exchangeRateCounter),
$/($toBigDecimal((String)$get($@exchangeRatesAverages, $@exchangeRateCounter), "", ","), $toLong((String)$get($@exchangeRatesMultipilers, $@exchangeRateCounter)), 8)
])
$++(@exchangeRateCounter)
})
Current exchange rates: $asArray($@exchangeRates)
})