v5:addons:addons_index
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
v5:addons:addons_index [2018/07/01 22:07] – prefer functions start lowercase (#430) peterdd | v5:addons:addons_index [2023/05/12 19:12] (current) – [Paging & Scrolling with ADOdb Pager] move screenshot before code snippet dregad | ||
---|---|---|---|
Line 179: | Line 179: | ||
This addon provides an interface between the adodb recordset and the php xmlrpc library. [[v5: | This addon provides an interface between the adodb recordset and the php xmlrpc library. [[v5: | ||
----------------------------- | ----------------------------- | ||
+ | |||
+ | ===== Paging & Scrolling with ADOdb Pager ===== | ||
+ | |||
<WRAP right box> | <WRAP right box> | ||
== Requires == | == Requires == | ||
adodb-pager.inc.php | adodb-pager.inc.php | ||
</ | </ | ||
- | ===== Paging & Scrolling with ADOdb Pager ===== | ||
- | The following code creates a very simple | + | The following code snippet |
- | ---------------------------------- | + | |
+ | {{: | ||
+ | <WRAP clear/> | ||
<code php> | <code php> | ||
include_once ' | include_once ' | ||
include_once ' | include_once ' | ||
- | session_start(); | + | $db = ADONewConnection(' |
- | $db = newADOConnection('mysql'); | + | $db-> |
- | $db-> | + | $sql = 'select * from adoxyz'; |
- | + | ||
- | $sql = "select * from adoxyz | + | |
- | + | ||
- | $pager = new ADODB_Pager($db, | + | |
- | + | ||
- | $pager-> | + | |
+ | $pager = new ADODB_Pager($db, | ||
+ | $pager-> | ||
</ | </ | ||
- | This will create a basic record pager that looks like this: | ||
- | |< << | + | The number of rows to display at one time is controled by the //Render($rows)// method. If you do not pass any value to Render(), |
- | + | ||
- | ^ID^First Name^Last Name^Date Created^ | + | |
- | |36|Alan|Turing|Sat 06, Oct 2001| | + | |
- | |37|Serena|Williams|Sat 06, Oct 2001| | + | |
- | |38|Yat Sun|Sun|Sat 06, Oct 2001| | + | |
- | |39|Wai Hun|See|Sat 06, Oct 2001| | + | |
- | |40|Steven|Oey|Sat 06, Oct 2001| | + | |
- | + | ||
- | Page 8/10 | + | |
- | + | ||
- | The number of rows to display at one time is controled by the Render($rows) method. If you do not pass any value to Render(), | + | |
- | + | ||
- | You can control the column titles by modifying your SQL (supported by most databases): | + | |
+ | You can control the column titles by aliasing them in your SQL (supported by most databases): | ||
<code php> | <code php> | ||
$sql = ' | $sql = ' | ||
Line 228: | Line 216: | ||
</ | </ | ||
- | The above code can be found in the adodb/ | + | The ADODB_Pager |
- | The ADODB_Pager code can be adapted by a programmer so that the text links can be replaced by images, and the dull white background | + | By default, special characters in the displayed data will be escaped to prevent execution of HTML code. If you wish to have them interpreted instead, before calling Render() you can set |
+ | <code php> | ||
+ | $pager-> | ||
+ | </ | ||
- | You can also allow display of html by setting | + | <WRAP important> |
- | | + | This is a **security risk**, unescaped HTML will leave you vulnerable to Cross-site scripting (XSS) attacks. |
+ | Use with caution, and only with trusted data. | ||
+ | </ | ||
- | Some of the code used here was contributed by Iván Oliva and Cornel G.. |
v5/addons/addons_index.1530475654.txt.gz · Last modified: 2018/07/01 22:07 by peterdd