Home Private Messages Search
CPG Dragonfly™ CMS stopsoftwarepatents.eu petition banner
 
Wiki ⇒ Dragonfly public view ⇒ Blocks ⇒ Blocks HOW-TO

WikiDragonfly public viewBlocks ⇒ Blocks HOW-TO  

Glossary
The Project
Install
Upgrading or Switching
Dragonfly admininistration
Dragonfly public view
Blocks
Blocks HOW-TO
Modules
Dragonfly Themes
Build local server
Running Dragonfly CVS
Tips and Tricks
Rules & Regulations
v9 Developer's Manual
v10 Developer's manual
6.1.1: Blocks HOW-TO Parent
my english can be not so perfect :-)

Question: What is difference between block and module?

Answer: Block is what is present at the left/right side of DragonFly portal. You can see them on every page. For example: Who is Where, Login, CPG Main Menu, banner adds. Module is central part of DragonFly and placed in central part. One module always is more "central"  and is displayed on the first page. All other modules are accessible through links on left or right rows of blocks.

Both, modules and blocks, must be activated by admin in administrative area, to be visible on a site.

Question: How can I write my own block?

Answer: Look at the teps below to create block and make it active on your site.

1. Copy the example code below:

<?php
/**
* CPG Dragonfly CMS
* Copyright © 2004 - 2006 by CPG-Nuke Dev Team, dragonflycms.org
* Released under the GNU GPL version 2 or any later version
* $Id: block-Sample.php,v 1.4 2006/10/07 07:54:11 nanocaiordo Exp $
*/

// protect against direct access
if (!defined('CPG_NUKE')) { exit; }

// show the content of the block
$content 'Place the content that you wish to appear in your new block right here';
$content .= 'Note we use a dot before the = sign for each following line of code.';

2. Edit your block file.

All what you need is to get what you are going to display in block and put it into $content variable. Do not use echo command!!! Content can generated from database or static - it is all up to you!

Example of Adsense (for Google) block:

<?php
if (!defined('CPG_NUKE')) { exit; }
$content '
<script type="text/javascript">/*<![CDATA[*/
 google_ad_client = "string";
 google_ad_width = int;
 google_ad_height = int;
 google_ad_format = "string";
 google_ad_channel ="string";
 google_color_link = "string";
 google_color_url = "string";
 google_color_border = "string";
 google_color_text = "string";
 google_color_bg = "string";
 /*]]>*/</script>
 <script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
 </script>'
;
?>

3. Save your file as, for example, block-adsense.php and transfer it into blocks directory. Notice that all block files start form "block-"prefix. Do not forget to check ownership and permissions. They must be the same as for the rest of blocks.

4. Go to adminstration area and in "General" section click on "Blocks" icon. Select "adsense" in Filename, make it active, decide who is allowed to see it (all, members or admin only) and choose left or right side to display.

It will be added into table where you can fix a position by "Weight" arrows: move it to top or bottom of left (right) side of your page.

That's all major steps! Details you can always find yourself in another blocks or ask at the DragonFly's forum.

 
Updated: Wednesday, January 14, 2009 (01:32:49) by Phoenix
Created:  Tuesday, August 30, 2005 (12:45:01) by javafaq

You are seeing squares or questionmarks on this page?

All content of this website is copyrighted by the Creative Commons NC-SA
The logos and trademarks used on this site are the property of their respective owners
We are not responsible for comments posted by our users, as they are the property of the poster.
Our server runs on a P3 1.2GHz with 512MB RAM with no accelerators
Support GoPHP5.org
Interactive software released under GNU GPL, Code Credits, Privacy Policy