| Home | Podcasts | 

External blocks with dynamic templates in #Chisimba
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:

       

Loading...


All the other parameters of the dynamic blocks JSON are available to external blocks. For example,

       
The display method is not set.
{
            "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.

       
Loading...


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.



Tags for this post

         
Bookmark this post Trackback URL  No trackbacks were found for this post Comments 0 Attribution Share Alike

Comments for this post

No comments were found for this post

Trackbacks for this post

No trackbacks were found for this post

Add a comment

* Required
To prevent abuse, please enter the code as shown below. If you are unable to view the code, click on "Redraw" for a new one.
This is a captcha-picture. It is used to prevent mass-access by robots. (see: www.captcha.net)
* Required Redraw
Weblog of: Derek Keats
Login




Remember me

Forgot your password?
HELP

toggle Twitter
You cannot tweet unless you are logged in, and on your own page.
Follow me on Twitter Follow me on Twitter
Friend me on Facebook Add me on Facebook
Chisimba Facebook group Chisimba Facebook group





Afrigator