ocPortal Tutorial: Advanced custom pages of information
Written by Chris Graham, ocProductsocPortal provides features to allow Comcode pages to be very feature rich. This tutorial explains two advanced aspects to this: blocks and 'inline attachments'. It will also explain how ocPortal allows your website content to be organised using different methodologies.
Table of contents
BlocksIf you have read the 'custom pages of information' tutorial, you will know that using Comcode pages, you can type in text that visually resembles the look of the page (unlike HTML, which can look very complicated). This is a very powerful tool, but it is ultimately limited by the fact that you are only producing a document, not an interactive, data-bound, part of a website: if this was all you could do (forgetting modules for a minute), then ocPortal would not be much more powerful than a word processor.
ocPortal has a concept called a 'block'. Blocks are essentially building blocks that can be inserted into a Comcode page in order to add the aforementioned interactive and data-bound functionality that is so important to a modern website. At the time of writing, ocPortal contains 67 blocks for you to use, and we are planning more of them for future versions.
How to use a block
Actual Comcode that references blocks
To use a block, all you actually need to do is to use the Comcode '[block]' tag, with the name of the block as the tag contents. Parameters passed to the block simply get placed as parameters for the block tag itself.
The available blocks are classified into three groups:
- Side blocks. These are intended to be shown on a panel page.
- Main blocks. These are intended to be shown on the body of the site (an actual page).
- Bottom blocks. These are intended for use in the footer of the site.
CheatingAs mentioned in the above section, you can add a block using the Comcode '[block]' tag. However, you don't need to type this code manually – instead just click the obvious 'Block' button and ocPortal will provide a popup wizard to help you.
The Wizard will generate the Comcode for you and place it approximately where your caret was. You can move it around by cut&pasting.
Available blocksUse the "block construction assistant" (linked to via the 'Add block' button on the Comcode page editing screen). This assistant will list all the blocks, provide a helpful interface to defining the block parameters, and allow you to preview the blocks.
Website content organisationWeb Content Management systems typically provide one of two systems for organising content:
- Organising content types separately via modules
- Organising content types together via a single tree structure (or often, just categories without an actual tree structure)
ocPortal organises content types via modules (with their own tree structures), but it also provides functionality so that your website can appear organised under a single tree structure.
Comcode pages may be organised to form a tree structure and then those Comcode pages may have blocks placed within them to display content.
Embedding entriesTo embed entries you may use the 'main_content' block. This is described in more detail in the 'Providing featured content' tutorial.
Embedding categoriesThe 'main_download_category', 'main_cc_embed', 'main_gallery_embed' and 'main_news' blocks allow you to combine categories with your own personal wrapping Comcode, which is a very useful tool if you wish to integrate them tightly into your site. We do not, however, provide this functionality for all kinds of module because it would become over-complex. We provide a special module->block feature to bridge this (further details in the 'Provided featured content' tutorial).
Where to export a Comcode page from
An exported Comcode page consists of text like this
The Comcode system also has support for 'inline attachments', which are constructed in a similar way to how attachments are stored in e-mail addresses (technically, it is called base64-encoding). This feature is very useful if you want to give a Comcode page, complete with attachments (images, or downloads, for instance), to another ocPortal user (for example, we are using it to distribute tutorials). When 'inline attachments' are found, ocPortal will extract them, much like the extracting of an archive, and rewrite the page so as to reference the extracted files as if the attachments were uploading locally.
To export a Comcode page with 'inline attachments', choose to edit the page, and click the 'Export page' link.