Skip to content

Commit 5946f37

Browse files
committed
document public methods for Template library
closes ExpressionEngine/ExpressionEngine#427
1 parent f9c18be commit 5946f37

File tree

1 file changed

+63
-1
lines changed

1 file changed

+63
-1
lines changed

docs/development/legacy/libraries/template.md

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ Array containing single variables within `TMPL::$tagdata`.
477477

478478
Array containing variable pairs within `TMPL::$tagdata`.
479479

480-
### `TMPL::fetch_param($which[, $default = FALSE])`
480+
### `fetch_param($which[, $default = FALSE])`
481481

482482
| Parameter | Type | Description |
483483
| --------- | -------- | ------------------------------------- |
@@ -517,3 +517,65 @@ Write message to template log in Output Profiler.
517517
| ----------- | --------- | --------------------------------------------------------------- |
518518
| \$str | `String` | Log message |
519519
| \$details | `String` | More detailed log message, initially hidden behind "read more" |
520+
521+
522+
### `parse_globals($str)`
523+
524+
| Parameter | Type | Description |
525+
| ----------- | --------- | --------------------------------------------------------------- |
526+
| \$str | `String` | Parsed tempate |
527+
528+
Parses global variables like the currently logged in member's information, system variables, paths, action IDs, CAPTCHAs. Typically stuff that should only be done after caching to prevent any manner of changes in the system or who is viewing the page to affect the display.
529+
530+
This function would also strip ExpessionEngine comments from the code. It is being run automatically on each front-end page request, however if you are using TMPL library for other types of requests, you might need to call it manually.
531+
532+
### `show_404()`
533+
534+
Show a 404 page whether one is set in the config or not
535+
536+
### `fetch_template($template_group, $template, $show_default = true, $site_id = '')`
537+
538+
| Parameter | Type | Description |
539+
| ---------------- | --------- | --------------------------------------------------------------- |
540+
| \$template_group | `String` | Template group name |
541+
| \$template | `String` | Tempate name |
542+
| \$show_default | `Bool` | If `true`, show template from default group in site |
543+
| \$site_id | `Int` | Site ID |
544+
545+
Fetch Template Data
546+
547+
Takes a Template Group, Template, and Site ID and will retrieve the Template and its metadata from the database (or file)
548+
549+
### `fetch_and_parse($template_group = '', $template = '', $is_embed = false, $site_id = '', $is_layout = false)`
550+
551+
| Parameter | Type | Description |
552+
| ---------------- | --------- | --------------------------------------------------------------- |
553+
| \$template_group | `String` | Template group name |
554+
| \$template | `String` | Tempate name |
555+
| \$is_embed | `Bool` | Whether processed template is an embedded template |
556+
| \$site_id | `Int` | Site ID |
557+
| \$is_layout | `Bool` | Whether processed template is a layout template |
558+
559+
Fetch and Process Template
560+
561+
Determines what template to process, fetches the template and its preferences, and then processes all of it
562+
563+
### `no_results()`
564+
565+
Return template chunk contained inside `{if no_results}...{/if}`
566+
567+
If a tag/class has no results to show, it can call this method. Any `no_results`` variable in the tag will be followed. May be 404 page, content, or even a redirect.
568+
569+
### `remove_ee_comments($str)`
570+
571+
| Parameter | Type | Description |
572+
| ----------- | --------- | --------------------------------------------------------------- |
573+
| \$str | `String` | Parsed tempate |
574+
575+
Remove all EE Code Comment Strings
576+
577+
EE Templates have a special EE Code Comments for site designer notes and are removed during Template processing.
578+
579+
### `sync_from_files()`
580+
581+
Synchronize templates between database and files

0 commit comments

Comments
 (0)