glFusion Wiki

Site Tools


glFusion Blocks

The block editor allows you to create blocks for your website. A block is a small section of content on a webpage typically either to the left or right of the main content area, that can contain HTML, PHP functions, RSS Feeds from other sites, or almost anything you can think of.

You would create a block for many reasons. Take for example the What's New block: A user can look at this block and immediately know any recent changes to the website. You could also have a Counter block, which keeps track of how many hits your website has received.

The block editor can be accessed by clicking the Blocks link at the top of the administrator's menu. Alternatively, you can access the block editor by clicking Blocks on the Command and Control page.

Block Editor

Site Administrators can define the location, the order, and the permissions of each block.

Generally, most sites have both right and left blocks, where the right blocks only display when the user is at the main site index page. You can create a true 2 column layout by moving all your blocks to one side, if there are no blocks to display on the left side of the content, then the content will stretch into that position.

Blocks can also contain autotags. To enable autotags in a block, you must check the Enable Autotags box in the Block Editor.

Users have the ability to turn off a block from displaying in their My Account settings. So there are no guarantees that a user may be viewing the information you place in your blocks.

Security Permissions

Each block contains the standard set of glFusion security permissions:

  • Owner Permissions
  • Group Permissions
  • Logged in User Permissions
  • Anonymous Permissions

This makes it possible to hide certain blocks from non-logged-in users, or to display a block to a specific set of users. When conflicting levels of permissions exist, the least permissive setting wins.


A feature that exists for plugins only is the ability to add a block to the center of a page. Typically this would be at the top of the main index page but can be optionally at the bottom or before or after a featured story. Centerblocks can also be configured to display on a specific topic's page.

An example would be the forum centerblock to show users a summary of the latest forum activity. Centerblocks are not controlled from within the Block Editor but from within their respective plugins.

Block Types

There are four different block types that have completely independent functionalities:

Default Blocks

These blocks are built-in and cannot be deleted. They can be deactivated and usually their name, helpfile, position, and permissions can be changed. Default blocks are:

  • What's New
  • Who's Online
  • Admins Only
  • My Account
  • Topics
  • Older Stories

PHP Block

This block calls a function that is provided by a plugin or PHP function added to lib-custom.php. The defined function usually returns content that will be displayed in the block. The block function can be anything from generating basic HTML content, displaying formatted data from a database or remote site, or an interactive form. There are really few limitations if any for a block as long as it fits within your layout.

The name of the PHP function is entered in the Block Function field. If you would like to have one of your blocks use PHP code, enter the name of the function above. Your function name must start with the prefix phpblock_ (i.e. phpblock_getweather). If it does not have this prefix, your function will NOT be called. This is a security feature to ensure that arbitrary PHP code is not called by your site. Be sure not to put empty parenthesis '()' after your function name. Finally, it is recommended that you put all your PHP Block code in private/system/lib-custom.php. That will allow the code to stay with you even when you upgrade to a newer version of glFusion.

A PHP block will only be displayed if the function actually returned any content to be displayed in the block. This can be used to create blocks that only show up under certain conditions. For example, starting in glFusion v1.3.0, there are example functions in private/system/lib-common.php.dist that show how to target a block to a specific set of URLs on your site.

Portal Block

The Portal Block is for displaying an RSS/RDF feed. The content can not be changed since it is completely determined by the content of the RSS/RDF file. For a new portal block, at least the complete URL of the RSS/RDF file has to be given.

Normal Block

The Normal block is usually simple (x)HTML-text, which can contain announcements, links and even advertising. It can be used as a navigation tool and link to static pages as well as external sites.

glFusion assumes that a normal block contains (x)HTML formatted content when the very first character of the block content is a < character (for an opening tag). If it is any other character, glFusion assumes the content to be plain text and will translate line breaks to (x)HTML <br /> tags.

Block Styles

glfusion/block_admin.txt · Last modified: 2017/03/10 10:11 (external edit)

Page Tools