Skip to content

Latest commit

 

History

History
75 lines (48 loc) · 1.88 KB

File metadata and controls

75 lines (48 loc) · 1.88 KB

Public API

The methods that Bromine provides for the API to be used on the front-end of the site in public controllers.

Blocks

Return, modify and save blocks – bits of pages that can be edited by users. It might be part of the footer or a message on the contact page. Blocks are written in Markdown and rendered and cached on request.

get($block)

Returns a block as a string. The $block variable is the URI of the block.

<?php echo Bromine\Block::get('contact-thanks'); ?>

Title

Prepends the site’s name and anything added.

get()

Returns the the title as a string.

<head>
	<title><?php echo Bromine\Title::get(); ?></title>
</head>

append($string, $separator = ': ')

Appends the string to the end of the title, using : as a separator.

$title = $article->title;
Bromine\Title::append($title, ' &middot; ');

set($string, $title_overwrite = false)

Overwrites the existing title, but includes the site title unless $title_overwrite is set to true.

$title = $article->title;
Bromine\Title::set($title);
// Site Name: The leaves are falling

$title = 'Article: '.$article->title;
Bromine\Title::set($title, true);
// Article: The leaves are falling

Menu

Returns a View object of the model or an array of the menu. The menu is stored in a table.

view($parent = 0, $active = 0)

Returns a View object of the view, found in views/menu.php. Optionally ask for only the children of a parent. Second parameter is the ID of the active page, which will set the <li> to <li class="active"> for that entity.

$this-template->menu = Bromine\Menu::view();

// Or with an active page ‘active’
$this-template->menu = Bromine\Menu::view($page->parent, $page->id);

get($parent = 0)

Returns a multidimensional array of the menu. Optionally ask for only the children of a parent.

$this->template->menu = Bromine\Menu::get();