PDA

Zobacz pełną wersję : Mod Latest Topics - jak zrobić widok tylko z niekótych działów?



bartus2003
31-05-2007, 15:45
Witam wie może ktoś jak zmodyfikować ten mod, aby wyświetlane były tematy tylko z niektórych działów, przeze mnie wybranych??

Oto kod źródłowy tego moda:


<?php
// $Id: mod_latest_topics.php,v 1.3 2003/09/15 08:02:54 avandongen Exp $
//
// Copyright (C) 2003-2004 TIM_online
// All rights reserved.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// The "GNU General Public License" (GPL) is available at
// http://www.gnu.org/copyleft/gpl.html.

defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

$menuitem = ($params->get( 'menuitem' )) ? $params->get( 'menuitem' ) : 0;
$titlelenght = ($params->get( 'titlelenght' )) ? $params->get( 'titlelenght' ) : 15;
$moduleclass_sfx = $params->get( 'moduleclass_sfx' );
$forum_access = ($params->get( 'forum_access' )) ? $params->get( 'forum_access' ) : 0;
$number = ($params->get( 'number' )) ? $params->get( 'number' ) : 10;
$linktarget = ($params->get( 'linktarget' )) ? $params->get( 'linktarget' ) : '_self';
$component = ($params->get( 'component' )) ? $params->get( 'component' ) : 0;

$display_time = ($params->get( 'display_time' )) ? $params->get( 'display_time' ) : 0;
$title_time_separator = ($params->get( 'title_time_separator' )) ? $params->get( 'title_time_separator' ) : " @ ";
$time_format = ($params->get( 'time_format' )) ? $params->get( 'time_format' ) : "%d-%m-%Y %H:%M";

$display_user = ($params->get( 'display_user' )) ? $params->get( 'display_user' ) : 0;
$time_user_separator = ($params->get( 'time_user_separator' )) ? $params->get( 'time_user_separator' ) : " by ";

$access = $access + 1;
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="<?php echo $moduleclass_sfx; ?>content" align="center">
<tr>
<td>
<!-- begin topic content -->
<?

$link = ($component == 0) ? '' : '2';

$query="SELECT topic_title, topic_id, t.topic_time, t.topic_last_post_id, t.topic_poster AS topic_poster_id, u.name AS topic_poster
FROM phpbb_topics t
LEFT JOIN phpbb_forums f ON f.forum_id = t.forum_id
LEFT JOIN #__users u ON t.topic_poster = u.id
WHERE t.topic_views != 0
ORDER BY t.topic_last_post_id DESC LIMIT 0, $number";

//echo $query;
$database->setQuery($query);
$rows = $database->loadObjectList();

//check if there is result
if(count($rows) > 0){

for($i=0,$n=count($rows);$i<$n;$i++){
$row = &$rows[$i];

$topic_title = $row->topic_title;
if(strlen($topic_title) > $titlelenght){
$topic_title = substr($topic_title, 0, ($titlelenght - 2)) . "...";
}

$topic_id = $row->topic_id;

echo '<font class="cross">+</font> ';
echo '<a target="'.$linktarget.'" href="'.sefRelToAbs('http://forum.warrock.com.pl/viewtopic'.$link.'.php?&Itemid='.$menuitem.'&page=viewtopic&t=' . $topic_id) . '" title="'.$row->topic_title.'">'.$topic_title."</a>";
if($display_time == 1){
if(!empty($title_time_separator)){
echo " " . $title_time_separator;
}
echo " " . strftime($time_format, $row->topic_time);
}
if($display_user == 1){
if(!empty($time_user_separator)){
echo " " . $time_user_separator;
}
echo ' <a target="'.$linktarget.'" href="'.sefRelToAbs('http://forum.warrock.com.pl/profile'.$link.'.php?&Itemid='.$menuitem.'&mode=viewprofile&u=' . $row->topic_poster_id) . '" title="'.$row->topic_poster.'">'.$row->topic_poster."</a>";
}
echo "<br />\n";
}
}
else {
echo '<font class="cross">+</font> <a target="'.$linktarget.'" href="'.sefRelToAbs('http://forum.warrock.com.pl/index'.$link.'.php?&Itemid='.$menuitem).'">No topics found</a><br>';
}
?>

</tr>
</table>

Czekam na pomocną dłoń, z góry dziękuję!

bartus2003
02-06-2007, 13:48
nikt nie wie ??