Difference between revisions of "AdminLists"

From GeeklogWiki
Jump to: navigation, search
Line 48: Line 48:
 
<table border="1">
 
<table border="1">
 
<tr><th>Field/Array Name</th><th>Content</th><th>Data Type</th><th>Required</th></tr>
 
<tr><th>Field/Array Name</th><th>Content</th><th>Data Type</th><th>Required</th></tr>
<tr><td>has_menu</td><td>If set to true</td><th>boolean</th><td>Yes</td></tr>
+
<tr><td>has_menu</td><td>If set to true</td><td>boolean</td><td>Yes</td></tr>
<tr><td>title</td><td>The title of the table. Since the table will be in a block, the block needs a title</td><th>string</th><td>Yes</td></tr>
+
<tr><td>title</td><td>The title of the table. Since the table will be in a block, the block needs a title</td><td>string</td><td>Yes</td></tr>
<tr><td>help_url</td><td>The url that shows help for the block</td><td>string</td><th>No</td></tr>
+
<tr><td>help_url</td><td>The url that shows help for the block</td><td>string</td><td>No</td></tr>
<tr><td>form_url</td><td>The form used in case the menu is there</td><td>string</td><th>if has_menu=true</td></tr>
+
<tr><td>form_url</td><td>The form used in case the menu is there</td><td>string</td><td>if has_menu=true</td></tr>
 
<tr><td>icon</th><td>An Icon to be displayed</td><td>string</th><td>No</td></tr>
 
<tr><td>icon</th><td>An Icon to be displayed</td><td>string</th><td>No</td></tr>
 
<tr><td>instructions</td><td>Some text to explain how the table works</td><td>string</td><td>no</td></tr>
 
<tr><td>instructions</td><td>Some text to explain how the table works</td><td>string</td><td>no</td></tr>

Revision as of 09:13, 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.

Field/Array NameContentData TypeRequired
textThe text that the user sees on top of the columnstringYes
fieldThe field in the data-array that is used to show the datastringYes
widthThe CSS width of the columnNo
header_classThe CSS class that should be assigned to the header fieldstringNo
field_classThe CSS class that should be assigned to the data fields belowstringNo

Then, you need a text-array, defining some other details of the table:

$text_arr = array(
    'has_menu' => false,
    'title' => $LANG10[1],
);
<td>string</th><td>No</td>

<tr><td>instructions</td><td>Some text to explain how the table works</td><td>string</td><td>no</td></tr> <tr><td>no_data</td><td>The string that is shown in case the table is empty. If this is not given, $LANG_ADMIN['no_results'] is shown</td><td>string</td><td>No</td></tr> </table>

Complex Lists

Field/Array NameContentData TypeRequired
has_menuIf set to truebooleanYes
titleThe title of the table. Since the table will be in a block, the block needs a titlestringYes
help_urlThe url that shows help for the blockstringNo
form_urlThe form used in case the menu is therestringif has_menu=true
icon</th><td>An Icon to be displayed