How to create a block, theoretical approach

20.2.1. How to create a block, theoretical approach

You have to follow these rules when creating a block:

  • In every block you create you have to insert the following code at the beginning:

    if (eregi("block-Name_of_Block.php", $PHP_SELF)) {
    Header("Location: index.php");
    die();
    }
    

    By using this code you protect the file avoiding users approaching it directly from the blocks folder, and the block will be displayed only when selected from your site.

  • In the blocks you can include everything you want, Perl, java, php, flash etc...

  • All the block output must have a value that can be obtained from the variable $content.

Remember that you have a limited amount of space in the block, pay special attention to the layout!

Warning Warning
 

In order to have W3C standard compatible blocks, Francisco Burzi says:

"To respect the W3c standards for HTML 4.01 Transitional, it is very important that you replace all "instances of &" in the URL by the tag "& "

For example the URL:
<a href="modules.php?op=modload&name=FAQ&file=index">
must be written:
<a href="modules.php?op=modload&amp;name=FAQ&amp;file=index">
and don't use, for example, the tag "li" (used to create a list), but leave that in the style sheet (CSS) which will make it for you.

The background for the tables and font etc., are better left to the style sheet (CSS).

We will now see how to construct a block starting from the beginning.


Help us make a better PHP-Nuke HOWTO!

Want to contribute to this HOWTO? Have a suggestion or a solution to a problem that was not treated here? Post your comments on my PHP-Nuke Forum!

Chris Karakas, Maintainer PHP-Nuke HOWTO

 

Site Info v2.2.2

Last SeenLast Seen
Server TrafficServer Traffic
  • Total: 339,207,986
  • Today: 3,613
Server InfoServer Info
  • Oct 22, 2017
  • 01:19 am PDT
 
 

Daily Inspiration