Page 1 of 2

Mini Knowledge Base block for Mini Knowledge Base v 0.2.8

Posted: 24. May 2008 20:49
by frold
MINI KNOWLEDGE BASE BLOCK FOR MINI KNOWLEDGE BASE V. 0.2.7 (MAYBE EARLIER VERSIONS TOO)
Credit:
DaMysterious from http://damysterious.xs4all.nl/portal_premod/

Minor changes by frold

Demo: http://www.studmed.dk - See the block "Nyeste artikler"

Download Mini Knowledge Base here: http://www.phpbb.com/community/viewtopi ... 0&t=589907

CREATE
styles/prosilver/template/portal/block/knowledge.html

REPLACE ALL WITH

Code: Select all

<div class="panel">
   <div class="inner">
      <span class="corners-top"><span></span></span>
         <h3>{L_KNOWLEDGE_BASE}</h3>
<table class="tablebg" cellspacing="1" width="100%">
<!--<tr>
	<th style="text-align:left;" colspan="1">{L_KB_RECENT_ARTICLES}</td>
</tr>--> 
  <!-- BEGIN kb_recent_artikel -->
  <tr>
    <td class="<!-- IF kb_recent_artikel.S_ROW_COUNT is even -->row1<!-- ELSE -->row2<!-- ENDIF -->" valign="top">
      <h3>{kb_recent_artikel.TOPIC_LATEST_IMG} <a href="{kb_recent_artikel.U_ARTIKEL}">{kb_recent_artikel.TITLE}</a></h3>
      <div class="rightside" style="float: right;"><a href="#" onclick="Effect.toggle('{kb_recent_artikel.TITLE}','appear'); return false;"> {kb_recent_artikel.ARROW_DOWN_IMG}</a> </div>
    </td>
  </tr>
  <tr class="<!-- IF kb_recent_artikel.S_ROW_COUNT is not even -->row1<!-- ELSE -->row2<!-- ENDIF -->" id="{kb_recent_artikel.TITLE}" style="margin: 10px 5px 10px 5px; display: none;">
    <td valign="top">
        <div style="margin:15px;">{kb_recent_artikel.ARTIKEL}</div>
    </td>
  </tr>
  <tr class="<!-- IF kb_recent_artikel.S_ROW_COUNT is even -->row1<!-- ELSE -->row2<!-- ENDIF -->">
    <td valign="top">
      <div class="leftside" style="float: left;"> <span class="gensmall">{kb_recent_artikel.TIME} {L_POST_BY_AUTHOR}: <a href="{kb_recent_artikel.U_USERNAME}">{kb_recent_artikel.POST_AUTHOR_FULL}</a></span> </div>
      <div class="rightside" style="float: right;"> <span class="gensmall">{L_VIEWS}: {kb_recent_artikel.HITS}</span> </div>
    </td>
  </tr>
  <!-- END kb_recent_artikel -->
  </tr>
</table>
      <span class="corners-bottom"><span></span></span>
   </div>
</div>
<br style="clear:both" />
OPEN
portal.php

Code: Select all

    if ($portal_config['portal_change_style'])
    {
       include($phpbb_root_path . 'portal/block/change_style.'.$phpEx);
    }
AFTER ADD

Code: Select all

include($phpbb_root_path . 'portal/block/knowledge.'.$phpEx);

OPEN
styles/prosilver/template/portal/portal_body.html

FIND (or where you want to have you knowledge block)

Code: Select all

      <!-- IF S_DISPLAY_MINICAL -->
         <!-- INCLUDE portal/block/mini_calendar.html -->
      <!-- ENDIF -->
AFTER ADD

Code: Select all

			<!-- INCLUDE portal/block/knowledge.html -->
CREATE
portal/block/knowledge.php

REPLACE ALL WITH

Code: Select all

<?php
/** 
*
* @name kb_recent_articles.php
* @package phpBB3 Portal XL 4.0
* @version $Id: kb_recent_articles.php,v 1.8 2008/03/15 10:12:08 damysterious Exp $
*
* @copyright (c) 2007 Portal XL 4.0 Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/

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

/**
*/
$allow_max_articles = 5;  // Here you can set how many articles you want to list
$allow_kb_recent_limit = 250; // Here you can set the chars limit size of the article text

$user->setup('mods/kb');

// Artikel
$sql = "SELECT a.*, u.username, u.user_colour, u.user_id
	FROM " .KB_ARTICLE_TABLE . " a,	" . USERS_TABLE . " u
	WHERE a.activ  = '1' 
	AND a.user_id = u.user_id
	ORDER BY post_time DESC";
$result = $db->sql_query_limit($sql, $allow_max_articles);
while ($row = $db->sql_fetchrow($result))
{

	$row['bbcode_options'] = (($row['enable_bbcode']) ? OPTION_FLAG_BBCODE : 0);
	$message = generate_text_for_display($row['article'], $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options']);
	$message = smiley_text($message); // Always process smilies after parsing bbcodes

	$row['username'] = '<b style="color:#' . $row['user_colour'] . '">' . $row['username'] . '</b> ' ;

	$template->assign_block_vars('kb_recent_artikel', array(
		'ARTIKEL'			=> substr(str_replace('\n', '<br />', $message), 0, $allow_kb_recent_limit) . '...',
		'TITLE'				=> $row['titel'],
		'TIME'				=> $user->format_date($row['post_time']),
		'HITS'				=> $row['hits'],
		'U_ARTIKEL'			=> append_sid("{$phpbb_root_path}knowledge/kb_show." . $phpEx . '?id=' . $row['article_id']),
		'POST_AUTHOR_FULL'	=> get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
      	'U_USERNAME'   		=> append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']),
		'LAST_POST_IMG'		=> $user->img('icon_topic_latest', 'VIEW_LATEST_POST'),
		'NEWEST_POST_IMG'	=> $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),
		'TOPIC_LATEST_IMG'	=> '<img src="' . $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/imageset/icon_topic_latest.gif" />',
		'ARROW_DOWN_IMG'	=> '<img src="' . $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/theme/images/arrow_down.gif" />',
	));
}
$db->sql_freeresult($result);

?>
1. if you want to change the number of newest articles then edit:

Code: Select all

$allow_max_articles = 5;  // Here you can set how many articles you want to list


2. if you want to change the number of chars that is show of the article text edit:

Code: Select all

$allow_kb_recent_limit = 250; // Here you can set the chars limit size of the article text
3. if you have installed knowledge base in another folder then the standart one then you need to edit:

Code: Select all

		'U_ARTIKEL'			=> append_sid("{$phpbb_root_path}knowledge/kb_show." . $phpEx . '?id=' . $row['article_id']),

Re: Mini Knowledge Base block for Mini Knowledge Base v 0.2.7

Posted: 24. May 2008 21:44
by frold
If you wanna have a more simpel block

Open knowledge.html
REPLACE ALL WITH

Code: Select all

<div class="panel">
   <div class="inner">
      <span class="corners-top"><span></span></span>
         <h3>{L_KNOWLEDGE_BASE}</h3>
<table class="tablebg" cellspacing="1" width="100%">
<!--<tr>
	<th style="text-align:left;" colspan="1">{L_KB_RECENT_ARTICLES}</td>
</tr>--> 
  <!-- BEGIN kb_recent_artikel -->
  <tr>
    <td class="<!-- IF kb_recent_artikel.S_ROW_COUNT is even -->row1<!-- ELSE -->row2<!-- ENDIF -->" valign="top">
      <strong style="font-size:1.1em;">{kb_recent_artikel.TOPIC_LATEST_IMG} <a href="{kb_recent_artikel.U_ARTIKEL}">{kb_recent_artikel.TITLE}</a></strong>
	  <hr style="margin: 0px 0px 3px 0px;" />
    </td>
  </tr>
  <!-- END kb_recent_artikel -->
  </tr>
  <tr class="<!-- IF kb_recent_artikel.S_ROW_COUNT is not even -->row1<!-- ELSE -->row2<!-- ENDIF -->">
    <td valign="top"></td>
  </tr>
</table>
      <span class="corners-bottom"><span></span></span>
   </div>
</div>
<br style="clear:both" />

Re: Mini Knowledge Base block for Mini Knowledge Base v 0.2.7

Posted: 11. July 2008 00:04
by Kharon
thank you frold

it is working Mini Knowledge Base v 0.2.8 :)

Re: Mini Knowledge Base block for Mini Knowledge Base v 0.2.7

Posted: 14. July 2008 08:29
by frold
Kharon wrote:thank you frold

it is working Mini Knowledge Base v 0.2.8 :)

Thank you subject updated :D

Re: Mini Knowledge Base block for Mini Knowledge Base v 0.2.8

Posted: 22. October 2008 23:29
by RoxRio
Hello,

I know this is a old topic, but it's very important to me. I tried to add a Mini KB block in my portal, but I don't know why don't work. Don't appear anything in the block, no article.

I'm using Mini KB v. 0.2.9.

Thanks for your time. And sorry my English.

Re: Mini Knowledge Base block for Mini Knowledge Base v 0.2.8

Posted: 23. October 2008 12:30
by Kevin
I have just installed this mod (v. 0.2.9) here on board3.de
Good chance, that i'll take a look on this block within the next days. ;)

Re: Mini Knowledge Base block for Mini Knowledge Base v 0.2.8

Posted: 23. October 2008 14:24
by RoxRio
wow, thanks! I'm waiting for the "tests" :mrgreen:

Re: Mini Knowledge Base block for Mini Knowledge Base v 0.2.8

Posted: 28. October 2008 13:00
by Black-Civic
Hallo,

leider kann ich kein Englisch.

Wäre es möglich das nicht nur der Titel sondern auch die beschreibung auf dem Portal angezeigt wird?

MfG
Daniel

Re: Mini Knowledge Base block for Mini Knowledge Base v 0.2.8

Posted: 17. November 2008 06:39
by the.ronin
Thanks for writing this frold ...

The strangest thing is that it is working fine locally for me but when I upload the files to my server, I get the following error:
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3554: Cannot modify header information - headers already sent by (output started at /portal/block/knowledge.php:1)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3556: Cannot modify header information - headers already sent by (output started at /portal/block/knowledge.php:1)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3557: Cannot modify header information - headers already sent by (output started at /portal/block/knowledge.php:1)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3558: Cannot modify header information - headers already sent by (output started at /portal/block/knowledge.php:1)
A look into functions.php show these lines as:

Code: Select all

	header('Content-type: text/html; charset=UTF-8');

	header('Cache-Control: private, no-cache="set-cookie"');
	header('Expires: 0');
	header('Pragma: no-cache');
Also, changing the char limit does not seem to do anything.

Any ideas what might be going on here?

Re: Mini Knowledge Base block for Mini Knowledge Base v 0.2.8

Posted: 17. November 2008 07:36
by j.rhy@n
On the following web site http://www.studmed.dk

I see the following error when I click on the Knowlege link

Code: Select all

[phpBB Debug] PHP Notice: in file /artikler/kb_show.php on line 214: Undefined variable: s_reported
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3638: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3017)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3640: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3017)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3641: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3017)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3642: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3017)

Re: Mini Knowledge Base block for Mini Knowledge Base v 0.2.8

Posted: 17. November 2008 08:33
by Kevin
That seems to ba an issue with the KB itself, not the block.
On this site, the KB looks a bit screwed up in general. ;)

Re: Mini Knowledge Base block for Mini Knowledge Base v 0.2.8

Posted: 17. November 2008 19:30
by frold
It works pretty fine on my site: www.studmed.dk I havent got reported or seen any errors...

Re: Mini Knowledge Base block for Mini Knowledge Base v 0.2.8

Posted: 17. November 2008 19:46
by Kevin
I get the "Undefined variable: s_reported" too in the KB: http://www.studmed.dk/artikler/kb_show.php?id=47
And all special chars seemed to be screwed up. :?

Re: Mini Knowledge Base block for Mini Knowledge Base v 0.2.8

Posted: 17. November 2008 21:39
by the.ronin
^^ That’s just about how mine looks, Kevin.

What baffles me is that it worked perfectly fine during testing on my home computer. I only got the errors when I tried it on the live site. And both are otherwise exactly identical.

Re: Mini Knowledge Base block for Mini Knowledge Base v 0.2.8

Posted: 17. November 2008 21:55
by Kevin
I could imagine that the DB fields for the KB are not set to UTF-8 - i would check this.