Welcome to Geeklog, Anonymous Saturday, July 27 2024 @ 06:14 am EDT

Geeklog Forums

Function plugin_centerblock_myplugin how to?


Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
Hello everybody,

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
I'm available to customise your themes or plugins for your Geeklog CMS
 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
 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
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
Ok I got it. Learning and share.

:shakehands: Thanks a lot.

::Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 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.
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
Yes Joe it is what I've done Smile

...and my Hello plugin (available in few days) will say hello to my visitors
on the top of the page or maybe after the feature story or... Big Grin

A very nice plugin :twocents:

::Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

All times are EDT. The time is now 06:14 am.

  • 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