Wiki ⇒ v9 Developer's Manual ⇒ Certified Secure ⇒ Blocks ⇒ CPG Dragonfly™ CMS

13.3. 1: Blocks Parent


The "documentation/samples/blocks/block-Sample.php" contains the base information necessary for every block to be used in CPG Dragonfly.
If you create your own block, you need to follow this naming convention: "block-MY_NAME.php"

We will explain what each part in there means.

if (!defined('CPG_NUKE')) { exit; }
This line is used to prevent direct access to the block (e.g http://somewhere/blocks/block-Sample.php) and actualy destroys the request immediately.

$content = 'Place the content that you wish to appear in your new block right here';
Dragonfly reads your block and displays whatever is contained in the variable $content.

If your block encounters a problem, use the following so that the system knows there's a problem with your block.
$content = 'ERROR';
Additionaly, you could use trigger_error() to show a E_USER_WARNING or E_USER_NOTICE message to administrators.

You may also wish to manipulate $title or $block['title'] which contains the title of the block a.k.a. 'block header'
This is convenient if your block is multilingual and you don't want admins to configure their own title.

If you want to use available global settings then use:
global $MAIN_CFG;

Created: Thursday, April 07, 2005 (18:40:13) by DJMaze
Updated: Wednesday, April 18, 2012 (06:22:22) by NanoCaiordo