Little note from the redactor, my natural language is french, so i apologize for the probable incoherences
in this text
Listing data with mlam ?
Introduction
The main aim of mlam is to edit databases content with html interfaces. But you need to have an access to
the data, and to develop specific pages to list all the data (eventually by index to avoid pages with
thousand of data), or even to create search engines to find the data is something quite boring. These tasks
can be performed by mlam, with a lot of options.
Features
When defining a structure to edit data in mlam's administration tool, a link is present to edit the listing
of the current data. This link takes the user to a specific page allowing the definition of how the users
will have access to the data. A structure presents all the fields of the current table. It allows to specify
the fields shown for each data, the title given to these fields, how they are ordered, and the fields used
in the search engine. Except for at least one field shown, all the other options are optional. To use this
functionality, this is exactly the same process than the data edition, a .php page containing at least
these lines :
<?session_start();?>
<html>
<head>
</head>
<body>
<form method=post action='your_file.php'>
<?
require("mlam_tables_def.php");
mlam_form("your_structure_name",$id);
?>
<input class=button type=submit value='Validate the changes'>
</form>
</body>
</html>
In fact, this is exactly the same file used for editing the data. The only difference remains in the url.
If id is not mentioned, the data are listed. If id has a value, the
corresponding data is shown. So, to list your data, you have just to call "http://yoursite/your_file.php",
and that's it !
Administration tool
This is presented like this :
Edition of the parameters for listing and searching data
Fields listed
The data are shown line by line. Each line consists of the fields selected. To show the content of a field,
you have just to select the Shown ? option in the administration tool. You have also the possibility
to select the order of the data shown (here designation comes before datePremiereEdition). At
last, you're welcome to indicate what mean this field (for your users).
The result page will be something like :
Main name | date of first edition |
name 1 | date 1 |
name 2 | date 2 |
In mlam's administration tool, you have the possibility to define the maximum number of data shown each time
mlam lists data. This number is also used here. If more data are available, mlam creates automatically
a link to see the next (or previous) set of data.
Ordering the results
You have the possibility to indicate one or more fields which will be used to order the listing of the
data. You just have to select ASC or DESC in the Ordered column for each field you want to use.
ASC mean ascending order, and DESC descending order. Next, the column order for sorting gives
the priority in the ordering process (just like a sql query). In this case, the list is ordered by
designation in ascending order. The corresponding sql query looks like "order by designation asc".
Search engine
If the column Search it? is selected for at least one row, a search engine will be available in
the page listing the data. It allows the user to look for data by selecting queries for each selected
field. The internal mlam search engine differs according to the type of data. It looks like this :
For the date format, the submitted data is checked by mlam before using it.
Note : you can use as many fields as you want to look for data. If more than one data is submitted,
the results will match all the elements.