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" />
portal.php
Code: Select all
if ($portal_config['portal_change_style'])
{
include($phpbb_root_path . 'portal/block/change_style.'.$phpEx);
}
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 -->
Code: Select all
<!-- INCLUDE portal/block/knowledge.html -->
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);
?>
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
Code: Select all
'U_ARTIKEL' => append_sid("{$phpbb_root_path}knowledge/kb_show." . $phpEx . '?id=' . $row['article_id']),