Welcome to Geeklog, Anonymous Monday, November 10 2025 @ 05:27 pm EST
Geeklog Forums
Function plugin_centerblock_myplugin how to?
Status: offline
::Ben
Forum User
Full Member
Registered: 01/14/05
Posts: 1582
Hello everybody,
I'm trying to undestand and write a plugin_centerblock_hello function for a plugin call hello.
function plugin_centerblock_hello ($where = 1, $page = 1, $topic = '')
{
global $_CONF, $_USER;
$block = new Template ($_CONF['path'] . 'plugins/hello/templates/blocks');
$block->set_file (array ('block'=>'centerblock.thtml'));
$block->parse ('output', 'block');
$retval .= $block->finish ($block->get_var ('output'));
return $retval;
}
This function work and block replace the entire index page. Now what must I do if I want the block on top of the page, after the featured story or at the bottom (like the forum centerblock)?
In plugin_centerblock_forum there is no call to COM_sideHeader and COM_siteFooter... Can someone teach me this magic?
Thanks.
::Ben
I'm trying to undestand and write a plugin_centerblock_hello function for a plugin call hello.
Text Formatted Code
function plugin_centerblock_hello ($where = 1, $page = 1, $topic = '')
{
global $_CONF, $_USER;
$block = new Template ($_CONF['path'] . 'plugins/hello/templates/blocks');
$block->set_file (array ('block'=>'centerblock.thtml'));
$block->parse ('output', 'block');
$retval .= $block->finish ($block->get_var ('output'));
return $retval;
}
This function work and block replace the entire index page. Now what must I do if I want the block on top of the page, after the featured story or at the bottom (like the forum centerblock)?
In plugin_centerblock_forum there is no call to COM_sideHeader and COM_siteFooter... Can someone teach me this magic?
Thanks.
::Ben
10
13
Quote
Status: offline
Blaine
Forum User
Moderator
Registered: 07/16/02
Posts: 1232
Location:Canada
Your right, there is now call to siteheader or sitefooter as this function is just supposed to return formatted html for the centerblock. It's up to the calling script to place this resulting html on the page correctly.
The site's main index.php calls the PLG_showCenterblock() function 4 times - where each time, it passes in a different option to either: 0 - replace the complete page, 1 - top of page and above featured story, 2 - top of page and below centerblock, 3 - bottom of page.
A plugin may implement all or just 1 of these options or behave the same in all cases.
Geeklog components by PortalParts -- www.portalparts.com
The site's main index.php calls the PLG_showCenterblock() function 4 times - where each time, it passes in a different option to either: 0 - replace the complete page, 1 - top of page and above featured story, 2 - top of page and below centerblock, 3 - bottom of page.
A plugin may implement all or just 1 of these options or behave the same in all cases.
Geeklog components by PortalParts -- www.portalparts.com
10
14
Quote
Status: offline
beewee
Forum User
Full Member
Registered: 08/05/03
Posts: 969
Location:The Netherlands, where else?
Why not have a look at functions.inc.php from the static pages plugin? The function starts at row 789. Comment out row 796 if you want your block to show on more pages than only the first.
I'n no developer, so my knowledge doesn't go any further than this.
Dutch Geeklog sites about camping/hiking:
www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net
I'n no developer, so my knowledge doesn't go any further than this.
Dutch Geeklog sites about camping/hiking:
www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net
14
11
Quote
Status: offline
jmucchiello
Forum User
Full Member
Registered: 08/29/05
Posts: 985
You just need to surround what you have with this if you want it to be on top. Change the 1 to 2 to follow the featured article and change1 to 3 to go on the bottom.
if ($where == 1) {
}
Right now you are returning your data when $where is 0 and that replace the index page with your content.
if ($where == 1) {
}
Right now you are returning your data when $where is 0 and that replace the index page with your content.
9
11
Quote
All times are EST. The time is now 05:27 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content