Our development efforts begin with creating a File block. A File block is a PHP script that is stored in the blocks
folder. It must have a filename of the form block-NAME.php
, where NAME
will be used by PHP-Nuke as the title for the block. The filename should not contain any spaces.
The goal of a block is simple. It just has to create one variable, $content
, that holds the content of the block. After that, the PHP-Nuke core will bring the theme into play to take care of displaying the block.
The block we will create is a better version of the Dinosaur of the Day static HTML block we created in Chapter 4. The block will display the name of the Dinosaur of the Day, and a thumbnail image of the lucky lizard. However, on the next day, a different dinosaur will be chosen, and the block display will be updated.
This is how the block works:
We will create a database table to hold the date, the title of the dinosaur for that day, and a link to the thumbnail image of that dinosaur...