FUEL CMS User Guide : Version 1.5.2


Blocks in FUEL CMS are repeatable areas of your site such as headers, footers, callouts and promotional areas.

Programmatically, you can use the fuel_block helper function to render the contents of the block or you can access the instantiated Fuel_blocks object like so:

// short way
echo fuel_block('my_block');

// long way 
echo $this->fuel->blocks->render('my_block');

Or you can use the array syntax if more options are required for rendering:

// short way
echo fuel_block(array('view' => 'my_block', 'only_views' => TRUE));

// long way 
echo $this->fuel->blocks->render(array('view' => 'my_block', 'only_views' => TRUE));

Static vs. CMS Blocks

Similar to pages, blocks can exist statically or be maintained in the CMS. Static blocks are located in the application/views/_blocks/ folder and operate like a normal view file. Static blocks can be uploaded into the CMS to be editable. The upload process will "try" and translate any PHP syntax into the templating syntax.

By default, if the fuel configuration's fuel_mode is set to AUTO, then it will first look in the database for a block with the specified name. If no block is found in the CMS, it will then look in the static applications/views/_blocks/ view folder unless the parameter "only_views" is set to TRUE, in which case it will only look in the _blocks folder.