Commit e2c81b5e authored by Carsten  Rose's avatar Carsten Rose
Browse files

Documentation/UsersManual/index.rst: example for page 'search'. Rewrote to match Typo 6.x and 7.x

Store.php, Constants.php: STORE_EMPTY implemented. Similar to STORE_ZERO, but returns allways an empty string instead of 0.
parent 0c2d11fb
......@@ -213,8 +213,11 @@ Only variables that are known in a specified store can be substituted.
+-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
| V | Vars - Generic variables | |
+-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
| 0 | Value: 0, might be helpful if variable is empty but used in an SQL statement, which | All possible keys |
| | might produce a SQL error otherwise if substituted with an empty string | |
| 0 | Zero - allways value: 0, might be helpful if a variable is empty or undefined and will | All possible keys |
| | be used in an SQL statement. | |
+-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
| E | Empty - allways value: 0, might be helpful if a variable is empty or undefined and will| All possible keys |
| | be used in an SQL statement | |
+-----+----------------------------------------------------------------------------------------+----------------------------------------------------------------------------+
| Y | System: a) Database credentials, b) helper vars for logging/debugging: | |
| | SYSTEM_SQL_RAW ... SYSTEM_FORM_ELEMENT_COLUMN | |
......@@ -2165,13 +2168,14 @@ QFQ content record::
# Creates a small form that redirects back to this page
10 {
sql = SELECT '_'
head = <form action='{{pageId:T}}'>Search for person by name: <input type='text' name='search' vaue='{{search:C0:all}}'><input type='submit' value='Search'></form>
head = <form action='#' method='get'><input type='hidden' name='id' value='{{pageId:T}}'>Search for person by name: <input type='text' name='search' value='{{search:CE:all}}'><input type='submit' value='Search'></form>
}
# SQL statement will find and list all the relevant persons
20 {
sql = SELECT CONCAT('persondetail&form=person&r=', p.id) AS Pagee, CONCAT(p.lastName, ', ', p.firstName)
FROM person AS p WHERE CONCAT(p.lastName, ', ', p.firstName, ' ' , p.lastName) LIKE '%{{search:C0:all}}%'
sql = SELECT CONCAT('?detail&form=form&r=', f.id) AS Pagee, f.name
FROM Form AS f
WHERE f.name LIKE '%{{search:CE:all}}%'
head = <table>
tail = </table>
rbeg = <tr>
......@@ -2180,4 +2184,3 @@ QFQ content record::
fend = </td>
}
......@@ -173,6 +173,7 @@ const STORE_CLIENT = "C"; // Client: POST variable, if not found: GET variable
const STORE_TYPO3 = "T"; // Typo3 > Page content record > bodytext
const STORE_VAR = "V"; // Generic Vars
const STORE_ZERO = "0"; // value: 0, might helpfull if variable is empty but used in an SQL statement, which might produce a SQL error otherwise if substituted with an empty string
const STORE_EMPTY = "E"; // value: '', might helpfull if variable is not defined and should result in an empty string instead of {{...}} (cause not replaced)
const STORE_SYSTEM = "Y"; // various system values like db connection credentials
const STORE_USE_DEFAULT = "FSRD";
......
......@@ -317,6 +317,8 @@ class Store {
switch ($store) {
case STORE_ZERO:
return 0;
case STORE_EMPTY:
return '';
case STORE_VAR:
if ($key === VAR_RANDOM) {
return self::randomAlphaNum(RANDOM_LENGTH);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment