[geeklog-modules] Center block API

geeklog-modules-admin at lists.geeklog.net geeklog-modules-admin at lists.geeklog.net
Mon May 12 06:44:26 EDT 2003


Blaine wrote:

>So in index.php, we will need to call the PLG_showCenterblock ($where = 0,
>$page = 1, $topic = '') several times and the plugin functions will need the
>logic to figure out when they should return the formated block HTML.

Yep. Geeklog could cache the information which plugin actually supports
the center block API so that we only need one MySQL request.


>Will there be anyway to prevent a plugin centerblock from firing more then
>once or will there be a default position?

That would be in the plugin's responsibility. With all those parameters
that it is given, it should be easy to figure out.

Actually, I was thinking some more about this and I'd like to take it one
step further: What we have with the "static pages on frontpage" hack is,
effectively, a center block (specifically hacked into Geeklog for that
one plugin). So it would make sense to replace that hack with a proper
center block call for the static pages plugin.

However, static pages has one additional feature: "nonews", i.e. the
ability to replace the frontpage entirely. I would image that this could
be used e.g. for the forum center block as well - you could have a
Geeklog site that only displays the forum topics on the frontpage.

So my revised suggestion for the API and its parameters would be:

    function PLG_showCenterblock ($where = 1, $page = 1, $topic = '')

Where $where would now mean 0 = nonews, i.e. center block takes over the
entire page, 1 = top of page, 2 = after the featured story, 3 = bottom of
page.

So for $where = 0, the plugin would either return an empty string (if it
doesn't intend to take over the page) or it would have to return the
_complete_ HTML to be displayed, i.e. including site header and footer
(the static pages plugin has an option to create a page without the
header and footer). Of course, only one plugin could take over the page,
so Geeklog would stop calling the other plugins as soon as one returns a
non-empty string for PLG_showCenterblock(0).

For $where = 1, 2, 3 the plugin would simply return the HTML for the
block and Geeklog would place it above, between, or below the stories,
respectively.

How does that sound? One MySQL request (if cached), and up to four
PLG_showCenterblock() calls (only to those plugins that actually
implement the API) shouldn't have too much of an impact on the
performance, but would offer a lot of flexibility.

bye, Dirk


-- 
http://www.haun-online.de/
http://www.tinyweb.de/




More information about the geeklog-modules mailing list