<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to UsageSamples</title><link>https://sourceforge.net/p/ctabledynamic/wiki/UsageSamples/</link><description>Recent changes to UsageSamples</description><atom:link href="https://sourceforge.net/p/ctabledynamic/wiki/UsageSamples/feed" rel="self"/><language>en</language><lastBuildDate>Mon, 02 Apr 2012 13:52:22 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/ctabledynamic/wiki/UsageSamples/feed" rel="self" type="application/rss+xml"/><item><title>WikiPage UsageSamples modified by q-code</title><link>https://sourceforge.net/p/ctabledynamic/wiki/UsageSamples/</link><description>&lt;pre&gt;--- v8 
+++ v9 
@@ -1,30 +1,30 @@
 QUICK START EXAMPLE #1:
 ---
-We just start a new table...
-
-    $t = new cTable('table1','users');
+How to create a table and add extra attributes...
+
+    $t = new cTable('table1','users');
     $t-&gt;AddAttr('summary','Registered users');
     echo $t-&gt;Start();
   
     // Output:
     // &lt;table id="table1" class="users" summary="Registered users"&gt;
 
 
 QUICK START EXAMPLE #2:
 ---
 We define 3 columns...
 
     $t = new cTable('table1','users');
     $t-&gt;arrTH[0] = new cTableHead('Name',       'th0', 'head bold');
     $t-&gt;arrTH[1] = new cTableHead('Given names','th1', 'head'     );
     $t-&gt;arrTH[2] = new cTableHead('Address',    'th2', 'head'     );
     echo $t-&gt;GetTHrow();
   
     // Output:
     // &lt;tr&gt;
     // &lt;th id="th0" class="head bold"&gt;Name&lt;/th&gt;
     // &lt;th id="th1" class="head"&gt;Given names&lt;/th&gt;
-    // &lt;th id="th2" class="head"&gt;Name&lt;/th&gt;
+    // &lt;th id="th2" class="head"&gt;Address&lt;/th&gt;
     // &lt;/tr&gt;
 
 
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">q-code</dc:creator><pubDate>Mon, 02 Apr 2012 13:52:22 -0000</pubDate><guid>https://sourceforge.netc3d91cd308783042ca473eb7bc6d3e66023c329c</guid></item><item><title>WikiPage UsageSamples modified by q-code</title><link>https://sourceforge.net/p/ctabledynamic/wiki/UsageSamples/</link><description>&lt;pre&gt;--- v7 
+++ v8 
@@ -55,36 +55,36 @@
     $t-&gt;rowcount = 5;
     $t-&gt;activecol = $_GET['order'];
     $t-&gt;activelink = '';
-    $t-&gt;arrTH['name'] = new cTableHead('Name', 'th0', 'head', '&lt;a href="thispage.php?order=name"&gt;%%&lt;/a&gt;');
-    $t-&gt;arrTH['firstname'] = new cTableHead('Given names','th1', 'head', '&lt;a href="thispage.php?order=firstname"&gt;%%&lt;/a&gt;');
-    $t-&gt;arrTH['address'] = new cTableHead('Address', 'th2', 'head', '&lt;a href="thispage.php?order=address"&gt;%%&lt;/a&gt;');
+    $t-&gt;arrTH['name'] = new cTableHead('Name', 'th0', 'head', '&lt;a href="thispage.php?order=name"&gt;%s&lt;/a&gt;');
+    $t-&gt;arrTH['firstname'] = new cTableHead('Given names','th1', 'head', '&lt;a href="thispage.php?order=firstname"&gt;%s&lt;/a&gt;');
+    $t-&gt;arrTH['address'] = new cTableHead('Address', 'th2', 'head', '&lt;a href="thispage.php?order=address"&gt;%s&lt;/a&gt;');
     echo $t-&gt;GetTHrow();
       
     // Here the column headers have link property.
     // These patterns are applied to the column headers, except for the active column.
     // When the active column is 'name', the output is:
     // &lt;tr&gt;
     // &lt;th id="th0" class="head"&gt;Name&lt;/th&gt;
     // &lt;th id="th1" class="head"&gt;&lt;a href="thispage.php?order=firstname"&gt;Given names&lt;/a&gt;&lt;/th&gt;
     // &lt;th id="th2" class="head"&gt;&lt;a href="thispage.php?order=address"&gt;Address&lt;/a&gt;&lt;/th&gt;
     // &lt;/tr&gt;
     // Note:
     // If rowcount is 0 or 1 (i.e. the dataset is empty or contains only 1 row),
     // the link property is not added in the column headers
     // and the output will be the same as in example #3.
   
 
 QUICK START EXAMPLE #5:
 ---
 With clickable column headers to change sorting order AND sorting direction (can be switched ascending/descending)
 
     $t = new cTable('table1','users');
     $t-&gt;rowcount = 5;
     $t-&gt;activecol = $_GET['order'];
-    $t-&gt;activelink = '&lt;a href="thispage.php?order='.$_GET['order'].'&amp;direction='.($_GET['direction']=='asc' ? 'desc' : 'asc').'"&gt;%%&lt;/a&gt;';
-    $t-&gt;arrTH['name']      = new cTableHead('Name', 'th0', 'head', '&lt;a href="thispage.php?order=name&amp;direction=asc"&gt;%%&lt;/a&gt;');
-    $t-&gt;arrTH['firstname'] = new cTableHead('Given names','th1', 'head', '&lt;a href="thispage.php?order=firstname&amp;direction=asc"&gt;%%&lt;/a&gt;');
-    $t-&gt;arrTH['address']   = new cTableHead('Address', 'th2', 'head', '&lt;a href="thispage.php?order=address&amp;direction=asc"&gt;%%&lt;/a&gt;');
+    $t-&gt;activelink = '&lt;a href="thispage.php?order='.$_GET['order'].'&amp;direction='.($_GET['direction']=='asc' ? 'desc' : 'asc').'"&gt;%s&lt;/a&gt;';
+    $t-&gt;arrTH['name']      = new cTableHead('Name', 'th0', 'head', '&lt;a href="thispage.php?order=name&amp;direction=asc"&gt;%s&lt;/a&gt;');
+    $t-&gt;arrTH['firstname'] = new cTableHead('Given names','th1', 'head', '&lt;a href="thispage.php?order=firstname&amp;direction=asc"&gt;%s&lt;/a&gt;');
+    $t-&gt;arrTH['address']   = new cTableHead('Address', 'th2', 'head', '&lt;a href="thispage.php?order=address&amp;direction=asc"&gt;%s&lt;/a&gt;');
     echo $t-&gt;GetTHrow();
       
     // Here the column headers have a link property.
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">q-code</dc:creator><pubDate>Fri, 09 Mar 2012 09:25:26 -0000</pubDate><guid>https://sourceforge.net5640709676fd1ef05e8cee49c42f79c5a674d41a</guid></item><item><title>WikiPage UsageSamples modified by q-code</title><link>https://sourceforge.net/p/ctabledynamic/wiki/UsageSamples/</link><description>&lt;pre&gt;--- v6 
+++ v7 
@@ -55,36 +55,36 @@
     $t-&gt;rowcount = 5;
     $t-&gt;activecol = $_GET['order'];
     $t-&gt;activelink = '';
-    $t-&gt;arrTH['name'] = new cTableHead('Name', 'th0', 'head', '&lt;a href="thispage.php?order=name"&gt;%s&lt;/a&gt;');
-    $t-&gt;arrTH['firstname'] = new cTableHead('Given names','th1', 'head', '&lt;a href="thispage.php?order=firstname"&gt;%s&lt;/a&gt;');
-    $t-&gt;arrTH['address'] = new cTableHead('Address', 'th2', 'head', '&lt;a href="thispage.php?order=address"&gt;%s&lt;/a&gt;');
+    $t-&gt;arrTH['name'] = new cTableHead('Name', 'th0', 'head', '&lt;a href="thispage.php?order=name"&gt;%%&lt;/a&gt;');
+    $t-&gt;arrTH['firstname'] = new cTableHead('Given names','th1', 'head', '&lt;a href="thispage.php?order=firstname"&gt;%%&lt;/a&gt;');
+    $t-&gt;arrTH['address'] = new cTableHead('Address', 'th2', 'head', '&lt;a href="thispage.php?order=address"&gt;%%&lt;/a&gt;');
     echo $t-&gt;GetTHrow();
       
     // Here the column headers have link property.
     // These patterns are applied to the column headers, except for the active column.
     // When the active column is 'name', the output is:
     // &lt;tr&gt;
     // &lt;th id="th0" class="head"&gt;Name&lt;/th&gt;
     // &lt;th id="th1" class="head"&gt;&lt;a href="thispage.php?order=firstname"&gt;Given names&lt;/a&gt;&lt;/th&gt;
     // &lt;th id="th2" class="head"&gt;&lt;a href="thispage.php?order=address"&gt;Address&lt;/a&gt;&lt;/th&gt;
     // &lt;/tr&gt;
     // Note:
     // If rowcount is 0 or 1 (i.e. the dataset is empty or contains only 1 row),
     // the link property is not added in the column headers
     // and the output will be the same as in example #3.
   
 
 QUICK START EXAMPLE #5:
 ---
 With clickable column headers to change sorting order AND sorting direction (can be switched ascending/descending)
 
     $t = new cTable('table1','users');
     $t-&gt;rowcount = 5;
     $t-&gt;activecol = $_GET['order'];
-    $t-&gt;activelink = '&lt;a href="thispage.php?order='.$_GET['order'].'&amp;direction='.($_GET['direction']=='asc' ? 'desc' : 'asc').'"&gt;%s&lt;/a&gt;';
-    $t-&gt;arrTH['name']      = new cTableHead('Name', 'th0', 'head', '&lt;a href="thispage.php?order=name&amp;direction=asc"&gt;%s&lt;/a&gt;');
-    $t-&gt;arrTH['firstname'] = new cTableHead('Given names','th1', 'head', '&lt;a href="thispage.php?order=firstname&amp;direction=asc"&gt;%s&lt;/a&gt;');
-    $t-&gt;arrTH['address']   = new cTableHead('Address', 'th2', 'head', '&lt;a href="thispage.php?order=address&amp;direction=asc"&gt;%s&lt;/a&gt;');
+    $t-&gt;activelink = '&lt;a href="thispage.php?order='.$_GET['order'].'&amp;direction='.($_GET['direction']=='asc' ? 'desc' : 'asc').'"&gt;%%&lt;/a&gt;';
+    $t-&gt;arrTH['name']      = new cTableHead('Name', 'th0', 'head', '&lt;a href="thispage.php?order=name&amp;direction=asc"&gt;%%&lt;/a&gt;');
+    $t-&gt;arrTH['firstname'] = new cTableHead('Given names','th1', 'head', '&lt;a href="thispage.php?order=firstname&amp;direction=asc"&gt;%%&lt;/a&gt;');
+    $t-&gt;arrTH['address']   = new cTableHead('Address', 'th2', 'head', '&lt;a href="thispage.php?order=address&amp;direction=asc"&gt;%%&lt;/a&gt;');
     echo $t-&gt;GetTHrow();
       
     // Here the column headers have a link property.
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">q-code</dc:creator><pubDate>Fri, 09 Mar 2012 08:57:16 -0000</pubDate><guid>https://sourceforge.net6612dc5f812aafdec660a59709e9d2f3b206a178</guid></item><item><title>WikiPage UsageSamples modified by q-code</title><link>https://sourceforge.net/p/ctabledynamic/wiki/UsageSamples/</link><description>&lt;pre&gt;--- v5 
+++ v6 
@@ -9,16 +9,17 @@
     // Output:
     // &lt;table id="table1" class="users" summary="Registered users"&gt;
 
+
 QUICK START EXAMPLE #2:
 ---
 We define 3 columns...
 
     $t = new cTable('table1','users');
     $t-&gt;arrTH[0] = new cTableHead('Name',       'th0', 'head bold');
     $t-&gt;arrTH[1] = new cTableHead('Given names','th1', 'head'     );
     $t-&gt;arrTH[2] = new cTableHead('Address',    'th2', 'head'     );
     echo $t-&gt;GetTHrow();
   
     // Output:
     // &lt;tr&gt;
     // &lt;th id="th0" class="head bold"&gt;Name&lt;/th&gt;
@@ -26,17 +27,18 @@
     // &lt;th id="th2" class="head"&gt;Name&lt;/th&gt;
     // &lt;/tr&gt;
 
+
 QUICK START EXAMPLE #3:
 ---
 This is identical to the example #2, but using advanced methods to automate the creation of the columns and to change all attributes at once
   
     $t = new cTable('table1','users');
     $t-&gt;ChangeTHcontent(array(0=&gt;'Name',1=&gt;'Given names',2=&gt;'Address')); // Here the column headers does not exist, nevertheless this method creates the missing columns (thus columns [0],[1] and [2] are created and the contents are added).
     $t-&gt;ChangeTHattr('id', array(0=&gt;'th0',1=&gt;'th1',2=&gt;'th2'));           // Here the html 'id' attributes exist (columns are created in previous line) but values are empty. This populates the 'id' attributes with distinct values.
     $t-&gt;ChangeTHattr('class', 'head');                                   // Here is the same as in previous line, but only one value is provided. In this case, this attribute value will be used in all column headers.  
     $t-&gt;arrTH[0]-&gt;AddAttrValue('class',' bold');                         // Here we just add the ' bold' value into the existing html class attribute, only in the first column.
     echo $t-&gt;GetTHrow();
   
     // Output:  
     // &lt;tr&gt;
     // &lt;th id="th0" class="head bold"&gt;Name&lt;/th&gt;
@@ -44,60 +46,63 @@
     // &lt;th id="th2" class="head"&gt;Name&lt;/th&gt;
     // &lt;/tr&gt;
   
+
 QUICK START EXAMPLE #4:
 ---
 With clickable column header to change sorting order
 
     $t = new cTable('table1','users');
     $t-&gt;rowcount = 5;
     $t-&gt;activecol = $_GET['order'];
     $t-&gt;activelink = '';
     $t-&gt;arrTH['name'] = new cTableHead('Name', 'th0', 'head', '&lt;a href="thispage.php?order=name"&gt;%s&lt;/a&gt;');
     $t-&gt;arrTH['firstname'] = new cTableHead('Given names','th1', 'head', '&lt;a href="thispage.php?order=firstname"&gt;%s&lt;/a&gt;');
     $t-&gt;arrTH['address'] = new cTableHead('Address', 'th2', 'head', '&lt;a href="thispage.php?order=address"&gt;%s&lt;/a&gt;');
     echo $t-&gt;GetTHrow();
       
     // Here the column headers have link property.
     // These patterns are applied to the column headers, except for the active column.
     // When the active column is 'name', the output is:
     // &lt;tr&gt;
     // &lt;th id="th0" class="head"&gt;Name&lt;/th&gt;
     // &lt;th id="th1" class="head"&gt;&lt;a href="thispage.php?order=firstname"&gt;Given names&lt;/a&gt;&lt;/th&gt;
     // &lt;th id="th2" class="head"&gt;&lt;a href="thispage.php?order=address"&gt;Address&lt;/a&gt;&lt;/th&gt;
     // &lt;/tr&gt;
     // Note:
     // If rowcount is 0 or 1 (i.e. the dataset is empty or contains only 1 row),
     // the link property is not added in the column headers
     // and the output will be the same as in example #3.
   
+
 QUICK START EXAMPLE #5:
 ---
 With clickable column headers to change sorting order AND sorting direction (can be switched ascending/descending)
 
     $t = new cTable('table1','users');
     $t-&gt;rowcount = 5;
     $t-&gt;activecol = $_GET['order'];
     $t-&gt;activelink = '&lt;a href="thispage.php?order='.$_GET['order'].'&amp;direction='.($_GET['direction']=='asc' ? 'desc' : 'asc').'"&gt;%s&lt;/a&gt;';
     $t-&gt;arrTH['name']      = new cTableHead('Name', 'th0', 'head', '&lt;a href="thispage.php?order=name&amp;direction=asc"&gt;%s&lt;/a&gt;');
     $t-&gt;arrTH['firstname'] = new cTableHead('Given names','th1', 'head', '&lt;a href="thispage.php?order=firstname&amp;direction=asc"&gt;%s&lt;/a&gt;');
     $t-&gt;arrTH['address']   = new cTableHead('Address', 'th2', 'head', '&lt;a href="thispage.php?order=address&amp;direction=asc"&gt;%s&lt;/a&gt;');
     echo $t-&gt;GetTHrow();
       
     // Here the column headers have a link property.
     // These patterns are applied to the column headers.
     // For the active column header an other url link is used:
     // an url link with a reversed direction (from 'asc' to 'desc')
       
     // When the active column is 'name', the output is:
     // &lt;tr&gt;
     // &lt;th id="th0" class="head"&gt;&lt;a href="thispage.php?order=name&amp;direction=desc"&gt;Name&lt;/a&gt;&lt;/th&gt;
     // &lt;th id="th1" class="head"&gt;&lt;a href="thispage.php?order=firstname&amp;direction=asc"&gt;Given names&lt;/a&gt;&lt;/th&gt;
     // &lt;th id="th2" class="head"&gt;&lt;a href="thispage.php?order=address&amp;direction=asc"&gt;Address&lt;/a&gt;&lt;/th&gt;
     // &lt;/tr&gt;
     // Note:
     // If rowcount is 0 or 1 (i.e. the dataset is empty or contains only 1 row),
     // the link property is not added in the column headers and
     // the output will be the same as in example #3.
+
 
 QUICK START EXAMPLE #6: 
 ---
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">q-code</dc:creator><pubDate>Wed, 29 Feb 2012 16:20:13 -0000</pubDate><guid>https://sourceforge.netfa361d482d4f211608612efc4bcbb54603d91903</guid></item><item><title>WikiPage UsageSamples modified by q-code</title><link>https://sourceforge.net/p/ctabledynamic/wiki/UsageSamples/</link><description>&lt;pre&gt;--- v4 
+++ v5 
@@ -1,19 +1,21 @@
 QUICK START EXAMPLE #1:
 ---
-
-    $t = new cTable('table1','users');
+We just start a new table...
+
+    $t = new cTable('table1','users');
     $t-&gt;AddAttr('summary','Registered users');
     echo $t-&gt;Start();
   
     // Output:
     // &lt;table id="table1" class="users" summary="Registered users"&gt;
 
 QUICK START EXAMPLE #2:
 ---
+We define 3 columns...
 
     $t = new cTable('table1','users');
     $t-&gt;arrTH[0] = new cTableHead('Name',       'th0', 'head bold');
     $t-&gt;arrTH[1] = new cTableHead('Given names','th1', 'head'     );
     $t-&gt;arrTH[2] = new cTableHead('Address',    'th2', 'head'     );
     echo $t-&gt;GetTHrow();
   
@@ -24,17 +26,17 @@
     // &lt;th id="th2" class="head"&gt;Name&lt;/th&gt;
     // &lt;/tr&gt;
 
 QUICK START EXAMPLE #3:
 ---
 This is identical to the example #2, but using advanced methods to automate the creation of the columns and to change all attributes at once
   
     $t = new cTable('table1','users');
     $t-&gt;ChangeTHcontent(array(0=&gt;'Name',1=&gt;'Given names',2=&gt;'Address')); // Here the column headers does not exist, nevertheless this method creates the missing columns (thus columns [0],[1] and [2] are created and the contents are added).
     $t-&gt;ChangeTHattr('id', array(0=&gt;'th0',1=&gt;'th1',2=&gt;'th2'));           // Here the html 'id' attributes exist (columns are created in previous line) but values are empty. This populates the 'id' attributes with distinct values.
     $t-&gt;ChangeTHattr('class', 'head');                                   // Here is the same as in previous line, but only one value is provided. In this case, this attribute value will be used in all column headers.  
     $t-&gt;arrTH[0]-&gt;AddAttrValue('class',' bold');                         // Here we just add the ' bold' value into the existing html class attribute, only in the first column.
     echo $t-&gt;GetTHrow();
   
     // Output:  
     // &lt;tr&gt;
     // &lt;th id="th0" class="head bold"&gt;Name&lt;/th&gt;
@@ -42,63 +44,64 @@
     // &lt;th id="th2" class="head"&gt;Name&lt;/th&gt;
     // &lt;/tr&gt;
   
 QUICK START EXAMPLE #4:
 ---
 With clickable column header to change sorting order
 
     $t = new cTable('table1','users');
     $t-&gt;rowcount = 5;
     $t-&gt;activecol = $_GET['order'];
     $t-&gt;activelink = '';
-    $t-&gt;arrTH['name']      = new cTableHead('Name',       'th0', 'head', '&lt;a href="thispage.php?order=name"&gt;%s&lt;/a&gt;');
+    $t-&gt;arrTH['name'] = new cTableHead('Name', 'th0', 'head', '&lt;a href="thispage.php?order=name"&gt;%s&lt;/a&gt;');
     $t-&gt;arrTH['firstname'] = new cTableHead('Given names','th1', 'head', '&lt;a href="thispage.php?order=firstname"&gt;%s&lt;/a&gt;');
-    $t-&gt;arrTH['address']   = new cTableHead('Address',    'th2', 'head', '&lt;a href="thispage.php?order=address"&gt;%s&lt;/a&gt;');
+    $t-&gt;arrTH['address'] = new cTableHead('Address', 'th2', 'head', '&lt;a href="thispage.php?order=address"&gt;%s&lt;/a&gt;');
     echo $t-&gt;GetTHrow();
       
     // Here the column headers have link property.
     // These patterns are applied to the column headers, except for the active column.
     // When the active column is 'name', the output is:
     // &lt;tr&gt;
     // &lt;th id="th0" class="head"&gt;Name&lt;/th&gt;
     // &lt;th id="th1" class="head"&gt;&lt;a href="thispage.php?order=firstname"&gt;Given names&lt;/a&gt;&lt;/th&gt;
     // &lt;th id="th2" class="head"&gt;&lt;a href="thispage.php?order=address"&gt;Address&lt;/a&gt;&lt;/th&gt;
     // &lt;/tr&gt;
     // Note:
     // If rowcount is 0 or 1 (i.e. the dataset is empty or contains only 1 row),
     // the link property is not added in the column headers
     // and the output will be the same as in example #3.
   
 QUICK START EXAMPLE #5:
 ---
 With clickable column headers to change sorting order AND sorting direction (can be switched ascending/descending)
 
     $t = new cTable('table1','users');
     $t-&gt;rowcount = 5;
     $t-&gt;activecol = $_GET['order'];
     $t-&gt;activelink = '&lt;a href="thispage.php?order='.$_GET['order'].'&amp;direction='.($_GET['direction']=='asc' ? 'desc' : 'asc').'"&gt;%s&lt;/a&gt;';
-    $t-&gt;arrTH['name']      = new cTableHead('Name',       'th0', 'head', '&lt;a href="thispage.php?order=name&amp;direction=asc"&gt;%s&lt;/a&gt;');
+    $t-&gt;arrTH['name']      = new cTableHead('Name', 'th0', 'head', '&lt;a href="thispage.php?order=name&amp;direction=asc"&gt;%s&lt;/a&gt;');
     $t-&gt;arrTH['firstname'] = new cTableHead('Given names','th1', 'head', '&lt;a href="thispage.php?order=firstname&amp;direction=asc"&gt;%s&lt;/a&gt;');
-    $t-&gt;arrTH['address']   = new cTableHead('Address',    'th2', 'head', '&lt;a href="thispage.php?order=address&amp;direction=asc"&gt;%s&lt;/a&gt;');
+    $t-&gt;arrTH['address']   = new cTableHead('Address', 'th2', 'head', '&lt;a href="thispage.php?order=address&amp;direction=asc"&gt;%s&lt;/a&gt;');
     echo $t-&gt;GetTHrow();
       
     // Here the column headers have a link property.
     // These patterns are applied to the column headers.
     // For the active column header an other url link is used:
     // an url link with a reversed direction (from 'asc' to 'desc')
       
     // When the active column is 'name', the output is:
     // &lt;tr&gt;
     // &lt;th id="th0" class="head"&gt;&lt;a href="thispage.php?order=name&amp;direction=desc"&gt;Name&lt;/a&gt;&lt;/th&gt;
     // &lt;th id="th1" class="head"&gt;&lt;a href="thispage.php?order=firstname&amp;direction=asc"&gt;Given names&lt;/a&gt;&lt;/th&gt;
     // &lt;th id="th2" class="head"&gt;&lt;a href="thispage.php?order=address&amp;direction=asc"&gt;Address&lt;/a&gt;&lt;/th&gt;
     // &lt;/tr&gt;
     // Note:
     // If rowcount is 0 or 1 (i.e. the dataset is empty or contains only 1 row),
     // the link property is not added in the column headers and
     // the output will be the same as in example #3.
 
-QUICK START EXAMPLE #6: Show how to have a specific a style added in the dataset row.
----
+QUICK START EXAMPLE #6: 
+---
+Show how to have a specific a style added in the dataset row.
 
     $t = new cTable('table1','users');
     $t-&gt;arrTH['name'] = new cTableHead('Name');
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">q-code</dc:creator><pubDate>Wed, 29 Feb 2012 16:19:18 -0000</pubDate><guid>https://sourceforge.net1d5d53103ccfe132af27e5958215810d3dd0d9d9</guid></item><item><title>WikiPage UsageSamples modified by q-code</title><link>https://sourceforge.net/p/ctabledynamic/wiki/UsageSamples/</link><description>&lt;pre&gt;--- v3 
+++ v4 
@@ -28,121 +28,119 @@
 ---
 This is identical to the example #2, but using advanced methods to automate the creation of the columns and to change all attributes at once
   
-      $t = new cTable('table1','users');
-      $t-&gt;ChangeTHcontent(array(0=&gt;'Name',1=&gt;'Given names',2=&gt;'Address')); // Here the column headers does not exist, nevertheless this method creates the missing columns (thus columns [0],[1] and [2] are created and the contents are added).
-      $t-&gt;ChangeTHattr('id', array(0=&gt;'th0',1=&gt;'th1',2=&gt;'th2'));           // Here the html 'id' attributes exist (columns are created in previous line) but values are empty. This populates the 'id' attributes with distinct values.
-      $t-&gt;ChangeTHattr('class', 'head');                                   // Here is the same as in previous line, but only one value is provided. In this case, this attribute value will be used in all column headers.  
-      $t-&gt;arrTH[0]-&gt;AddAttrValue('class',' bold');                         // Here we just add the ' bold' value into the existing html class attribute, only in the first column.
-      echo $t-&gt;GetTHrow();
-  
+    $t = new cTable('table1','users');
+    $t-&gt;ChangeTHcontent(array(0=&gt;'Name',1=&gt;'Given names',2=&gt;'Address')); // Here the column headers does not exist, nevertheless this method creates the missing columns (thus columns [0],[1] and [2] are created and the contents are added).
+    $t-&gt;ChangeTHattr('id', array(0=&gt;'th0',1=&gt;'th1',2=&gt;'th2'));           // Here the html 'id' attributes exist (columns are created in previous line) but values are empty. This populates the 'id' attributes with distinct values.
+    $t-&gt;ChangeTHattr('class', 'head');                                   // Here is the same as in previous line, but only one value is provided. In this case, this attribute value will be used in all column headers.  
+    $t-&gt;arrTH[0]-&gt;AddAttrValue('class',' bold');                         // Here we just add the ' bold' value into the existing html class attribute, only in the first column.
+    echo $t-&gt;GetTHrow();
+  
     // Output:  
     // &lt;tr&gt;
     // &lt;th id="th0" class="head bold"&gt;Name&lt;/th&gt;
     // &lt;th id="th1" class="head"&gt;Given names&lt;/th&gt;
     // &lt;th id="th2" class="head"&gt;Name&lt;/th&gt;
     // &lt;/tr&gt;
   
 QUICK START EXAMPLE #4:
 ---
 With clickable column header to change sorting order
 
-      $t = new cTable('table1','users');
-      $t-&gt;rowcount = 5;
-      $t-&gt;activecol = $_GET['order'];
-      $t-&gt;activelink = '';
-      $t-&gt;arrTH['name']      = new cTableHead('Name',       'th0', 'head', '&lt;a href="thispage.php?order=name"&gt;%s&lt;/a&gt;');
-      $t-&gt;arrTH['firstname'] = new cTableHead('Given names','th1', 'head', '&lt;a href="thispage.php?order=firstname"&gt;%s&lt;/a&gt;');
-      $t-&gt;arrTH['address']   = new cTableHead('Address',    'th2', 'head', '&lt;a href="thispage.php?order=address"&gt;%s&lt;/a&gt;');
-      echo $t-&gt;GetTHrow();
+    $t = new cTable('table1','users');
+    $t-&gt;rowcount = 5;
+    $t-&gt;activecol = $_GET['order'];
+    $t-&gt;activelink = '';
+    $t-&gt;arrTH['name']      = new cTableHead('Name',       'th0', 'head', '&lt;a href="thispage.php?order=name"&gt;%s&lt;/a&gt;');
+    $t-&gt;arrTH['firstname'] = new cTableHead('Given names','th1', 'head', '&lt;a href="thispage.php?order=firstname"&gt;%s&lt;/a&gt;');
+    $t-&gt;arrTH['address']   = new cTableHead('Address',    'th2', 'head', '&lt;a href="thispage.php?order=address"&gt;%s&lt;/a&gt;');
+    echo $t-&gt;GetTHrow();
       
     // Here the column headers have link property.
     // These patterns are applied to the column headers, except for the active column.
     // When the active column is 'name', the output is:
     // &lt;tr&gt;
     // &lt;th id="th0" class="head"&gt;Name&lt;/th&gt;
     // &lt;th id="th1" class="head"&gt;&lt;a href="thispage.php?order=firstname"&gt;Given names&lt;/a&gt;&lt;/th&gt;
     // &lt;th id="th2" class="head"&gt;&lt;a href="thispage.php?order=address"&gt;Address&lt;/a&gt;&lt;/th&gt;
     // &lt;/tr&gt;
     // Note:
     // If rowcount is 0 or 1 (i.e. the dataset is empty or contains only 1 row),
     // the link property is not added in the column headers
     // and the output will be the same as in example #3.
   
 QUICK START EXAMPLE #5:
 ---
 With clickable column headers to change sorting order AND sorting direction (can be switched ascending/descending)
 
-      $t = new cTable('table1','users');
-      $t-&gt;rowcount = 5;
-      $t-&gt;activecol = $_GET['order'];
-      $t-&gt;activelink = '&lt;a href="thispage.php?order='.$_GET['order'].'&amp;direction='.($_GET['direction']=='asc' ? 'desc' : 'asc').'"&gt;%s&lt;/a&gt;';
-      $t-&gt;arrTH['name']      = new cTableHead('Name',       'th0', 'head', '&lt;a href="thispage.php?order=name&amp;direction=asc"&gt;%s&lt;/a&gt;');
-      $t-&gt;arrTH['firstname'] = new cTableHead('Given names','th1', 'head', '&lt;a href="thispage.php?order=firstname&amp;direction=asc"&gt;%s&lt;/a&gt;');
-      $t-&gt;arrTH['address']   = new cTableHead('Address',    'th2', 'head', '&lt;a href="thispage.php?order=address&amp;direction=asc"&gt;%s&lt;/a&gt;');
-      echo $t-&gt;GetTHrow();
+    $t = new cTable('table1','users');
+    $t-&gt;rowcount = 5;
+    $t-&gt;activecol = $_GET['order'];
+    $t-&gt;activelink = '&lt;a href="thispage.php?order='.$_GET['order'].'&amp;direction='.($_GET['direction']=='asc' ? 'desc' : 'asc').'"&gt;%s&lt;/a&gt;';
+    $t-&gt;arrTH['name']      = new cTableHead('Name',       'th0', 'head', '&lt;a href="thispage.php?order=name&amp;direction=asc"&gt;%s&lt;/a&gt;');
+    $t-&gt;arrTH['firstname'] = new cTableHead('Given names','th1', 'head', '&lt;a href="thispage.php?order=firstname&amp;direction=asc"&gt;%s&lt;/a&gt;');
+    $t-&gt;arrTH['address']   = new cTableHead('Address',    'th2', 'head', '&lt;a href="thispage.php?order=address&amp;direction=asc"&gt;%s&lt;/a&gt;');
+    echo $t-&gt;GetTHrow();
       
     // Here the column headers have a link property.
-    //These patterns are applied to the column headers.
+    // These patterns are applied to the column headers.
     // For the active column header an other url link is used:
     // an url link with a reversed direction (from 'asc' to 'desc')
       
     // When the active column is 'name', the output is:
     // &lt;tr&gt;
     // &lt;th id="th0" class="head"&gt;&lt;a href="thispage.php?order=name&amp;direction=desc"&gt;Name&lt;/a&gt;&lt;/th&gt;
     // &lt;th id="th1" class="head"&gt;&lt;a href="thispage.php?order=firstname&amp;direction=asc"&gt;Given names&lt;/a&gt;&lt;/th&gt;
     // &lt;th id="th2" class="head"&gt;&lt;a href="thispage.php?order=address&amp;direction=asc"&gt;Address&lt;/a&gt;&lt;/th&gt;
     // &lt;/tr&gt;
     // Note:
     // If rowcount is 0 or 1 (i.e. the dataset is empty or contains only 1 row),
     // the link property is not added in the column headers and
     // the output will be the same as in example #3.
 
 QUICK START EXAMPLE #6: Show how to have a specific a style added in the dataset row.
 ---
 
-      $t = new cTable('table1','users');
-      $t-&gt;arrTH['name'] = new cTableHead('Name');
-      $t-&gt;arrTH['bill'] = new cTableHead('Dollars');
-      $t-&gt;arrTD['name'] = new cTableData(); // We create an empty &lt;td&gt; object. It will be filled when looping in the dataset
-      $t-&gt;arrTD['bill'] = new cTableData();
-      $t-&gt;arrTD['bill']-&gt;dynamicValues = array('positive'=&gt;'background-color:green','negative'=&gt;'background-color:red');
-      echo $t-&gt;Start();
-      echo $t-&gt;GetTHrow();
-      // We loop in the dataset (e.g. a row fetched from a sql query)
-      while($row = mysql_fetch_assoc($result))
-      {
-        $t-&gt;arrTD['name']-&gt;content = $row['name'];
-        $t-&gt;arrTD['bill']-&gt;content = $row['bill']; 
-        $t-&gt;arrTD['bill']-&gt;AddDynamicAttr('style', ($row['bill']&lt;0 ? 'negative' : 'positive'));
-        echo $t-&gt;GetTDrow();
-      }
-      echo $t-&gt;End();
+    $t = new cTable('table1','users');
+    $t-&gt;arrTH['name'] = new cTableHead('Name');
+    $t-&gt;arrTH['bill'] = new cTableHead('Dollars');
+    $t-&gt;arrTD['name'] = new cTableData(); // We create an empty &lt;td&gt; object. It will be filled when looping in the dataset
+    $t-&gt;arrTD['bill'] = new cTableData();
+    $t-&gt;arrTD['bill']-&gt;dynamicValues = array('positive'=&gt;'background-color:green','negative'=&gt;'background-color:red');
+    echo $t-&gt;Start();
+    echo $t-&gt;GetTHrow();
+    // We loop in the dataset (e.g. a row fetched from a sql query)
+    while($row = mysql_fetch_assoc($result))
+    {
+      $t-&gt;arrTD['name']-&gt;content = $row['name'];
+      $t-&gt;arrTD['bill']-&gt;content = $row['bill']; 
+      $t-&gt;arrTD['bill']-&gt;AddDynamicAttr('style', ($row['bill']&lt;0 ? 'negative' : 'positive'));
+      echo $t-&gt;GetTDrow();
+    }
+    echo $t-&gt;End();
     // Note, if the arrTD are designed with the same key as the database fieldname,
     // instead of adding the row content cell by cell,
     // we can populate all cells of the row with the method $t-&gt;ChangeTDcontent($row);
 
 QUICK START EXAMPLE #7:
 ---
 Using advanced methods. Here we create columns without instantiating each column object.
  
-       $t = new cTable('table1','users');
-       $t-&gt;ChangeTHcontent(array('Name','Given name','Address')); // create column headers (because not yet existing) and fill content
-       $t-&gt;ChangeTHattr('class','head'); // add a 'class' attribute with value 'head' to each column
-       
-       echo $t-&gt;Start();
-       echo $t-&gt;GetTHrow();
-       $t-&gt;ChangeTDcontent(array('Smith','John','Wallstreet')); echo $t-&gt;GetTDrow();
-       $t-&gt;ChangeTDcontent(array('White','Bob','Downstreet')); echo $t-&gt;GetTDrow();
-       $t-&gt;ChangeTDcontent(array('Brown','Bill','Mainstreet')); echo $t-&gt;GetTDrow();
-       echo $t-&gt;End();
-       
-       // Output:
-       
-       &lt;table id="table1" class="users"&gt;
-       &lt;tr&gt;
-       &lt;th class="head"&gt;Name&lt;/th&gt;&lt;th class="head"&gt;Given name&lt;/th&gt;&lt;th class="head"&gt;Address&lt;/th&gt;&lt;/tr&gt;
-       &lt;tr&gt;&lt;td&gt;Smith&lt;/td&gt;&lt;td&gt;John&lt;/td&gt;&lt;td&gt;Wallstreet&lt;/td&gt;&lt;/tr&gt;
-       &lt;tr&gt;&lt;td&gt;White&lt;/td&gt;&lt;td&gt;Bob&lt;/td&gt;&lt;td&gt;Downstreet&lt;/td&gt;&lt;/tr&gt;
-       &lt;tr&gt;&lt;td&gt;Brown&lt;/td&gt;&lt;td&gt;Bill&lt;/td&gt;&lt;td&gt;Mainstreet&lt;/td&gt;&lt;/tr&gt;
-   &lt;/table&gt;
+     $t = new cTable('table1','users');
+     $t-&gt;ChangeTHcontent(array('Name','Given name','Address')); // create column headers (because not yet existing) and fill content
+     $t-&gt;ChangeTHattr('class','head'); // add a 'class' attribute with value 'head' to each column 
+     echo $t-&gt;Start();
+     echo $t-&gt;GetTHrow();
+     $t-&gt;ChangeTDcontent(array('Smith','John','Wallstreet')); echo $t-&gt;GetTDrow();
+     $t-&gt;ChangeTDcontent(array('White','Bob','Downstreet')); echo $t-&gt;GetTDrow();
+     $t-&gt;ChangeTDcontent(array('Brown','Bill','Mainstreet')); echo $t-&gt;GetTDrow();
+     echo $t-&gt;End();
+       
+     // Output:
+     // &lt;table id="table1" class="users"&gt;
+     // &lt;tr&gt;
+     // &lt;th class="head"&gt;Name&lt;/th&gt;&lt;th class="head"&gt;Given name&lt;/th&gt;&lt;th class="head"&gt;Address&lt;/th&gt;&lt;/tr&gt;
+     // &lt;tr&gt;&lt;td&gt;Smith&lt;/td&gt;&lt;td&gt;John&lt;/td&gt;&lt;td&gt;Wallstreet&lt;/td&gt;&lt;/tr&gt;
+     // &lt;tr&gt;&lt;td&gt;White&lt;/td&gt;&lt;td&gt;Bob&lt;/td&gt;&lt;td&gt;Downstreet&lt;/td&gt;&lt;/tr&gt;
+     // &lt;tr&gt;&lt;td&gt;Brown&lt;/td&gt;&lt;td&gt;Bill&lt;/td&gt;&lt;td&gt;Mainstreet&lt;/td&gt;&lt;/tr&gt;
+     // &lt;/table&gt;
   
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">q-code</dc:creator><pubDate>Wed, 29 Feb 2012 16:15:40 -0000</pubDate><guid>https://sourceforge.netde7dc7faa47b30045373831287e6f80be67a7c30</guid></item><item><title>WikiPage UsageSamples modified by q-code</title><link>https://sourceforge.net/p/ctabledynamic/wiki/UsageSamples/</link><description>&lt;pre&gt;--- v2 
+++ v3 
@@ -5,102 +5,121 @@
     $t-&gt;AddAttr('summary','Registered users');
     echo $t-&gt;Start();
   
-    // Output:  &lt;table id="table1" class="users" summary="Registered users"&gt;
-
+    // Output:
+    // &lt;table id="table1" class="users" summary="Registered users"&gt;
+
 QUICK START EXAMPLE #2:
 ---
 
-      $t = new cTable('table1','users');
-      $t-&gt;arrTH[0] = new cTableHead('Name',       'th0', 'head bold');
-      $t-&gt;arrTH[1] = new cTableHead('Given names','th1', 'head'     );
-      $t-&gt;arrTH[2] = new cTableHead('Address',    'th2', 'head'     );
-      echo $t-&gt;GetTHrow();
-  
-      // Output:  &lt;tr&gt;&lt;th id="th0" class="head bold"&gt;Name&lt;/th&gt;&lt;th id="th1" class="head"&gt;Given names&lt;/th&gt;&lt;th id="th2" class="head"&gt;Name&lt;/th&gt;&lt;/tr&gt;
+    $t = new cTable('table1','users');
+    $t-&gt;arrTH[0] = new cTableHead('Name',       'th0', 'head bold');
+    $t-&gt;arrTH[1] = new cTableHead('Given names','th1', 'head'     );
+    $t-&gt;arrTH[2] = new cTableHead('Address',    'th2', 'head'     );
+    echo $t-&gt;GetTHrow();
+  
+    // Output:
+    // &lt;tr&gt;
+    // &lt;th id="th0" class="head bold"&gt;Name&lt;/th&gt;
+    // &lt;th id="th1" class="head"&gt;Given names&lt;/th&gt;
+    // &lt;th id="th2" class="head"&gt;Name&lt;/th&gt;
+    // &lt;/tr&gt;
 
 QUICK START EXAMPLE #3:
 ---
 This is identical to the example #2, but using advanced methods to automate the creation of the columns and to change all attributes at once
   
       $t = new cTable('table1','users');
       $t-&gt;ChangeTHcontent(array(0=&gt;'Name',1=&gt;'Given names',2=&gt;'Address')); // Here the column headers does not exist, nevertheless this method creates the missing columns (thus columns [0],[1] and [2] are created and the contents are added).
       $t-&gt;ChangeTHattr('id', array(0=&gt;'th0',1=&gt;'th1',2=&gt;'th2'));           // Here the html 'id' attributes exist (columns are created in previous line) but values are empty. This populates the 'id' attributes with distinct values.
       $t-&gt;ChangeTHattr('class', 'head');                                   // Here is the same as in previous line, but only one value is provided. In this case, this attribute value will be used in all column headers.  
       $t-&gt;arrTH[0]-&gt;AddAttrValue('class',' bold');                         // Here we just add the ' bold' value into the existing html class attribute, only in the first column.
       echo $t-&gt;GetTHrow();
   
-      // Output:  &lt;tr&gt;&lt;th id="th0" class="head bold"&gt;Name&lt;/th&gt;&lt;th id="th1" class="head"&gt;Given names&lt;/th&gt;&lt;th id="th2" class="head"&gt;Name&lt;/th&gt;&lt;/tr&gt;
+    // Output:  
+    // &lt;tr&gt;
+    // &lt;th id="th0" class="head bold"&gt;Name&lt;/th&gt;
+    // &lt;th id="th1" class="head"&gt;Given names&lt;/th&gt;
+    // &lt;th id="th2" class="head"&gt;Name&lt;/th&gt;
+    // &lt;/tr&gt;
   
 QUICK START EXAMPLE #4:
 ---
 With clickable column header to change sorting order
 
       $t = new cTable('table1','users');
       $t-&gt;rowcount = 5;
       $t-&gt;activecol = $_GET['order'];
       $t-&gt;activelink = '';
       $t-&gt;arrTH['name']      = new cTableHead('Name',       'th0', 'head', '&lt;a href="thispage.php?order=name"&gt;%s&lt;/a&gt;');
       $t-&gt;arrTH['firstname'] = new cTableHead('Given names','th1', 'head', '&lt;a href="thispage.php?order=firstname"&gt;%s&lt;/a&gt;');
       $t-&gt;arrTH['address']   = new cTableHead('Address',    'th2', 'head', '&lt;a href="thispage.php?order=address"&gt;%s&lt;/a&gt;');
       echo $t-&gt;GetTHrow();
       
-      // Here the column headers have link property. These patterns are applied to the column headers, except for the active column.
-      // When the active column is 'name', the output is:
-      // &lt;tr&gt;
-      // &lt;th id="th0" class="head"&gt;Name&lt;/th&gt;
-      // &lt;th id="th1" class="head"&gt;&lt;a href="thispage.php?order=firstname"&gt;Given names&lt;/a&gt;&lt;/th&gt;
-      // &lt;th id="th2" class="head"&gt;&lt;a href="thispage.php?order=address"&gt;Address&lt;/a&gt;&lt;/th&gt;
-      // &lt;/tr&gt;
-      // Note:
-      // If rowcount is 0 or 1 (i.e. the dataset is empty or contains only 1 row), the link property is not added in the column headers and the output will be the same as in example #3.
+    // Here the column headers have link property.
+    // These patterns are applied to the column headers, except for the active column.
+    // When the active column is 'name', the output is:
+    // &lt;tr&gt;
+    // &lt;th id="th0" class="head"&gt;Name&lt;/th&gt;
+    // &lt;th id="th1" class="head"&gt;&lt;a href="thispage.php?order=firstname"&gt;Given names&lt;/a&gt;&lt;/th&gt;
+    // &lt;th id="th2" class="head"&gt;&lt;a href="thispage.php?order=address"&gt;Address&lt;/a&gt;&lt;/th&gt;
+    // &lt;/tr&gt;
+    // Note:
+    // If rowcount is 0 or 1 (i.e. the dataset is empty or contains only 1 row),
+    // the link property is not added in the column headers
+    // and the output will be the same as in example #3.
   
 QUICK START EXAMPLE #5:
 ---
 With clickable column headers to change sorting order AND sorting direction (can be switched ascending/descending)
 
       $t = new cTable('table1','users');
       $t-&gt;rowcount = 5;
       $t-&gt;activecol = $_GET['order'];
       $t-&gt;activelink = '&lt;a href="thispage.php?order='.$_GET['order'].'&amp;direction='.($_GET['direction']=='asc' ? 'desc' : 'asc').'"&gt;%s&lt;/a&gt;';
       $t-&gt;arrTH['name']      = new cTableHead('Name',       'th0', 'head', '&lt;a href="thispage.php?order=name&amp;direction=asc"&gt;%s&lt;/a&gt;');
       $t-&gt;arrTH['firstname'] = new cTableHead('Given names','th1', 'head', '&lt;a href="thispage.php?order=firstname&amp;direction=asc"&gt;%s&lt;/a&gt;');
       $t-&gt;arrTH['address']   = new cTableHead('Address',    'th2', 'head', '&lt;a href="thispage.php?order=address&amp;direction=asc"&gt;%s&lt;/a&gt;');
       echo $t-&gt;GetTHrow();
       
-      // Here the column headers have a link property. These patterns are applied to the column headers.
-      // For the active column header an other url link is used: an url link with a reversed direction (from 'asc' to 'desc')
-      
-      // When the active column is 'name', the output is:
-      // &lt;tr&gt;
-      // &lt;th id="th0" class="head"&gt;&lt;a href="thispage.php?order=name&amp;direction=desc"&gt;Name&lt;/a&gt;&lt;/th&gt;
-      // &lt;th id="th1" class="head"&gt;&lt;a href="thispage.php?order=firstname&amp;direction=asc"&gt;Given names&lt;/a&gt;&lt;/th&gt;
-      // &lt;th id="th2" class="head"&gt;&lt;a href="thispage.php?order=address&amp;direction=asc"&gt;Address&lt;/a&gt;&lt;/th&gt;
-      // &lt;/tr&gt;
-      // Note:
-      // If rowcount is 0 or 1 (i.e. the dataset is empty or contains only 1 row), the link property is not added in the column headers and the output will be the same as in example #3.
-
- QUICK START EXAMPLE #6: Show how to have a specific a style added in the dataset row.
- 
-  $t = new cTable('table1','users');
-  $t-&gt;arrTH['name'] = new cTableHead('Name');
-  $t-&gt;arrTH['bill'] = new cTableHead('Dollars');
-  $t-&gt;arrTD['name'] = new cTableData(); // We create an empty &lt;td&gt; object. It will be filled when looping in the dataset
-  $t-&gt;arrTD['bill'] = new cTableData();
-  $t-&gt;arrTD['bill']-&gt;dynamicValues = array('positive'=&gt;'background-color:green','negative'=&gt;'background-color:red');
-  echo $t-&gt;Start();
-  echo $t-&gt;GetTHrow();
-  // We loop in the dataset (e.g. a row fetched from a sql query)
-  while($row = mysql_fetch_assoc($result))
-  {
-    $t-&gt;arrTD['name']-&gt;content = $row['name'];
-    $t-&gt;arrTD['bill']-&gt;content = $row['bill']; 
-    $t-&gt;arrTD['bill']-&gt;AddDynamicAttr('style', ($row['bill']&lt;0 ? 'negative' : 'positive'));
-    echo $t-&gt;GetTDrow();
-  }
-  echo $t-&gt;End();
-  // Note, if the arrTD are designed with the same key as the database fieldname,
-  // instead of adding the row content cell by cell,
-  // we can populate all cells of the row with the method $t-&gt;ChangeTDcontent($row);
+    // Here the column headers have a link property.
+    //These patterns are applied to the column headers.
+    // For the active column header an other url link is used:
+    // an url link with a reversed direction (from 'asc' to 'desc')
+      
+    // When the active column is 'name', the output is:
+    // &lt;tr&gt;
+    // &lt;th id="th0" class="head"&gt;&lt;a href="thispage.php?order=name&amp;direction=desc"&gt;Name&lt;/a&gt;&lt;/th&gt;
+    // &lt;th id="th1" class="head"&gt;&lt;a href="thispage.php?order=firstname&amp;direction=asc"&gt;Given names&lt;/a&gt;&lt;/th&gt;
+    // &lt;th id="th2" class="head"&gt;&lt;a href="thispage.php?order=address&amp;direction=asc"&gt;Address&lt;/a&gt;&lt;/th&gt;
+    // &lt;/tr&gt;
+    // Note:
+    // If rowcount is 0 or 1 (i.e. the dataset is empty or contains only 1 row),
+    // the link property is not added in the column headers and
+    // the output will be the same as in example #3.
+
+QUICK START EXAMPLE #6: Show how to have a specific a style added in the dataset row.
+---
+
+      $t = new cTable('table1','users');
+      $t-&gt;arrTH['name'] = new cTableHead('Name');
+      $t-&gt;arrTH['bill'] = new cTableHead('Dollars');
+      $t-&gt;arrTD['name'] = new cTableData(); // We create an empty &lt;td&gt; object. It will be filled when looping in the dataset
+      $t-&gt;arrTD['bill'] = new cTableData();
+      $t-&gt;arrTD['bill']-&gt;dynamicValues = array('positive'=&gt;'background-color:green','negative'=&gt;'background-color:red');
+      echo $t-&gt;Start();
+      echo $t-&gt;GetTHrow();
+      // We loop in the dataset (e.g. a row fetched from a sql query)
+      while($row = mysql_fetch_assoc($result))
+      {
+        $t-&gt;arrTD['name']-&gt;content = $row['name'];
+        $t-&gt;arrTD['bill']-&gt;content = $row['bill']; 
+        $t-&gt;arrTD['bill']-&gt;AddDynamicAttr('style', ($row['bill']&lt;0 ? 'negative' : 'positive'));
+        echo $t-&gt;GetTDrow();
+      }
+      echo $t-&gt;End();
+    // Note, if the arrTD are designed with the same key as the database fieldname,
+    // instead of adding the row content cell by cell,
+    // we can populate all cells of the row with the method $t-&gt;ChangeTDcontent($row);
 
 QUICK START EXAMPLE #7:
 ---
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">q-code</dc:creator><pubDate>Wed, 29 Feb 2012 16:12:27 -0000</pubDate><guid>https://sourceforge.net6206d24590662b258a6d2855626fdb60a3c7c8e0</guid></item><item><title>WikiPage UsageSamples modified by q-code</title><link>https://sourceforge.net/p/ctabledynamic/wiki/UsageSamples/</link><description>&lt;pre&gt;--- v1 
+++ v2 
@@ -10,115 +10,120 @@
 QUICK START EXAMPLE #2:
 ---
 
-  $t = new cTable('table1','users');
-  $t-&gt;arrTH[0] = new cTableHead('Name',       'th0', 'head bold');
-  $t-&gt;arrTH[1] = new cTableHead('Given names','th1', 'head'     );
-  $t-&gt;arrTH[2] = new cTableHead('Address',    'th2', 'head'     );
-  echo $t-&gt;GetTHrow();
-  
-  // Output:  &lt;tr&gt;&lt;th id="th0" class="head bold"&gt;Name&lt;/th&gt;&lt;th id="th1" class="head"&gt;Given names&lt;/th&gt;&lt;th id="th2" class="head"&gt;Name&lt;/th&gt;&lt;/tr&gt;
-
-QUICK START EXAMPLE #3: This is identical to the example #2, but using advanced methods to automate the creation of the columns and to change all attributes at once
-  
-  $t = new cTable('table1','users');
-  $t-&gt;ChangeTHcontent(array(0=&gt;'Name',1=&gt;'Given names',2=&gt;'Address')); // Here the column headers does not exist, nevertheless this method creates the missing columns (thus columns [0],[1] and [2] are created and the contents are added).
-  $t-&gt;ChangeTHattr('id', array(0=&gt;'th0',1=&gt;'th1',2=&gt;'th2'));           // Here the html 'id' attributes exist (columns are created in previous line) but values are empty. This populates the 'id' attributes with distinct values.
-  $t-&gt;ChangeTHattr('class', 'head');                                   // Here is the same as in previous line, but only one value is provided. In this case, this attribute value will be used in all column headers.  
-  $t-&gt;arrTH[0]-&gt;AddAttrValue('class',' bold');                         // Here we just add the ' bold' value into the existing html class attribute, only in the first column.
-  echo $t-&gt;GetTHrow();
-  
-  // Output:  &lt;tr&gt;&lt;th id="th0" class="head bold"&gt;Name&lt;/th&gt;&lt;th id="th1" class="head"&gt;Given names&lt;/th&gt;&lt;th id="th2" class="head"&gt;Name&lt;/th&gt;&lt;/tr&gt;
-  
-QUICK START EXAMPLE #4: With clickable column header to change sorting order
----
-
-  $t = new cTable('table1','users');
-  $t-&gt;rowcount = 5;
-  $t-&gt;activecol = $_GET['order'];
-  $t-&gt;activelink = '';
-  $t-&gt;arrTH['name']      = new cTableHead('Name',       'th0', 'head', '&lt;a href="thispage.php?order=name"&gt;%s&lt;/a&gt;');
-  $t-&gt;arrTH['firstname'] = new cTableHead('Given names','th1', 'head', '&lt;a href="thispage.php?order=firstname"&gt;%s&lt;/a&gt;');
-  $t-&gt;arrTH['address']   = new cTableHead('Address',    'th2', 'head', '&lt;a href="thispage.php?order=address"&gt;%s&lt;/a&gt;');
-  echo $t-&gt;GetTHrow();
-  
-  // Here the column headers have link property. These patterns are applied to the column headers, except for the active column.
-  // When the active column is 'name', the output is:
-  // &lt;tr&gt;
-  // &lt;th id="th0" class="head"&gt;Name&lt;/th&gt;
-  // &lt;th id="th1" class="head"&gt;&lt;a href="thispage.php?order=firstname"&gt;Given names&lt;/a&gt;&lt;/th&gt;
-  // &lt;th id="th2" class="head"&gt;&lt;a href="thispage.php?order=address"&gt;Address&lt;/a&gt;&lt;/th&gt;
-  // &lt;/tr&gt;
-  // Note:
-  // If rowcount is 0 or 1 (i.e. the dataset is empty or contains only 1 row), the link property is not added in the column headers and the output will be the same as in example #3.
-  
-QUICK START EXAMPLE #5: With clickable column headers to change sorting order AND sorting direction (can be switched ascending/descending)
----
-
-  $t = new cTable('table1','users');
-  $t-&gt;rowcount = 5;
-  $t-&gt;activecol = $_GET['order'];
-  $t-&gt;activelink = '&lt;a href="thispage.php?order='.$_GET['order'].'&amp;direction='.($_GET['direction']=='asc' ? 'desc' : 'asc').'"&gt;%s&lt;/a&gt;';
-  $t-&gt;arrTH['name']      = new cTableHead('Name',       'th0', 'head', '&lt;a href="thispage.php?order=name&amp;direction=asc"&gt;%s&lt;/a&gt;');
-  $t-&gt;arrTH['firstname'] = new cTableHead('Given names','th1', 'head', '&lt;a href="thispage.php?order=firstname&amp;direction=asc"&gt;%s&lt;/a&gt;');
-  $t-&gt;arrTH['address']   = new cTableHead('Address',    'th2', 'head', '&lt;a href="thispage.php?order=address&amp;direction=asc"&gt;%s&lt;/a&gt;');
-  echo $t-&gt;GetTHrow();
-  
-  // Here the column headers have a link property. These patterns are applied to the column headers.
-  // For the active column header an other url link is used: an url link with a reversed direction (from 'asc' to 'desc')
-  
-  // When the active column is 'name', the output is:
-  // &lt;tr&gt;
-  // &lt;th id="th0" class="head"&gt;&lt;a href="thispage.php?order=name&amp;direction=desc"&gt;Name&lt;/a&gt;&lt;/th&gt;
-  // &lt;th id="th1" class="head"&gt;&lt;a href="thispage.php?order=firstname&amp;direction=asc"&gt;Given names&lt;/a&gt;&lt;/th&gt;
-  // &lt;th id="th2" class="head"&gt;&lt;a href="thispage.php?order=address&amp;direction=asc"&gt;Address&lt;/a&gt;&lt;/th&gt;
-  // &lt;/tr&gt;
-  // Note:
-  // If rowcount is 0 or 1 (i.e. the dataset is empty or contains only 1 row), the link property is not added in the column headers and the output will be the same as in example #3.
-
+      $t = new cTable('table1','users');
+      $t-&gt;arrTH[0] = new cTableHead('Name',       'th0', 'head bold');
+      $t-&gt;arrTH[1] = new cTableHead('Given names','th1', 'head'     );
+      $t-&gt;arrTH[2] = new cTableHead('Address',    'th2', 'head'     );
+      echo $t-&gt;GetTHrow();
+  
+      // Output:  &lt;tr&gt;&lt;th id="th0" class="head bold"&gt;Name&lt;/th&gt;&lt;th id="th1" class="head"&gt;Given names&lt;/th&gt;&lt;th id="th2" class="head"&gt;Name&lt;/th&gt;&lt;/tr&gt;
+
+QUICK START EXAMPLE #3:
+---
+This is identical to the example #2, but using advanced methods to automate the creation of the columns and to change all attributes at once
+  
+      $t = new cTable('table1','users');
+      $t-&gt;ChangeTHcontent(array(0=&gt;'Name',1=&gt;'Given names',2=&gt;'Address')); // Here the column headers does not exist, nevertheless this method creates the missing columns (thus columns [0],[1] and [2] are created and the contents are added).
+      $t-&gt;ChangeTHattr('id', array(0=&gt;'th0',1=&gt;'th1',2=&gt;'th2'));           // Here the html 'id' attributes exist (columns are created in previous line) but values are empty. This populates the 'id' attributes with distinct values.
+      $t-&gt;ChangeTHattr('class', 'head');                                   // Here is the same as in previous line, but only one value is provided. In this case, this attribute value will be used in all column headers.  
+      $t-&gt;arrTH[0]-&gt;AddAttrValue('class',' bold');                         // Here we just add the ' bold' value into the existing html class attribute, only in the first column.
+      echo $t-&gt;GetTHrow();
+  
+      // Output:  &lt;tr&gt;&lt;th id="th0" class="head bold"&gt;Name&lt;/th&gt;&lt;th id="th1" class="head"&gt;Given names&lt;/th&gt;&lt;th id="th2" class="head"&gt;Name&lt;/th&gt;&lt;/tr&gt;
+  
+QUICK START EXAMPLE #4:
+---
+With clickable column header to change sorting order
+
+      $t = new cTable('table1','users');
+      $t-&gt;rowcount = 5;
+      $t-&gt;activecol = $_GET['order'];
+      $t-&gt;activelink = '';
+      $t-&gt;arrTH['name']      = new cTableHead('Name',       'th0', 'head', '&lt;a href="thispage.php?order=name"&gt;%s&lt;/a&gt;');
+      $t-&gt;arrTH['firstname'] = new cTableHead('Given names','th1', 'head', '&lt;a href="thispage.php?order=firstname"&gt;%s&lt;/a&gt;');
+      $t-&gt;arrTH['address']   = new cTableHead('Address',    'th2', 'head', '&lt;a href="thispage.php?order=address"&gt;%s&lt;/a&gt;');
+      echo $t-&gt;GetTHrow();
+      
+      // Here the column headers have link property. These patterns are applied to the column headers, except for the active column.
+      // When the active column is 'name', the output is:
+      // &lt;tr&gt;
+      // &lt;th id="th0" class="head"&gt;Name&lt;/th&gt;
+      // &lt;th id="th1" class="head"&gt;&lt;a href="thispage.php?order=firstname"&gt;Given names&lt;/a&gt;&lt;/th&gt;
+      // &lt;th id="th2" class="head"&gt;&lt;a href="thispage.php?order=address"&gt;Address&lt;/a&gt;&lt;/th&gt;
+      // &lt;/tr&gt;
+      // Note:
+      // If rowcount is 0 or 1 (i.e. the dataset is empty or contains only 1 row), the link property is not added in the column headers and the output will be the same as in example #3.
+  
+QUICK START EXAMPLE #5:
+---
+With clickable column headers to change sorting order AND sorting direction (can be switched ascending/descending)
+
+      $t = new cTable('table1','users');
+      $t-&gt;rowcount = 5;
+      $t-&gt;activecol = $_GET['order'];
+      $t-&gt;activelink = '&lt;a href="thispage.php?order='.$_GET['order'].'&amp;direction='.($_GET['direction']=='asc' ? 'desc' : 'asc').'"&gt;%s&lt;/a&gt;';
+      $t-&gt;arrTH['name']      = new cTableHead('Name',       'th0', 'head', '&lt;a href="thispage.php?order=name&amp;direction=asc"&gt;%s&lt;/a&gt;');
+      $t-&gt;arrTH['firstname'] = new cTableHead('Given names','th1', 'head', '&lt;a href="thispage.php?order=firstname&amp;direction=asc"&gt;%s&lt;/a&gt;');
+      $t-&gt;arrTH['address']   = new cTableHead('Address',    'th2', 'head', '&lt;a href="thispage.php?order=address&amp;direction=asc"&gt;%s&lt;/a&gt;');
+      echo $t-&gt;GetTHrow();
+      
+      // Here the column headers have a link property. These patterns are applied to the column headers.
+      // For the active column header an other url link is used: an url link with a reversed direction (from 'asc' to 'desc')
+      
+      // When the active column is 'name', the output is:
+      // &lt;tr&gt;
+      // &lt;th id="th0" class="head"&gt;&lt;a href="thispage.php?order=name&amp;direction=desc"&gt;Name&lt;/a&gt;&lt;/th&gt;
+      // &lt;th id="th1" class="head"&gt;&lt;a href="thispage.php?order=firstname&amp;direction=asc"&gt;Given names&lt;/a&gt;&lt;/th&gt;
+      // &lt;th id="th2" class="head"&gt;&lt;a href="thispage.php?order=address&amp;direction=asc"&gt;Address&lt;/a&gt;&lt;/th&gt;
+      // &lt;/tr&gt;
+      // Note:
+      // If rowcount is 0 or 1 (i.e. the dataset is empty or contains only 1 row), the link property is not added in the column headers and the output will be the same as in example #3.
+
  QUICK START EXAMPLE #6: Show how to have a specific a style added in the dataset row.
  
   $t = new cTable('table1','users');
   $t-&gt;arrTH['name'] = new cTableHead('Name');
   $t-&gt;arrTH['bill'] = new cTableHead('Dollars');
   $t-&gt;arrTD['name'] = new cTableData(); // We create an empty &lt;td&gt; object. It will be filled when looping in the dataset
   $t-&gt;arrTD['bill'] = new cTableData();
   $t-&gt;arrTD['bill']-&gt;dynamicValues = array('positive'=&gt;'background-color:green','negative'=&gt;'background-color:red');
   echo $t-&gt;Start();
   echo $t-&gt;GetTHrow();
   // We loop in the dataset (e.g. a row fetched from a sql query)
   while($row = mysql_fetch_assoc($result))
   {
     $t-&gt;arrTD['name']-&gt;content = $row['name'];
     $t-&gt;arrTD['bill']-&gt;content = $row['bill']; 
     $t-&gt;arrTD['bill']-&gt;AddDynamicAttr('style', ($row['bill']&lt;0 ? 'negative' : 'positive'));
     echo $t-&gt;GetTDrow();
   }
   echo $t-&gt;End();
   // Note, if the arrTD are designed with the same key as the database fieldname,
   // instead of adding the row content cell by cell,
   // we can populate all cells of the row with the method $t-&gt;ChangeTDcontent($row);
 
- QUICK START EXAMPLE #7:
- Using advanced methods. Here we create columns without instantiating each column object.
- 
-   $t = new cTable('table1','users');
-   $t-&gt;ChangeTHcontent(array('Name','Given name','Address')); // create column headers (because not yet existing) and fill content
-   $t-&gt;ChangeTHattr('class','head'); // add a 'class' attribute with value 'head' to each column
-   
-   echo $t-&gt;Start();
-   echo $t-&gt;GetTHrow();
-   $t-&gt;ChangeTDcontent(array('Smith','John','Wallstreet')); echo $t-&gt;GetTDrow();
-   $t-&gt;ChangeTDcontent(array('White','Bob','Downstreet')); echo $t-&gt;GetTDrow();
-   $t-&gt;ChangeTDcontent(array('Brown','Bill','Mainstreet')); echo $t-&gt;GetTDrow();
-   echo $t-&gt;End();
-   
-   // Output:
-   
-   &lt;table id="table1" class="users"&gt;
-   &lt;tr&gt;
-   &lt;th class="head"&gt;Name&lt;/th&gt;&lt;th class="head"&gt;Given name&lt;/th&gt;&lt;th class="head"&gt;Address&lt;/th&gt;&lt;/tr&gt;
-   &lt;tr&gt;&lt;td&gt;Smith&lt;/td&gt;&lt;td&gt;John&lt;/td&gt;&lt;td&gt;Wallstreet&lt;/td&gt;&lt;/tr&gt;
-   &lt;tr&gt;&lt;td&gt;White&lt;/td&gt;&lt;td&gt;Bob&lt;/td&gt;&lt;td&gt;Downstreet&lt;/td&gt;&lt;/tr&gt;
-   &lt;tr&gt;&lt;td&gt;Brown&lt;/td&gt;&lt;td&gt;Bill&lt;/td&gt;&lt;td&gt;Mainstreet&lt;/td&gt;&lt;/tr&gt;
+QUICK START EXAMPLE #7:
+---
+Using advanced methods. Here we create columns without instantiating each column object.
+ 
+       $t = new cTable('table1','users');
+       $t-&gt;ChangeTHcontent(array('Name','Given name','Address')); // create column headers (because not yet existing) and fill content
+       $t-&gt;ChangeTHattr('class','head'); // add a 'class' attribute with value 'head' to each column
+       
+       echo $t-&gt;Start();
+       echo $t-&gt;GetTHrow();
+       $t-&gt;ChangeTDcontent(array('Smith','John','Wallstreet')); echo $t-&gt;GetTDrow();
+       $t-&gt;ChangeTDcontent(array('White','Bob','Downstreet')); echo $t-&gt;GetTDrow();
+       $t-&gt;ChangeTDcontent(array('Brown','Bill','Mainstreet')); echo $t-&gt;GetTDrow();
+       echo $t-&gt;End();
+       
+       // Output:
+       
+       &lt;table id="table1" class="users"&gt;
+       &lt;tr&gt;
+       &lt;th class="head"&gt;Name&lt;/th&gt;&lt;th class="head"&gt;Given name&lt;/th&gt;&lt;th class="head"&gt;Address&lt;/th&gt;&lt;/tr&gt;
+       &lt;tr&gt;&lt;td&gt;Smith&lt;/td&gt;&lt;td&gt;John&lt;/td&gt;&lt;td&gt;Wallstreet&lt;/td&gt;&lt;/tr&gt;
+       &lt;tr&gt;&lt;td&gt;White&lt;/td&gt;&lt;td&gt;Bob&lt;/td&gt;&lt;td&gt;Downstreet&lt;/td&gt;&lt;/tr&gt;
+       &lt;tr&gt;&lt;td&gt;Brown&lt;/td&gt;&lt;td&gt;Bill&lt;/td&gt;&lt;td&gt;Mainstreet&lt;/td&gt;&lt;/tr&gt;
    &lt;/table&gt;
   
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">q-code</dc:creator><pubDate>Wed, 29 Feb 2012 16:07:05 -0000</pubDate><guid>https://sourceforge.net632cd4cb1cf2da1acb7e68d54840cb0347b0b52f</guid></item><item><title>WikiPage UsageSamples modified by q-code</title><link>https://sourceforge.net/p/ctabledynamic/wiki/UsageSamples/</link><description>QUICK START EXAMPLE #1:
---

    $t = new cTable('table1','users');
    $t-&gt;AddAttr('summary','Registered users');
    echo $t-&gt;Start();
  
    // Output:  &lt;table id="table1" class="users" summary="Registered users"&gt;

QUICK START EXAMPLE #2:
---

  $t = new cTable('table1','users');
  $t-&gt;arrTH[0] = new cTableHead('Name',       'th0', 'head bold');
  $t-&gt;arrTH[1] = new cTableHead('Given names','th1', 'head'     );
  $t-&gt;arrTH[2] = new cTableHead('Address',    'th2', 'head'     );
  echo $t-&gt;GetTHrow();
  
  // Output:  &lt;tr&gt;&lt;th id="th0" class="head bold"&gt;Name&lt;/th&gt;&lt;th id="th1" class="head"&gt;Given names&lt;/th&gt;&lt;th id="th2" class="head"&gt;Name&lt;/th&gt;&lt;/tr&gt;

QUICK START EXAMPLE #3: This is identical to the example #2, but using advanced methods to automate the creation of the columns and to change all attributes at once
  
  $t = new cTable('table1','users');
  $t-&gt;ChangeTHcontent(array(0=&gt;'Name',1=&gt;'Given names',2=&gt;'Address')); // Here the column headers does not exist, nevertheless this method creates the missing columns (thus columns [0],[1] and [2] are created and the contents are added).
  $t-&gt;ChangeTHattr('id', array(0=&gt;'th0',1=&gt;'th1',2=&gt;'th2'));           // Here the html 'id' attributes exist (columns are created in previous line) but values are empty. This populates the 'id' attributes with distinct values.
  $t-&gt;ChangeTHattr('class', 'head');                                   // Here is the same as in previous line, but only one value is provided. In this case, this attribute value will be used in all column headers.  
  $t-&gt;arrTH[0]-&gt;AddAttrValue('class',' bold');                         // Here we just add the ' bold' value into the existing html class attribute, only in the first column.
  echo $t-&gt;GetTHrow();
  
  // Output:  &lt;tr&gt;&lt;th id="th0" class="head bold"&gt;Name&lt;/th&gt;&lt;th id="th1" class="head"&gt;Given names&lt;/th&gt;&lt;th id="th2" class="head"&gt;Name&lt;/th&gt;&lt;/tr&gt;
  
QUICK START EXAMPLE #4: With clickable column header to change sorting order
---

  $t = new cTable('table1','users');
  $t-&gt;rowcount = 5;
  $t-&gt;activecol = $_GET['order'];
  $t-&gt;activelink = '';
  $t-&gt;arrTH['name']      = new cTableHead('Name',       'th0', 'head', '&lt;a href="thispage.php?order=name"&gt;%s&lt;/a&gt;');
  $t-&gt;arrTH['firstname'] = new cTableHead('Given names','th1', 'head', '&lt;a href="thispage.php?order=firstname"&gt;%s&lt;/a&gt;');
  $t-&gt;arrTH['address']   = new cTableHead('Address',    'th2', 'head', '&lt;a href="thispage.php?order=address"&gt;%s&lt;/a&gt;');
  echo $t-&gt;GetTHrow();
  
  // Here the column headers have link property. These patterns are applied to the column headers, except for the active column.
  // When the active column is 'name', the output is:
  // &lt;tr&gt;
  // &lt;th id="th0" class="head"&gt;Name&lt;/th&gt;
  // &lt;th id="th1" class="head"&gt;&lt;a href="thispage.php?order=firstname"&gt;Given names&lt;/a&gt;&lt;/th&gt;
  // &lt;th id="th2" class="head"&gt;&lt;a href="thispage.php?order=address"&gt;Address&lt;/a&gt;&lt;/th&gt;
  // &lt;/tr&gt;
  // Note:
  // If rowcount is 0 or 1 (i.e. the dataset is empty or contains only 1 row), the link property is not added in the column headers and the output will be the same as in example #3.
  
QUICK START EXAMPLE #5: With clickable column headers to change sorting order AND sorting direction (can be switched ascending/descending)
---

  $t = new cTable('table1','users');
  $t-&gt;rowcount = 5;
  $t-&gt;activecol = $_GET['order'];
  $t-&gt;activelink = '&lt;a href="thispage.php?order='.$_GET['order'].'&amp;direction='.($_GET['direction']=='asc' ? 'desc' : 'asc').'"&gt;%s&lt;/a&gt;';
  $t-&gt;arrTH['name']      = new cTableHead('Name',       'th0', 'head', '&lt;a href="thispage.php?order=name&amp;direction=asc"&gt;%s&lt;/a&gt;');
  $t-&gt;arrTH['firstname'] = new cTableHead('Given names','th1', 'head', '&lt;a href="thispage.php?order=firstname&amp;direction=asc"&gt;%s&lt;/a&gt;');
  $t-&gt;arrTH['address']   = new cTableHead('Address',    'th2', 'head', '&lt;a href="thispage.php?order=address&amp;direction=asc"&gt;%s&lt;/a&gt;');
  echo $t-&gt;GetTHrow();
  
  // Here the column headers have a link property. These patterns are applied to the column headers.
  // For the active column header an other url link is used: an url link with a reversed direction (from 'asc' to 'desc')
  
  // When the active column is 'name', the output is:
  // &lt;tr&gt;
  // &lt;th id="th0" class="head"&gt;&lt;a href="thispage.php?order=name&amp;direction=desc"&gt;Name&lt;/a&gt;&lt;/th&gt;
  // &lt;th id="th1" class="head"&gt;&lt;a href="thispage.php?order=firstname&amp;direction=asc"&gt;Given names&lt;/a&gt;&lt;/th&gt;
  // &lt;th id="th2" class="head"&gt;&lt;a href="thispage.php?order=address&amp;direction=asc"&gt;Address&lt;/a&gt;&lt;/th&gt;
  // &lt;/tr&gt;
  // Note:
  // If rowcount is 0 or 1 (i.e. the dataset is empty or contains only 1 row), the link property is not added in the column headers and the output will be the same as in example #3.

 QUICK START EXAMPLE #6: Show how to have a specific a style added in the dataset row.
 
  $t = new cTable('table1','users');
  $t-&gt;arrTH['name'] = new cTableHead('Name');
  $t-&gt;arrTH['bill'] = new cTableHead('Dollars');
  $t-&gt;arrTD['name'] = new cTableData(); // We create an empty &lt;td&gt; object. It will be filled when looping in the dataset
  $t-&gt;arrTD['bill'] = new cTableData();
  $t-&gt;arrTD['bill']-&gt;dynamicValues = array('positive'=&gt;'background-color:green','negative'=&gt;'background-color:red');
  echo $t-&gt;Start();
  echo $t-&gt;GetTHrow();
  // We loop in the dataset (e.g. a row fetched from a sql query)
  while($row = mysql_fetch_assoc($result))
  {
    $t-&gt;arrTD['name']-&gt;content = $row['name'];
    $t-&gt;arrTD['bill']-&gt;content = $row['bill']; 
    $t-&gt;arrTD['bill']-&gt;AddDynamicAttr('style', ($row['bill']&lt;0 ? 'negative' : 'positive'));
    echo $t-&gt;GetTDrow();
  }
  echo $t-&gt;End();
  // Note, if the arrTD are designed with the same key as the database fieldname,
  // instead of adding the row content cell by cell,
  // we can populate all cells of the row with the method $t-&gt;ChangeTDcontent($row);

 QUICK START EXAMPLE #7:
 Using advanced methods. Here we create columns without instantiating each column object.
 
   $t = new cTable('table1','users');
   $t-&gt;ChangeTHcontent(array('Name','Given name','Address')); // create column headers (because not yet existing) and fill content
   $t-&gt;ChangeTHattr('class','head'); // add a 'class' attribute with value 'head' to each column
   
   echo $t-&gt;Start();
   echo $t-&gt;GetTHrow();
   $t-&gt;ChangeTDcontent(array('Smith','John','Wallstreet')); echo $t-&gt;GetTDrow();
   $t-&gt;ChangeTDcontent(array('White','Bob','Downstreet')); echo $t-&gt;GetTDrow();
   $t-&gt;ChangeTDcontent(array('Brown','Bill','Mainstreet')); echo $t-&gt;GetTDrow();
   echo $t-&gt;End();
   
   // Output:
   
   &lt;table id="table1" class="users"&gt;
   &lt;tr&gt;
   &lt;th class="head"&gt;Name&lt;/th&gt;&lt;th class="head"&gt;Given name&lt;/th&gt;&lt;th class="head"&gt;Address&lt;/th&gt;&lt;/tr&gt;
   &lt;tr&gt;&lt;td&gt;Smith&lt;/td&gt;&lt;td&gt;John&lt;/td&gt;&lt;td&gt;Wallstreet&lt;/td&gt;&lt;/tr&gt;
   &lt;tr&gt;&lt;td&gt;White&lt;/td&gt;&lt;td&gt;Bob&lt;/td&gt;&lt;td&gt;Downstreet&lt;/td&gt;&lt;/tr&gt;
   &lt;tr&gt;&lt;td&gt;Brown&lt;/td&gt;&lt;td&gt;Bill&lt;/td&gt;&lt;td&gt;Mainstreet&lt;/td&gt;&lt;/tr&gt;
   &lt;/table&gt;
  </description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">q-code</dc:creator><pubDate>Wed, 29 Feb 2012 16:04:48 -0000</pubDate><guid>https://sourceforge.netf8054b0b29fbf16003b0ff3877fa42829d172b50</guid></item></channel></rss>