Usage - lokothodida/DM_Matrix GitHub Wiki
- int, integer, used for ID field
- text, normal text box
- textlong, full width Text Box
- Checkbox, Checkbox.
- slug, add a slug & title to the table
- pages, a dropdown of the current Pages.
- templates, a dropdown of the current templates
- dropdown, a dropdown that populates its values from another table.
- datepicker, a date picker field.
- datetimepicker, a date and time picker.
- image, an image selector field
- filepicker, a file selector field
- textarea, a plain textarea
- codeeditor, a codemirror textarea
- wysiwyg, a CKEditor enabled textarea.
DM_query(query,type,cache=true)
Perform a query against matrix tables.
Argument 1 required Is the sql query string.
Argument 2 optional Defaults to DM_MULTI returns a multi dimensional array, DM_SINGLE returna single array for 1 record, DM_COUNT returns the count of record returned by the query
Argument 3 optional Is to control caching of tables in case you know the table was modified since last query.
Returns Returns a named array containing result rows of query
Example
// returns a single record
$myquery = "select * from testable where id = 1";
$result=DM_query($myquery,DM_SINGLE);
echo '<pre>'.print_r($result,true).'</pre>';
// returns all records from the table
$myquery = "select * from testable";
$result=DM_query($myquery,DM_MULTI);
echo '<pre>'.print_r($result,true).'</pre>';
DM_getSchema - get the main Schema
DM_saveSchema - Save the schema out to an XML file schema.xml
createSchemaFolder - create the base folder for the record files
createRecord - Add a record/file to a table
getNextRecord - returns the next record number in the table
createSchemaTable - Create a new table
dropSchemaTable - Delete a table
addSchemaField - add a field to a table
deleteSchemaField - Delete a field from a table
getSchemaTable - return an array of a tables records.
DM_getRecord - get a single record from a table, supplying tabel and id of record
tableexists - check if a table exists
updateRecord - update a record
DM_createForm - create an input form from a table
DM_editForm - create a form for editing providing a record number.