Skip to content

bono-cms/Block

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

201 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Block module

Your site may include global content blocks that you want to make easily editable—such as a contact phone number, email address, or physical location. This module is specifically designed to handle such cases. It works like this: you create a new block and then render it wherever needed in your theme template.

Availbale methods

A predefined global service called $block is available in all templates. It provides the following methods:

$block->render($id); // Returns the content of a block by its associated ID.
$block->renderAsArray($id); // Returns the block content as an array, where each line becomes a separate array element.

Example

Rendering a global email address that can be edited from the administration panel.

<footer>
  <div class="container">
      <p>Our email: <?= $block->render(1); ?></p>
  </div>
</footer>

About

This module let's you turn static HTML blocks into dynamic ones, so that you can edit them right from the administration panel.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors