PhpBB Knowledge Base Mod on board3 Portal

Forum rules
This forum is not for support requests.

Only post Modifications for Board3 Portal 1.0.x in this forum.
Locked

Topic author
t90
Active Member
Posts: 9
Joined: 22. July 2010 23:32

PhpBB Knowledge Base Mod on board3 Portal

Post by t90 »

PhpBB Knowledge Base Mod block on board3 Portal

Hi there,

I have written a simple block, that accuires article titles from PhpBB Knowledge Base Mod.

Board3 Portal v. 1.0.5
PhpBB Knowledge Base Mod v. 1.0.2RC3

Demo: http://busomania.pl/ (find block titled "Baza wiedzy") on left side column.

Files to be copied:
./root/portal/block/articles.php
./root/styles/prosilver/template/portal/block/articles.html

Files to be edited:
./root/portal.php
./root/styles/prosilver/template/portal/portal_left.html

EDITS:

Open: ./root/portal.php
Find:

Code: Select all

if($portal_config['portal_left_column'])
{
    $template->assign_var('S_LEFT_COLUMN', true); 
Add on a new blank line after preceding lines to find:

Code: Select all

    
    include($phpbb_root_path . 'portal/block/articles.' . $phpEx);
     
Open: ./root/styles/prosilver/template/portal/portal_left.html
Find:

Code: Select all

<!-- IF S_DISPLAY_MAINMENU -->
    <!-- INCLUDE portal/block/main_menu.html -->
<!-- ENDIF -->
 
Add on a new blank line after preceding lines to find:

Code: Select all

<!-- IF CAT_LIST -->
    <!-- INCLUDE portal/block/articles.html -->
<!-- ENDIF -->
 
DIY instructions:
Copy files from attachment, logon to ACP, purge cache. It's done.

Ok, since I can not add any attachments, here is a code for articles.php and articles.html.

Create file "articles.php" on location ./root/portal/block/ of your phpBB3 instalation:

Code: Select all

<?php

/**
*
* @package - Board3portal
* @version $Id: articles.php 001 2010-07-23 10:50:43Z t90 $
* @copyright (c) t90 (busomania.pl)
* @based on: phpBB3 Portal by Sevdin Filiz, www.phpbb3portal.com
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/

if (!defined('IN_PHPBB') || !defined('IN_PORTAL'))
{
   exit;
}

    $sql = "SELECT * FROM `phpbb_articles` ORDER BY `phpbb_articles`.`article_id` ASC";
    $result = mysql_query($sql);
    $i = 0;
        while($row = mysql_fetch_assoc($result))
            {
            $i++;
            $template->assign_block_vars('articles', array(
            'U_TITLE'    => append_sid("{$phpbb_root_path}kb.$phpEx", 'a=' .$row['article_id']),
            'TITLE' => $row['article_title'],
            ));
            }
    $cat_list = ($i > 0) ? true : false; //check if there is anything to show

// Assign index specific vars
$template->assign_vars(array(
    'CAT_LIST'                => $cat_list,
));

?>
Create file "articles.html" on location ./root/styles/prosilver/template/portal/block/ of your phpBB3 instalation:

Code: Select all

{$LR_BLOCK_H_L}<img src="{T_THEME_PATH}/images/icon_kb.gif" width="27" height="22" alt="{L_KB_EXPLAIN}">{L_KB}{$LR_BLOCK_H_R}

    <div class="portal-navigation">
        <div class="menutitle">{ILE}</div>
            <ul>
                <!-- BEGIN articles -->
                <li><a href="{articles.U_TITLE}" title="{articles.TITLE}" title="{articles.TITLE}" alt="{articles.TITLE}">{articles.TITLE}</a></li>
                <!-- END articles -->
            </ul>
    </div>
    {$LR_BLOCK_F_L}{$LR_BLOCK_F_R}
 
Now it's done :-)

Je?d??: T3 '86 1.6D (CS) -> 1.7D (KY) -> 1.9TD (AAZ) + 3H
Trzeba my?le? praktycznie, dopóki nie przyjdzie czas, ?e mo?na ju? zacz?? my?le? niepraktycznie.
busomania.pl

amka
Active Member
Posts: 1
Joined: 7. March 2010 10:14

Re: PhpBB Knowledge Base Mod on board3 Portal

Post by amka »

hello!
Tell me how to do that in the block displays the category of "PhpBB Knowledge Base Mod"

P.S. Sorry for my bad English!

Topic author
t90
Active Member
Posts: 9
Joined: 22. July 2010 23:32

Re: PhpBB Knowledge Base Mod on board3 Portal

Post by t90 »

amka wrote:hello!
Tell me how to do that in the block displays the category of "PhpBB Knowledge Base Mod"

P.S. Sorry for my bad English!
It's all there. You need to edit portal.php and left_side_column.html. I have described all steps on first post. After you complete file modifications, you will have to clear cache.

Block is not perfect, but it works. Updated code for articles.php would be:

Code: Select all

<?php

/**
*
* @package - Board3portal
* @version $Id: articles.php 001 2010-07-23 10:50:43Z t90 $
* @copyright (c) t90 (busomania.pl)
* @based on: phpBB3 Portal by Sevdin Filiz, www.phpbb3portal.com
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/

if (!defined('IN_PHPBB') || !defined('IN_PORTAL'))
{
   exit;
}

    $sql = "SELECT * FROM `phpbb_articles` WHERE `article_status` = 1 ORDER BY `phpbb_articles`.`article_id` ASC";
    $result = mysql_query($sql);
    $i = 0;
        while($row = mysql_fetch_assoc($result))
            {
            $i++;
            $template->assign_block_vars('articles', array(
            'U_TITLE'    => append_sid("{$phpbb_root_path}kb.$phpEx", 'a=' .$row['article_id']),
            'TITLE' => $row['article_title'],
            ));
            }
    $cat_list = ($i > 0) ? true : false; //check if there is anything to show

// Assign index specific vars
$template->assign_vars(array(
    'CAT_LIST'                => $cat_list,
));

?>
This way only approved articles will be shown.

Je?d??: T3 '86 1.6D (CS) -> 1.7D (KY) -> 1.9TD (AAZ) + 3H
Trzeba my?le? praktycznie, dopóki nie przyjdzie czas, ?e mo?na ju? zacz?? my?le? niepraktycznie.
busomania.pl

vonhazey
Active Member
Posts: 9
Joined: 22. January 2010 15:19
phpBB.com User: vonhazey
Location: Deepcar
Contact:

Re: PhpBB Knowledge Base Mod on board3 Portal

Post by vonhazey »

nice how do i limit how many it shows as i have a mega long list and only want 5
Image Image

Topic author
t90
Active Member
Posts: 9
Joined: 22. July 2010 23:32

Re: PhpBB Knowledge Base Mod on board3 Portal

Post by t90 »

vonhazey wrote:nice how do i limit how many it shows as i have a mega long list and only want 5
This one will give 5 random articles ...

Code: Select all

<?php

/**
*
* @package - Board3portal
* @version $Id: articles.php 001 2010-07-23 10:50:43Z t90 $
* @copyright (c) t90 (busomania.pl)
* @based on: phpBB3 Portal by Sevdin Filiz, www.phpbb3portal.com
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/

if (!defined('IN_PHPBB') || !defined('IN_PORTAL'))
{
   exit;
}

//check if there is anything to show
    $sql = "SELECT * FROM `phpbb_articles` ORDER BY RAND() LIMIT 5";
    $result = mysql_query($sql);
    $i = 0;
        while($row = mysql_fetch_assoc($result))
            {
            $i++;
            $template->assign_block_vars('articles', array(
            'U_TITLE'    => append_sid("{$phpbb_root_path}kb.$phpEx", 'a=' .$row['article_id']),
            'TITLE' => $row['article_title'],
            ));
            }
    $cat_list = ($i > 0) ? true : false;

// Assign index specific vars
$template->assign_vars(array(
    'CAT_LIST'                => $cat_list,
));

?>
If you wish to have more (or less) results just find:

Code: Select all

//check if there is anything to show
    $sql = "SELECT * FROM `phpbb_articles` ORDER BY RAND() LIMIT 5";
 
and change "LIMIT 5" to "LIMIT X" where "X" is your desired number of articles to be shown within a block.

Je?d??: T3 '86 1.6D (CS) -> 1.7D (KY) -> 1.9TD (AAZ) + 3H
Trzeba my?le? praktycznie, dopóki nie przyjdzie czas, ?e mo?na ju? zacz?? my?le? niepraktycznie.
busomania.pl

obiewan
Active Member
Posts: 5
Joined: 19. November 2009 12:06
phpBB.com User: obiewan

Re: PhpBB Knowledge Base Mod on board3 Portal

Post by obiewan »

Correct me if i'm wrong; you can only display the articles when you display the forumlist in the portal?


I just tried the block.. and nothing is shown, because i do not want the forumlist to be seen in the portal.

Topic author
t90
Active Member
Posts: 9
Joined: 22. July 2010 23:32

Re: PhpBB Knowledge Base Mod on board3 Portal

Post by t90 »

Well, it has nothing to forum lists. Anyway, I have checked, and knowledge base mod block is shown both, forum lists enabled or disabled.

Je?d??: T3 '86 1.6D (CS) -> 1.7D (KY) -> 1.9TD (AAZ) + 3H
Trzeba my?le? praktycznie, dopóki nie przyjdzie czas, ?e mo?na ju? zacz?? my?le? niepraktycznie.
busomania.pl

obiewan
Active Member
Posts: 5
Joined: 19. November 2009 12:06
phpBB.com User: obiewan

Re: PhpBB Knowledge Base Mod on board3 Portal

Post by obiewan »

Ok, thanks :D
Locked

Return to “board3 Portal v1.0.x - Modifications”