Mini Knowledge Base block for Mini Knowledge Base v 0.2.8

Forum rules
This forum is not for support requests.

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

Topic author
frold
Portal Enthusiast
Portal Enthusiast
Posts: 108
Joined: 24. March 2008 08:52

Mini Knowledge Base block for Mini Knowledge Base v 0.2.8

Post by frold » 24. May 2008 20:49

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']),
Last edited by frold on 14. July 2008 08:29, edited 1 time in total.
http://www.studmed.dk - Portal for doctors and medical students in Denmark


Topic author
frold
Portal Enthusiast
Portal Enthusiast
Posts: 108
Joined: 24. March 2008 08:52

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

Post by frold » 24. May 2008 21:44

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" />
http://www.studmed.dk - Portal for doctors and medical students in Denmark


Kharon
Active Member
Active Member
Posts: 28
Joined: 18. May 2008 10:01

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

Post by Kharon » 11. July 2008 00:04

thank you frold

it is working Mini Knowledge Base v 0.2.8 :)


Topic author
frold
Portal Enthusiast
Portal Enthusiast
Posts: 108
Joined: 24. March 2008 08:52

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

Post by frold » 14. July 2008 08:29

Kharon wrote:thank you frold

it is working Mini Knowledge Base v 0.2.8 :)

Thank you subject updated :D
http://www.studmed.dk - Portal for doctors and medical students in Denmark


RoxRio
Active Member
Active Member
Posts: 3
Joined: 22. October 2008 23:21

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

Post by RoxRio » 22. October 2008 23:29

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.

User avatar

Kevin
Site Admin
Site Admin
Posts: 2888
Joined: 7. January 2006 21:11
phpBB.de User: Saint
phpBB.com User: Saint_hh
Location: Hamburg

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

Post by Kevin » 23. October 2008 12:30

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. ;)
~~~ They say the definition of madness is doing the same thing and expecting a different result ~~~

Kein Support per PN / No support via PM!


RoxRio
Active Member
Active Member
Posts: 3
Joined: 22. October 2008 23:21

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

Post by RoxRio » 23. October 2008 14:24

wow, thanks! I'm waiting for the "tests" :mrgreen:


Black-Civic
Active Member
Active Member
Posts: 5
Joined: 28. October 2008 12:59
phpBB.de User: Black-Civic
phpBB.com User: Black-Civic
Location: SIG

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

Post by Black-Civic » 28. October 2008 14:00

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


the.ronin
Valued Contributor
Valued Contributor
Posts: 64
Joined: 30. October 2008 17:20

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

Post by the.ronin » 17. November 2008 07:39

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?


j.rhy@n
Active Member
Active Member
Posts: 35
Joined: 6. October 2008 13:02

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

Post by j.rhy@n » 17. November 2008 08:36

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)

User avatar

Kevin
Site Admin
Site Admin
Posts: 2888
Joined: 7. January 2006 21:11
phpBB.de User: Saint
phpBB.com User: Saint_hh
Location: Hamburg

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

Post by Kevin » 17. November 2008 09:33

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. ;)
~~~ They say the definition of madness is doing the same thing and expecting a different result ~~~

Kein Support per PN / No support via PM!


Topic author
frold
Portal Enthusiast
Portal Enthusiast
Posts: 108
Joined: 24. March 2008 08:52

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

Post by frold » 17. November 2008 20:30

It works pretty fine on my site: www.studmed.dk I havent got reported or seen any errors...
http://www.studmed.dk - Portal for doctors and medical students in Denmark

User avatar

Kevin
Site Admin
Site Admin
Posts: 2888
Joined: 7. January 2006 21:11
phpBB.de User: Saint
phpBB.com User: Saint_hh
Location: Hamburg

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

Post by Kevin » 17. November 2008 20:46

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. :?
You do not have the required permissions to view the files attached to this post.
~~~ They say the definition of madness is doing the same thing and expecting a different result ~~~

Kein Support per PN / No support via PM!


the.ronin
Valued Contributor
Valued Contributor
Posts: 64
Joined: 30. October 2008 17:20

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

Post by the.ronin » 17. November 2008 22:39

^^ 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.

User avatar

Kevin
Site Admin
Site Admin
Posts: 2888
Joined: 7. January 2006 21:11
phpBB.de User: Saint
phpBB.com User: Saint_hh
Location: Hamburg

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

Post by Kevin » 17. November 2008 22:55

I could imagine that the DB fields for the KB are not set to UTF-8 - i would check this.
~~~ They say the definition of madness is doing the same thing and expecting a different result ~~~

Kein Support per PN / No support via PM!

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