Page 1 of 1

[RELEASE]National Flags mod block

Posted: 26. June 2013 00:11
by Theriddler
National Flags on board 3 portal 2.x

If you didn't have the mod allready installed then install the mod first!
https://www.phpbb.com/customise/db/mod/national_flags/

Then Create a new php file called: portal_flags.php

Put the following inside that file:

Code: Select all

<?php
/**
*
* @package Board3 Portal v2 - Team
* @copyright (c) Board3 Group ( www.board3.de ) , theriddler ( http://www.phpbbservice.nl )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
   exit;
}

/**
* @package Team
*/

class portal_flags_module
{
   /**
   * Allowed columns: Just sum up your options (Exp: left + right = 10)
   * top      1
   * left      2
   * center   4
   * right      8
   * bottom   16
   */
   public $columns = 21;

   /**
   * Default modulename
   */
   public $name = 'PORTAL_FLAGS';

   /**
   * Default module-image:
   * file must be in "{T_THEME_PATH}/images/portal/"
   */
   public $image_src = 'portal_custom.png';

   /**
   * module-language file
   * file must be in "language/{$user->lang}/mods/portal/"
   */
   public $language = 'portal_flags_module';
   
   /**
   * custom acp template
   * file must be in "adm/style/portal/"
   */
   public $custom_acp_tpl = '';    
   
   public function get_template_center($module_id)
   {
   global $config, $user, $phpEx, $phpbb_root_path;
//Begin: National_Flag
if (!empty($config['allow_flags']))
{
   if (!function_exists('top_flags'))
   {
      include($phpbb_root_path . 'includes/functions_flag.' . $phpEx);
   }
   top_flags();
}
//End: National_Flag
return 'flags_center.html';
}   
   public function get_template_acp($module_id)
   {
      return array(
         'title'   => 'PORTAL_FLAGS',
         'vars'   => array(),
      );
   }
   
   /**
   * API functions
   */   
    function install($module_id)
    {
        return true;
    }
       
    function uninstall($module_id)
    {
       return true;
    }
                     
}
Save this file to: root/portal/modules/

Create a new php file called: portal_flags_module.php

Put the following inside that file:

Code: Select all

<?php
/**
*
* @package Board3 Portal v2 - Team
* @copyright (c) Board3 Group ( www.board3.de ) , theriddler ( http://www.phpbbservice.nl )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* DO NOT CHANGE
*/
if (!defined('IN_PHPBB'))
{
   exit;
}

if (empty($lang) || !is_array($lang))
{
   $lang = array();
}

// DEVELOPERS PLEASE NOTE
//
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
//
// Placeholders can now contain order information, e.g. instead of
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
// translators to re-order the output of data while ensuring it remains correct
//
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
$lang = array_merge($lang, array(
   'PORTAL_FLAGS'  => 'National flags',
));
save this file to: root/language/en/mods/portal/

Create a new html file called: flags_center.html

put the following inside that file:

Code: Select all

{$LR_BLOCK_H_L}<!-- IF $S_BLOCK_ICON --><img src="{$IMAGE_SRC}" width="{$IMAGE_WIDTH}" height="{$IMAGE_HEIGHT}" alt="" />&nbsp;<!-- ENDIF -->{$TITLE}{$LR_BLOCK_H_R}
<span style="width:100%;"><!-- BEGIN fnum --><span style="width:10%;float:left;text-align:center;">{fnum.FLAG}<br />{fnum.L_FLAG_USERS}</span><!-- END fnum --></span><br style="clear:both" />
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R}
Save this file to: root/styles/your-style/template/portal/modules/

Refresh templates

Finish >> Add your new national flags block