<we:categorySelect>
Since version: 2.2.0.0 | Requires endtag: yes
Description
This tag is used to insert a drop-down (<select>) menu into a webEdition document. Use this to select a category. Placing the end tag directly behind the start tag will cause the drop-down menu to contain all categories currently defined in webEdition.
Attributes
name
Default value: - | since version: 2.2.0.0 | required: no
Set this attribute to the name of the variable in which to store the selected category value. For frontend input, the attribute has to be set, but must be empty! If the attribute is unset, <we:categorySelect> is used to select a category for creating resp. editing a webEdition-document / object.
Depending on whether the attribute has been set or not, the drop-down menu can be either used as an inputfield at the creation of webEdition-documents / objects, or as an optionfield for <we:listview>. If the attribute is set, it will be used as the "name"-value for the generated <select> tag. The drop-down menu can then be used to choose a category for <we:listview>.
type
Default value: - | since version: 2.2.0.0 | required: no
Set this attribute to "request" to select the entry of the drop-down menu which matches the request-variable (a category) given to the page. If the attribute is unset, a global variable is used for the comparison instead of the request-varible. A "request-variable" is either appended to the page´s URL (page.php?category=movie) or delivered to the following page by a form using "GET" or "POST". If, for example, the attribute "name" is set to "category"and <we:categorySelect> is inside a form (<we:form>), the "request-variable" with the name "category" will be created. If there is a <we:categorySelect name="category"> on the following page (could also be the same page), the correct category will be chosen automatically. The "request-variable" can be copied into a global varible by using <we:setVar>. This global variable can then be given to <we:listview> (<we:listview categories="\$category">). If "register_globals" has been set in the php.ini, nothing has to be set in "type" and the <we:setVar> step can be omitted as well. We suggest you always use type="request", as webEdition will work without "register_globals" in the future and thereby it could be possible that your template will not work anymore.
Allowed values:
- request
showpath
Default value: false | since version: 2.2.0.0 | required: no
Set this attribute to "true" to display the complete path to the category. Setting it to "false" or not setting it at all will only display the category name.
Allowed values:
- true
- false
rootdir
Default value: - | since version: 2.2.0.0 | required: no
Set this attribute to a pathname (at the categories) to be masked if showpath="true". This is necessary if, for example, you saved all categories to a directory "New categories". "New categories"/sports/football" would then always be displayed. If you set this attribute to"/New categories", only "/sports/football" will be displayed. See also we:category.
firstentry
Default value: - | since version: 2.2.0.0 | required: no
Set this attribute to the text to be diplayed as the first entry of the drop-down menu, e.g. "Please select…".
multiple
Default value: false | since version: 4.0 | required: no
If "true" is set as value of this attribute, several paths can be selected within this drop down menu. If false is set or you don't set the attribute, then only one path can be selected.
Allowed values:
- false
- true
indent
Default value: - | since version: 4.0 | required: no
With the use of this attribute you can specify how the indention of the individual categories look like. The value is repeated one time for each subdirectory.
cachelifetime
Default value: 0 | since version: 4.2.0.0 | required: no
With this attribute you define the validity of the Cache in seconds for this we:Tag. This attribute is used only if cache type defined in the template is we:Tag Cache or Cache is disabled.
Syntax
<we:categorySelect [name="attribute"] [type="request"] [showpath="true|false"] [rootdir="attribute"] [firstentry="attribute"] [multiple="false|true"] [indent="attribute"] [cachelifetime="attribute"]> ... </we:categorySelect>
Examples
Example 1
<we:form id="self"> Kategorie:<br> <we:categorySelect name="category" type="request" showpath="true" onchange="this.form.submit()"> </we:categorySelect> </we:form> <we:setVar from="request" to="global" namefrom="category" nameto="category"/> <we:listview categories="\$category"> <we:repeat> ... </we:repeat> </we:listview>
Example2
<we:form type="document" id="100"> Kategorie:<br> <we:categorySelect> <option value="">keine Kategorie</option> <option value="/Deutsch/Sport/Tennis">Tennis</option> <option value="/Deutsch/Sport/Football">Football</option> <option value="/Deutsch/Sport/Formula1">Formula1</option> </we:categorySelect> </we:form>