add.php
Required. This file is the template displayed when “adding” this block through the content management system.
edit.php
Optional, although may ultimately be required. This file is displayed when the block is in edit mode.
Both add.php and edit.php are just simple forms that are wrapped in Concrete. Typically, these form elements have the same names as their database tables columns.
view.php
Prints out the current saved values for a block, along with any specific block presentation.
controller.php
Required. This file contains some vital parameters about this particular block (its name, a description, its interface dimensions, etc…), as well as any programmatical items necessary. The block's class is also responsible for saving the block, although many simpler blocks don't even need to specify how they are saved, as long as the post variables are mapped to the block's database table columns.
db.xml
Required for any block that needs to save its data in the database (which is 99% of them). This file contains statements necessary to create your block's database tables in the database, specified in the ADOXMLS format.
auto.js
Optional. If this file exists it is automatically included when the blocks is in add or edit mode.
icon.png
Optional. This graphic displayed in Concrete's interface whenever the block is listed.
tools/
Optional. Items in this directory can be used by the block for whatever purposes they see fit. The AutoNav block makes use of this type of functionality.
templates/
Optional. Contained within this directory are alternate views for instances of this block, which can be set as custom templates through the CMS. For example, the typical autonav block formats its entry as an unordered list, but the "Header Menu" template can be applied to the autonav block, which then restructures the menu with DIVs.
Getting started
Download this zip as a starting point: http://www.concrete5.org/files/7212/9710/3658/basic_test2011.zip
To install this block:
- Unzip the block.
- Drag it to your Concrete5 blocks/ folder, which will likely be empty.
- Login to your Concrete5 installation, and go to Block Types within the dashboard.
- You should see the new block listed as available for installation (above all the currently installed blocks.)
- Click install.
(Please note that these instructions refer to installing blocks, not packages. If a block is wrapped up in the package format, it should be copied into the /packages folder instead).
That should be all there is to it. The block will automatically have its database table created and its record added to Concrete, at which point you'll be able to add it throughout your site.