Tiger_Cms_Renderer

@api

Tiger_Cms_Renderer — turn CMS page/layout/partial content into HTML.

Renders a body by its format: html -> output as-is, then the [shortcode] processor markdown -> Parsedown -> HTML, then the [shortcode] processor phtml -> Zend_View string render (TigerZF's renderString) with a view CONTEXT — TRUSTED code; view vars + all helpers available, so a page can loop e.g. a $posts array.

A page is then wrapped in its layout (layout_key -> a type=layout row) with the rendered body handed to the layout as $this->content.

Shortcodes ([name attr="x"]inner[/name] or self-closing [name attr="x"]) are the SAFE dynamic mechanism for html/markdown authors: register a handler and it is substituted at render time. phtml doesn't need them — it already has full code.

Methods

registerShortcode()

registerShortcode($name, callable $handler)

Register (or replace) a [shortcode] handler.

  • $name string — the shortcode name (case-insensitive)
  • $handler callable — handler(array $attrs, ?string $inner, array $context): string

render()

render($page, array $context = [])

Render a page row to HTML: its body by format, then wrapped in its layout (when layout_key is set). $context view vars are available to phtml bodies.

  • $page object — a page row (->body, ->format, ->layout_key, ->locale, ->org_id)
  • $context array — extra view vars for phtml

Returns string

renderBody()

renderBody($body, $format, array $context = [])

Render a raw body string by format.

  • $body string
  • $format string — html | markdown | phtml
  • $context array — view vars (phtml)

Returns string