XOOPS 2.5.6
Final
Main Page
Related Pages
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Pages
sampleform.inc.php
Go to the documentation of this file.
1
<?php
20
defined(
'XOOPS_ROOT_PATH'
) or die('Restricted access');
21
25
$sample_form
= new
XoopsThemeForm
('', 'sample_form', 'action.php');
26
$sample_form
->setExtra('enctype="multipart/
form
-data"');
27
// Not required but for user-friendly concern
28
$editor
= ! empty(
$_REQUEST
['editor']) ?
$_REQUEST
['editor'] : '';
29
if
(! empty(
$editor
)) {
30
setcookie(
'editor'
, $editor);
// save to cookie
31
}
else
{
32
// Or use user pre-selected editor through profile
33
if
(is_object(
$xoopsUser
)) {
34
$editor
= @
$xoopsUser
->getVar(
'editor'
);
// Need set through user profile
35
}
36
// Add the editor selection box
37
// If dohtml is disabled, set $noHtml = true
38
$sample_form
->addElement(
new
XoopsFormSelectEditor
(
$sample_form
,
'editor'
,
$editor
, $noHtml =
false
));
39
// options for the editor
40
// required configs
41
$options
[
'editor'
] =
$editor
;
42
$options
[
'name'
] =
'required_element'
;
43
$options
[
'value'
] = empty(
$_REQUEST
[
'message'
]) ?
""
:
$_REQUEST
[
'message'
];
44
// optional configs
45
$options
[
'rows'
] = 25;
// default value = 5
46
$options
[
'cols'
] = 60;
// default value = 50
47
$options
[
'width'
] =
'100%'
;
// default value = 100%
48
$options
[
'height'
] =
'400px'
;
// default value = 400px
49
50
51
// "textarea": if the selected editor with name of $editor can not be created, the editor "textarea" will be used
52
// if no $onFailure is set, then the first available editor will be used
53
// If dohtml is disabled, set $noHtml to true
54
$sample_form
->addElement(
new
XoopsFormEditor
(_MD_MESSAGEC,
$options
[
'name'
],
$options
, $nohtml =
false
, $onfailure =
'textarea'
),
true
);
55
$sample_form
->addElement(
new
XoopsFormText
(
'SOME REQUIRED ELEMENTS'
,
'required_element2'
, 50, 255, $required_element2),
true
);
56
$sample_form
->addElement(
new
XoopsFormButton
(
''
,
'save'
,
_SUBMIT
,
'submit'
));
57
$sample_form
->display();
58
}
59
60
?>
L:
0xoops
xoops-2.5.6
htdocs
class
xoopseditor
sampleform.inc.php
Generated on Fri May 10 2013 01:04:25 for XOOPS 2.5.6 by
1.8.3.1