External blocks with dynamic templates in #Chisimba
Tweet
66 days ago
Chisimba can display blocks on another Chisimba server, using the dynamic blocks module with the blocks specified in ajax format in a content or personal template. To display blocks in response to an external request, the host server must have the externalblocks module installed (in modules, not in core). In addition, the ALLOW_EXTERNAL_BLOCKS property of the Blocks module must be set to 1 on the host server. If this is not set to 1, then the host will not supply external blocks even with the externalblocks module installed.
To be valid for display externally, blocks must have a property expose set to true. This is done by the developer at thet ime of development of the block, and would normally be done in the init() method of the block as follows:
public function init()
{
$this->title = "Demonstration block";
$this->expose = TRUE;
}
External blocks are rendered by the dynamiccanvas module, so only module that use the dynamiccanvas for displaying content can display dynamic blocks, although a filter is in development to provide external blocks within content. The minimal JSON content to display an external block is as follows:
All the other parameters of the dynamic blocks JSON are available to external blocks. For example,
{
"display" : "externalblock",
"server" : "http://localhost/ch/",
"module" : "dynamiccanvas",
"block" : "thirdtest",
}
will display the thirdtest block from the dynamiccanvas module on http://localhost/ch. The following will display the same block without a title.
The only difference between the JSON to display regular blocks and that to display external blocks is in the two lines
"display" : "externalblock",
"server" : "http://localhost/ch/",
instead of just
"display" : "block",
for an internal block.
chisimba blocks externalblocks
| Trackback URL No trackbacks were found for this post | Comments 0 |
