Page 1 of 1

Custom Block Activation in ACP

Posted: 11. November 2008 01:03
by the.ronin
Would this be an undertaking to create an option in the ACP to turn on and off a custom block? Would it require database entries?

Re: Custom Block Activation in ACP

Posted: 11. November 2008 15:48
by Kevin
Yes and yes.

Re: Custom Block Activation in ACP

Posted: 11. November 2008 17:25
by the.ronin
Hahaha thanks, Kevin ... html it is then! :lol:

Re: Custom Block Activation in ACP

Posted: 11. November 2008 17:58
by Kevin
Hehe. :mrgreen:
Create an DB entry in the portal table, named something like "portal_my_block", create a new language variable named something like "PORTAL_MY_BLOCK" in the \language\en\mods\lang_portal_acp.php and add to the acp_portal.php something like:

Code: Select all

'portal_my_block'                => array('lang' => 'PORTAL_MY_BLOCK'    , 'validate' => 'bool'    , 'type' => 'radio:yes_no'    , 'explain' => true), 
In portal.php

Code: Select all

    if ($portal_config['portal_my_block'])
    {
        include($phpbb_root_path . 'portal/block/my_block.'.$phpEx);
    } 
In my_block.php:

Code: Select all

      $template->assign_vars(array(
        'S_MY_BLOCK' => true,
       )); 
In portal_body.html:

Code: Select all

        <!-- IF S_MY_BLOCK -->
            <!-- INCLUDE portal/block/my_block.html -->
        <!-- ENDIF --> 
All names and variables are just examples.
As a quick version what your route should be. ;)