CodeArea
Syntax-highlighted code editor/viewer with copy-to-clipboard, multiple language support, and optional editing.
Read-Only (PHP)
Read-Only (JavaScript)
Read-Only (SQL)
Editable
PHP PHP Methods (Fluent)
| Method / Property | Parameters | Description |
|---|
$m->codeArea($id) | string | Create a CodeArea component. |
->language($lang) | string | Syntax language: js, css, sql, php. |
->name($name) | ?string | Form field name for the underlying textarea. |
->value($code) | string | Set the initial code content. |
->readOnly($ro) | bool | Read-only mode (default: true). |
->rows($rows) | int | Visible row count (default: 8, min: 2). |
->wrap($wrap) | bool | Enable long-line wrapping (default: true). |
JS JS Methods
| Method / Property | Parameters | Description |
|---|
m.codearea(id, opts) | string, ?object | Get or create CodeArea instance. |
value(v) | ?string | Get or set the code text. |
render() | | Re-run syntax highlighting. |
wrap(bool) | bool | Toggle text wrapping. |
JS Syntax Token CSS Classes
| Method / Property | Parameters | Description |
|---|
.m-codearea-token-keyword | | Language keywords (function, var, SELECT, etc.). |
.m-codearea-token-string | | String literals. |
.m-codearea-token-comment | | Comments. |
.m-codearea-token-number | | Numeric literals. |
.m-codearea-token-variable | | Variables (e.g. PHP $var). |
.m-codearea-token-constant | | Constants. |