|
"Template Engine" is processing all that is inside Template SET and is the mean
of output of non-edited data.
"Database Engine" is checking and processing data (Mail, MySQL)
received from the form. It was created as a layer between "Template Engine" and
SP.DE (Database Engine Interface). "Database Engine" is able to work
with TE tags and to output and manage (EDIT) data from MySQL tables.
There is SET substitutions for simplifying description of patterns and forms
in DE.
There are arrays arose on SP level, which are used in TE; in fact, they can
be used as SWITCH under some field value.
SP can output <form ...> structures, cut out forms based on ^ON , fill in
data from the table to form (for editing) with the help of ^ MYSQL , ^ WHERE
, ^ TABLE , ^ ID .
E.g., you want to create a script to manage news. Just copy
news output page into new file and add list form. Create a SET with MySQL query
somewhere before the output form. It is required to indicate
output key field via tag RADIO__ in it; put it into FORM__ tag and define SUBMIT__
button before END__FORM__
×òîáû ôîðìà ââîäà íå âûâîäèëàñü ïðîñòî ïðè ïðîñìîòðå è çàëèâàëàñü äàííûìè
âûáðàíîé çàïèñè íóæíî òîæå çàêëþ÷èòü åå òåãîì FORM __ äëÿ ïåðåäà÷è îáðàáîòêè
â SP .
In order to hide second form during first page load and to wait a value which
will be used in the second form, use "Template Engine" tag [FORM] .
| |
<? include(“./sp/sp_start.php”); ?>
[SET__News
^MYSQL : SELECT * FROM News
^WHERE :
^TABLE : News
^ID : ID
]
<html>
<body>
[FORM__NewsEdit]
[TEMPLATE__$News]
{RADIO__ID} --
{author} -- {date} -- {title} <br>
[END__TEMPLATE__ News]
[SUBMIT__Action=Edit]
[END__FORM__NewsEdit]
[FORM__News ^ON:ID ^NOCREATE=1^MYSQL=SELECT
* FROM News ^WHERE:ID=VAR(POST.ID)^TABLE=News ^ID=ID]
<form name='News' action='newsedit.php'
method='post'>
....
....
....
</form>
[END__FORM__News]
</body>
</html>
<? include(“./sp/sp_end.php”); ?> |
^ ON : ID – to output News form if there is ID variable in POST massive, i.e.,
in fact, when record is chosen in form-list and you pressed SUBMIT button.
^ NOCREATE =1 – Do not create < form …> construction. It already exists!
^ WHERE : ID = VAR ( POST.ID ) - to take record from
the list. As it was described above, if you hit "Edit" button, ID value will
be in the POSR array
^ TABLE = News – required to show pictures in the
form.
^ ID = ID – required to show pictures in the form.
That's all. Now we have news table editor.
|