HtmlHelper
- Type
- Class
- Namespace
- Craft
- Inherits
- Craft\HtmlHelper » CHtml (opens new window)
- Since
- 1.0
Class HtmlHelper
See also http://craftcms.com
View source (opens new window)
# Public Properties
# Public Methods
| Method | Description |
|---|---|
| activeCheckBox() (opens new window) | Generates a check box for a model attribute. |
| activeCheckBoxList() (opens new window) | Generates a check box list for a model attribute. |
| activeColorField() (opens new window) | Generates a color picker field input for a model attribute. |
| activeDateField() (opens new window) | Generates a date field input for a model attribute. |
| activeDateTimeField() (opens new window) | Generates a datetime field input for a model attribute. |
| activeDateTimeLocalField() (opens new window) | Generates a datetime-local field input for a model attribute. |
| activeDropDownList() (opens new window) | Generates a drop down list for a model attribute. |
| activeEmailField() (opens new window) | Generates an email field input for a model attribute. |
| activeFileField() (opens new window) | Generates a file input for a model attribute. |
| activeHiddenField() (opens new window) | Generates a hidden input for a model attribute. |
| activeId() (opens new window) | Generates input field ID for a model attribute. |
| activeLabel() (opens new window) | Generates a label tag for a model attribute. |
| activeLabelEx() (opens new window) | Generates a label tag for a model attribute. |
| activeListBox() (opens new window) | Generates a list box for a model attribute. |
| activeName() (opens new window) | Generates input field name for a model attribute. |
| activeNumberField() (opens new window) | Generates a number field input for a model attribute. |
| activePasswordField() (opens new window) | Generates a password field input for a model attribute. |
| activeRadioButton() (opens new window) | Generates a radio button for a model attribute. |
| activeRadioButtonList() (opens new window) | Generates a radio button list for a model attribute. |
| activeRangeField() (opens new window) | Generates a range field input for a model attribute. |
| activeSearchField() (opens new window) | Generates a search field input for a model attribute. |
| activeTelField() (opens new window) | Generates a telephone field input for a model attribute. |
| activeTextArea() (opens new window) | Generates a text area input for a model attribute. |
| activeTextField() (opens new window) | Generates a text field input for a model attribute. |
| activeTimeField() (opens new window) | Generates a time field input for a model attribute. |
| activeUrlField() (opens new window) | Generates a url field input for a model attribute. |
| activeWeekField() (opens new window) | Generates a week field input for a model attribute. |
| ajax() (opens new window) | Generates the JavaScript that initiates an AJAX request. |
| ajaxButton() (opens new window) | Generates a push button that can initiate AJAX requests. |
| ajaxLink() (opens new window) | Generates a link that can initiate AJAX requests. |
| ajaxSubmitButton() (opens new window) | Generates a push button that can submit the current form in POST method. |
| asset() (opens new window) | Generates the URL for the published assets. |
| beginForm() (opens new window) | Generates an opening form tag. |
| button() (opens new window) | Generates a button. |
| cdata() (opens new window) | Encloses the given string within a CDATA tag. |
| checkBox() (opens new window) | Generates a check box. |
| checkBoxList() (opens new window) | Generates a check box list. |
| closeTag() (opens new window) | Generates a close HTML element. |
| colorField() (opens new window) | Generates a color picker field input. |
| css() (opens new window) | Encloses the given CSS content with a CSS tag. |
| cssFile() (opens new window) | Links to the specified CSS file. |
| dateField() (opens new window) | Generates a date field input. |
| dateTimeField() (opens new window) | Generates a datetime field input. |
| dateTimeLocalField() (opens new window) | Generates a local datetime field input. |
| decode() (opens new window) | Decodes special HTML entities back to the corresponding characters. |
| dropDownList() (opens new window) | Generates a drop down list. |
| emailField() (opens new window) | Generates an email field input. |
| encode() (opens new window) | Encodes special characters into HTML entities. |
| encodeArray() (opens new window) | Encodes special characters in an array of strings into HTML entities. |
| encodeParams() | Will take an HTML string and an associative array of key=>value pairs, HTML encode the values and swap them back into the original string using the keys as tokens. |
| endForm() (opens new window) | Generates a closing form tag. |
| error() (opens new window) | Displays the first validation error for a model attribute. |
| errorSummary() (opens new window) | Displays a summary of validation errors for one or several models. |
| fileField() (opens new window) | Generates a file input. |
| form() (opens new window) | Generates an opening form tag. |
| getIdByName() (opens new window) | Generates a valid HTML ID based on name. |
| hiddenField() (opens new window) | Generates a hidden input. |
| htmlButton() (opens new window) | Generates a button using HTML button tag. |
| image() (opens new window) | Generates an image tag. |
| imageButton() (opens new window) | Generates an image submit button. |
| label() (opens new window) | Generates a label tag. |
| link() (opens new window) | Generates a hyperlink tag. |
| linkButton() (opens new window) | Generates a link submit button. |
| linkTag() (opens new window) | Generates a link tag that can be inserted in the head section of HTML page. |
| listBox() (opens new window) | Generates a list box. |
| listData() (opens new window) | Generates the data suitable for list-based HTML elements. |
| listOptions() (opens new window) | Generates the list options. |
| mailto() (opens new window) | Generates a mailto link. |
| metaTag() (opens new window) | Generates a meta tag that can be inserted in the head section of HTML page. |
| modelName() (opens new window) | Generates HTML name for given model. |
| normalizeUrl() (opens new window) | Normalizes the input parameter to be a valid URL. |
| numberField() (opens new window) | Generates a number field input. |
| openTag() (opens new window) | Generates an open HTML element. |
| pageStateField() (opens new window) | Generates a hidden field for storing persistent page states. |
| passwordField() (opens new window) | Generates a password field input. |
| radioButton() (opens new window) | Generates a radio button. |
| radioButtonList() (opens new window) | Generates a radio button list. |
| rangeField() (opens new window) | Generates a range field input. |
| refresh() (opens new window) | Registers a 'refresh' meta tag. |
| renderAttributes() (opens new window) | Renders the HTML tag attributes. |
| resetButton() (opens new window) | Generates a reset button. |
| resolveName() (opens new window) | Generates input name for a model attribute. |
| resolveNameID() (opens new window) | Generates input name and ID for a model attribute. |
| resolveValue() (opens new window) | Evaluates the attribute value of the model. |
| script() (opens new window) | Encloses the given JavaScript within a script tag. |
| scriptFile() (opens new window) | Includes a JavaScript file. |
| searchField() (opens new window) | Generates a search field input. |
| setModelNameConverter() (opens new window) | Set generator used in the {@link CHtml::modelName()} method. You can use the null value to restore default generator. |
| statefulForm() (opens new window) | Generates a stateful form tag. |
| submitButton() (opens new window) | Generates a submit button. |
| tag() (opens new window) | Generates an HTML element. |
| telField() (opens new window) | Generates a telephone field input. |
| textArea() (opens new window) | Generates a text area input. |
| textField() (opens new window) | Generates a text field input. |
| timeField() (opens new window) | Generates a time field input. |
| urlField() (opens new window) | Generates a URL field input. |
| value() (opens new window) | Evaluates the value of the specified attribute for the given model. |
| weekField() (opens new window) | Generates a week field input. |
# encodeParams()
Will take an HTML string and an associative array of key=>value pairs, HTML encode the values and swap them back into the original string using the keys as tokens.
View source (opens new window)
Arguments
$html(string (opens new window)) – The HTML string.$variables(array (opens new window)) – An associative array of key => value pairs to be applied to the HTML string usingstrtr.
Returns
string (opens new window) – The HTML string with the encoded variable values swapped in.
Signature
public static string encodeParams ( $html, $variables = [] )
# Protected Methods
| Method | Description |
|---|---|
| activeInputField() (opens new window) | Generates an input HTML tag for a model attribute. |
| addErrorCss() (opens new window) | Appends {@link errorCss} to the 'class' attribute. |
| clientChange() (opens new window) | Generates the JavaScript with the specified client changes. |
| inputField() (opens new window) | Generates an input HTML tag. |
# Constants
| Constant | Description |
|---|---|
ID_PREFIX |