Difference between revisions of "AdminLists"

From GeeklogWiki
Jump to: navigation, search
Line 29: Line 29:
 
</pre>
 
</pre>
 
You can see that you need to create a multi-dimensional array with several fields, most of which are optional. Required are the first two.
 
You can see that you need to create a multi-dimensional array with several fields, most of which are optional. Required are the first two.
<table>
+
<table border="1">
<tr><td>Field/ Array Name</td><td>Content</td><td>Required</td></tr>
+
<tr><th>Field/ Array Name</th><th>Content</th><td>Required</th></tr>
 
<tr><td>text</td><td>The text that the user sees on top of the column</td><td>Yes</td></tr>
 
<tr><td>text</td><td>The text that the user sees on top of the column</td><td>Yes</td></tr>
 
<tr><td>field</td><td>The field in the data-array that is used to show the data</td><td>Yes</td></tr>
 
<tr><td>field</td><td>The field in the data-array that is used to show the data</td><td>Yes</td></tr>

Revision as of 09:00, 1 March 2007

Introduction

Geeklog 1.4 has an engine to create tables/lists from data. This engine can be used to make sure that all tabular information looks similar all over the site. It is also helpful to reduce the amount of code that has to be written for a table, including template files.

To use this function, you have to choose between two main differences: Simple & Complex lists. The main difference is that the simple lists need an array of data and the complex lists need an SQL string of data. So if you do not have your data in a database table, you will need to use a simple list. Also, the simple lists only can be displayed several times on a page (such as used on the moderation and statistics screens). This guide will tell you first how to create a simple list, and then describe the aditional features of complex lists.

Generally it is recommended to take any of the existing lists and changing the details. This makes sure that you use the required set of data for a complete table.

Simple Lists

As an example, this guide will show you how to create a simple list by using the statistics page /public_html/stats.php.

The first element of a list is the header, the line where you can read what the information below represents. To define those use an array:

$header_arr = array(
    array(
        'text' => $LANG10[1], 
        'field' => 'title', 
        'width' => '90%', 
        'header_class' => 'stats-header-title'
    ),
    array(
        'text' => "", 
        'field' => 'stats', 
        'width' => '10%', 
        'header_class' => 'stats-header-count', 
        'field_class' => 'stats-list-count'
    ),
);

You can see that you need to create a multi-dimensional array with several fields, most of which are optional. Required are the first two.

<tr><td>text</td><td>The text that the user sees on top of the column</td><td>Yes</td></tr> <tr><td>field</td><td>The field in the data-array that is used to show the data</td><td>Yes</td></tr> <tr><td>width</td><td>The width of the column</td><td>No</td></tr> <tr><td>header_class</td><td>The CSS class that should be assigned to the header field</td><td>No</td></tr> <tr><td>field_class</td><td>The CSS class that should be assigned to the data fields below</td><td>No</td></tr> </table>

Complex Lists

Field/ Array NameContentRequired</th>