\page_renderer

Renders the HTML page that is sent to the client.

Summary

Methods
Properties
Constants
register_part_preprocessor()
render()
render_main()
render_minimal()
get_header_html()
get_css_as_html()
AddJSLink()
AddJSSnippet()
render_navigation_bar()
render_username()
generate_all_pages_datalist()
$html_template
$main_content_template
$minimal_content_template
$nav_divider
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$html_template

$html_template : string

The root HTML template that all pages are built from.

Type

string

$main_content_template

$main_content_template : string

The main content template that is used to render normal wiki pages.

Type

string

$minimal_content_template

$minimal_content_template : string

A specially minified content template that doesn't include the navbar and other elements not suiltable for printing.

Type

string

$nav_divider

$nav_divider : string

The navigation bar divider.

Type

string

Methods

register_part_preprocessor()

register_part_preprocessor(\function  $function) 

Registers a function as a part post processor.

This function's use is more complicated to explain. Pepperminty Wiki renders pages with a very simple templating system. For example, in the template a page's content is denoted by {content}. A function registered here will be passed all the components of a page just before they are dropped into the template. Note that the function you pass in here should take a reference to the components, as the return value of the function passed is discarded.

Parameters

\function $function

The part preprocessor to register.

render()

render(string  $title, string  $content, boolean  $body_template = false) : string

Renders a HTML page with the content specified.

Parameters

string $title

The title of the page.

string $content

The (HTML) content of the page.

boolean $body_template

The HTML content template to use.

Returns

string —

The rendered HTML, ready to send to the client :-)

render_main()

render_main(string  $title, string  $content) : string

Renders a normal HTML page.

Parameters

string $title

The title of the page.

string $content

The content of the page.

Returns

string —

The rendered page.

render_minimal()

render_minimal(string  $title, string  $content) : string

Renders a minimal HTML page. Useful for printable pages.

Parameters

string $title

The title of the page.

string $content

The content of the page.

Returns

string —

The rendered page.

get_header_html()

get_header_html() : string

Renders the header HTML.

Returns

string —

The rendered HTML that goes in the header.

get_css_as_html()

get_css_as_html() : string

Renders all the CSS as HTML.

Returns

string —

The css as HTML, ready to be included in the HTML header.

AddJSLink()

AddJSLink(string  $scriptUrl) 

Adds the specified url to a javascript file as a reference to the page.

Parameters

string $scriptUrl

The url of the javascript file to reference.

AddJSSnippet()

AddJSSnippet(string  $script) 

Adds a javascript snippet to the page.

Parameters

string $script

The snippet of javascript to add.

render_navigation_bar()

render_navigation_bar(array  $nav_links, array  $nav_links_extra, string  $class = "") 

Renders a navigation bar from an array of links. See $settings->nav_links for format information.

Parameters

array $nav_links

The links to add to the navigation bar.

array $nav_links_extra

The extra nav links to add to the "More..." menu.

string $class

The class(es) to assign to the rendered navigation bar.

render_username()

render_username(string  $name) : string

Renders a username for inclusion in a page.

Parameters

string $name

The username to render.

Returns

string —

The username rendered in HTML.

generate_all_pages_datalist()

generate_all_pages_datalist() : string

Renders the datalist for the search box as HTML.

Returns

string —

The search box datalist as HTML.