Concepts

Blocks

Blocks are the smallest presentational unit in concrete5. They are meant to be added to a page, and to consist primarily of visible content.

Each time a block is added to a page, a new Block object is created. This same block object may be aliased to different pages and versions of pages.

Block Types

Each block has a BlockType object associated with it, which tells the system what type of data it stores. Each block must be of a certain type (e.g. “slideshow,” “content,” “page list,” etc…)

Block Instance-Specific Data

A combination of these two types of data gives us the block’s instance-specific data. This is information about the particular instance of the block that is only relevant to the block’s type. For example, if you’re dealing with the Youtube video block, it’s instance-specific data is the address of the video you want to display, and its name. Basically, any information displayed a block’s add or edit interface is its instance-specific data.

Code Locations

All of the necessary block files are contained within one directory, located in one of several places

  • concrete/blocks/
  • packages/some_package/blocks/
  • blocks/

The name of the directory that stores the code files in these locations must match that of the block type handle.

Overrides

Any file in the first two locations above can be overridden by the same file in the third location. This lets sites override presentational and controller logic for custom applications and display, without forking core code bases or packages acquired from the marketplace.

Recent Discussions on this Topic

Building a block with library image input?

I'm trying to build a block that has the ability to pull an image from the library (or, since I'm desperate, from anywhere, even a remote URL), but I can't figure it out, and I'm new to PHP... Does anyone have any pointers? I tried reading http://phple…

blocks

how can i add multiple images in a block. ie: 3 images in a horizontal row

Hardcode a custom render view

The client wants a blog block in the footer of every page. I got it to work by hard coding it no problem, but then I needed to use a custom view to meet their design needs, so I created a view.php and view.css in /blocks/rss_displayer/templates/bullet_dat…

Theoretical Question About Page Attributes

I just had this sudden realization that I can do so much more with C5 out of the box than I thought I could. Kinda funny how those little things just kinda "click" huh? Anyways...let's say that my homepage has a JavaScript rotator that slides through h…

Block error message.

When I go to "ADD BLOCK" I get this message: Fatal error: Cannot redeclare class LibraryFileBlockController in /home/refocu5/public_html/concrete/blocks/library_file/controller.php on line 340