neuer recent topics Block

Support zum phpBB2 und zu MODs anderer Autoren.

Moderator: Supporter

neuer recent topics Block

Beitragvon Eva » 10. Nov 2006 11:28

Hi ... also ich hätte gerne einen zweiten recent topics block auf meiner portalseite ....

benutze diesen code hier für meinen bestehenden ... wo muss ich was ändern .. damit die unabhängig voneinander funktionieren ?!

Code: Alles auswählen
#################################################################
## Title: Recent Topics Block for Smartor's ezPortal
## Author: Smartor <smartor_xp@hotmail.com> - http://smartor.is-root.com
## Description: This file explains you how to create Recent Topics block on ezPortal
##
## Files To Edit: 3
##   portal.php
##   templates/subSilver/portal_body.tpl
##   language/lang_english/lang_main.php
##
## Included Files: N/A
##
#################################################################

#
#-----[ OPEN ]-------------------------------------------------------
#
portal.php

#
#-----[ FIND: in configuration section ]-------------------
#
// Poll Forum ID: separate by comma for multi-forums, eg. '3,8,14'
$CFG['poll_forum'] = '1';

#
#-----[ AFTER ADD ]---------------------------------------
# You could config it as well
#
// Number of Recent Topics (not Forum ID)
$CFG['number_recent_topics'] = '10';

// Excluding forums for Recent Topics, eg. '2,4,10' (note: my Recent Topics script has its own permission checking, so you can leave this variable blank)
$CFG['exceptional_forums'] = '';

#
#-----[ FIND ]---------------------------------------------
#
else
{
   $l_total_user_s = $lang['Registered_users_total'];
}

#
#-----[ AFTER ADD ]---------------------------------------
#
//
// Recent Topics
//
$sql = "SELECT * FROM ". FORUMS_TABLE . " ORDER BY forum_id";
if (!$result = $db->sql_query($sql))
{
   message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql);
}
$forum_data = array();
while( $row = $db->sql_fetchrow($result) )
{
   $forum_data[] = $row;
}

$is_auth_ary = array();
$is_auth_ary = auth(AUTH_ALL, AUTH_LIST_ALL, $userdata, $forum_data);

if( $CFG['exceptional_forums'] == '' )
{
   $except_forum_id = '\'start\'';
}
else
{
   $except_forum_id = $CFG['exceptional_forums'];
}

for ($i = 0; $i < count($forum_data); $i++)
{
   if ((!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_read']) or (!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_view']))
   {
      if ($except_forum_id == '\'start\'')
      {
         $except_forum_id = $forum_data[$i]['forum_id'];
      }
      else
      {
         $except_forum_id .= ',' . $forum_data[$i]['forum_id'];
      }
   }
}
$sql = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username
      FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u
      WHERE t.forum_id NOT IN (" . $except_forum_id . ")
         AND t.topic_status <> 2
         AND p.post_id = t.topic_last_post_id
         AND p.poster_id = u.user_id
      ORDER BY p.post_id DESC
      LIMIT " . $CFG['number_recent_topics'];
if (!$result = $db->sql_query($sql))
{
   message_die(GENERAL_ERROR, 'Could not query recent topics information', '', __LINE__, __FILE__, $sql);
}
$number_recent_topics = $db->sql_numrows($result);
$recent_topic_row = array();
while ($row = $db->sql_fetchrow($result))
{
   $recent_topic_row[] = $row;
}
for ($i = 0; $i < $number_recent_topics; $i++)
{
   $template->assign_block_vars('recent_topic_row', array(
      'U_TITLE' => append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $recent_topic_row[$i]['post_id']) . '#' .$recent_topic_row[$i]['post_id'],
      'L_TITLE' => $recent_topic_row[$i]['topic_title'],
      'U_POSTER' => append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $recent_topic_row[$i]['user_id']),
      'S_POSTER' => $recent_topic_row[$i]['username'],
      'S_POSTTIME' => create_date($board_config['default_dateformat'], $recent_topic_row[$i]['post_time'], $board_config['board_timezone'])
      )
   );
}
//
// END - Recent Topics
//

#
#-----[ FIND ]---------------------------------------------
#
   'L_VOTE_BUTTON' => $lang['Vote'],

#
#-----[ AFTER ADD ]----------------------------------------
#
   // Recent Topics
   'L_RECENT_TOPICS' => $lang['Recent_topics'],


#
#-----[ OPEN ]-------------------------------------------------------
#
language/lang_english/lang_main.php

#
#-----[ FIND ]---------------------------------------------
#
$lang['No_poll'] = 'No poll at the moment';

#
#-----[ AFTER ADD ]----------------------------------------
#
$lang['Recent_topics'] = 'Recent topics'; // Recent Topics


#
#-----[ OPEN ]-------------------------------------------------------
#
templates/subSilver/portal_body.tpl

#
#-----[ FIND ]---------------------------------------------
#
        <table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
         <tr>
         <td class="catHead" height="25"><span class="genmed"><b>{L_STATISTICS}</b></span></td>
         </tr>
         <tr>
         <td class="row1" align="left"><span class="gensmall">{TOTAL_USERS}<br />{NEWEST_USER}<br /><br/>{TOTAL_POSTS} {TOTAL_TOPICS}<br />&nbsp;</span></td>
         </tr>
        </table>
       
        <br />
#
# Scrolling Version (should work for IE)
#-----[ AFTER ADD ]----------------------------------------
#
     <table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
      <tr>
      <td class="catHead" height="25"><span class="genmed"><b>{L_RECENT_TOPICS}</b></span></td>
      </tr>
      <tr>
      <td class="row1" align="left"><span class="gensmall">
      <marquee id="recent_topics" behavior="scroll" direction="up" height="200" scrolldelay="100" scrollamount="2">
      <!-- BEGIN recent_topic_row -->
      &raquo; <a href="{recent_topic_row.U_TITLE}" onMouseOver="document.all.recent_topics.stop()" onMouseOut="document.all.recent_topics.start()">{recent_topic_row.L_TITLE}</a><br />
      by <a href="{recent_topic_row.U_POSTER}" onMouseOver="document.all.recent_topics.stop()" onMouseOut="document.all.recent_topics.start()">{recent_topic_row.S_POSTER}</a> on {recent_topic_row.S_POSTTIME}<br /><br />
      <!-- END recent_topic_row -->
      </marquee>
      </span></td>
      </tr>
     </table>
    
     <br />
#
# Classical Version (if scrolling did not work you could try this)
#-----[ OR ]------------------
#
     <table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
      <tr>
      <td class="catHead" height="25"><span class="genmed"><b>{L_RECENT_TOPICS}</b></span></td>
      </tr>
      <tr>
      <td class="row1" align="left"><span class="gensmall">
      <!-- BEGIN recent_topic_row -->
      &raquo; <a href="{recent_topic_row.U_TITLE}">{recent_topic_row.L_TITLE}</a><br />
      by <a href="{recent_topic_row.U_POSTER}">{recent_topic_row.S_POSTER}</a> on {recent_topic_row.S_POSTTIME}<br /><br />
      <!-- END recent_topic_row -->
      </span></td>
      </tr>
     </table>
    
     <br />

#
#-----[ SAVE/UPLOAD ALL FILES ]------------------------------------------
#
# EoF
Benutzeravatar
Eva
User
 
Beiträge: 356
Registriert: 15. Okt 2004 21:49

Beitragvon AmigaLink » 10. Nov 2006 13:45

Schau mal hier. Die Erklärung ist zwar für den KB-Block, aber beim Recent-Topics Block geht es im Prinzip genau so. :)
Die deutsche Sprache ist Freeware, du kannst sie benutzen, ohne dafür zu bezahlen. Sie ist aber nicht Open Source, also darfst du sie nicht verändern, wie es dir gerade passt.
Benutzeravatar
AmigaLink
Administrator
 
Beiträge: 3987
Registriert: 11. Aug 2004 01:06
Wohnort: NRW

Beitragvon Eva » 11. Nov 2006 16:01

ok ... habs versucht .. aber bin ehrlich gesagt kläglich gescheitert .... hmmm
ansich kann das doch nicht so schwer sein .... eigendlich muss ich doch nur ein paar einträge duplizieren und diese neu benennen ?! .. oder sehe ich das falsch ?!
was du da für die KB einträge gemacht hast .. sieht soweit zwar ganz leich aus ... und hat mir auch mehr oder weniger gezeigt wie es im prinzip gehen sollte ... aber funktionieren tut es trotzdem nich :x

kannst du nicht vielleicht doch etwas .. mehr helfen ?! :oops:
Benutzeravatar
Eva
User
 
Beiträge: 356
Registriert: 15. Okt 2004 21:49

Beitragvon AmigaLink » 11. Nov 2006 19:19

Erstmal eine Gegenfrage. In wie fern sollen die beiden Blöcke denn unabhängig voneinander sein?
Der block zeigt die 10 zuletzt verfassten Beiträge an. Der zweite Block würde das auch tun, was darauf hinaus läuft das beide Blöcke das gleiche Anzeigen. :roll:
Die deutsche Sprache ist Freeware, du kannst sie benutzen, ohne dafür zu bezahlen. Sie ist aber nicht Open Source, also darfst du sie nicht verändern, wie es dir gerade passt.
Benutzeravatar
AmigaLink
Administrator
 
Beiträge: 3987
Registriert: 11. Aug 2004 01:06
Wohnort: NRW

Beitragvon Eva » 11. Nov 2006 20:13

Der block soll auch die letzten 10 beiträge anzeigen .. aber halt aus einem anderem forum ... der Momentan zeigt ja die beiträge aus dem gesamten forum an ... und der neue Block soll dann halt nur beiträge aus einer bestimmten Kategorie anzeigen... geht dabei um die Contests die sollen auf der neuen Portalseite gesondert angezeigt werden ....
Benutzeravatar
Eva
User
 
Beiträge: 356
Registriert: 15. Okt 2004 21:49

Beitragvon AmigaLink » 12. Nov 2006 13:14

Na dann:
Code: Alles auswählen
#
#-----[ OPEN ]-------------------------------------------------------
#
portal.php

#
#-----[ FIND: in configuration section ]-------------------
#
$CFG['number_recent_topics'] = '10';

#
#-----[ AFTER ADD ]---------------------------------------
#
// Number of Recent Topics (not Forum ID)
$CFG['number_recent_topics_2'] = '10';

#
#-----[ FIND: in configuration section ]-------------------
#
$CFG['exceptional_forums'] = '';

#
#-----[ AFTER ADD ]---------------------------------------
#
$CFG['exceptional_forums_2'] = '';

#
#-----[ FIND ]---------------------------------------------
#
//
// END - Recent Topics
//

#
#-----[ AFTER ADD ]---------------------------------------
#
//
// Recent Topics 2
//
if( $CFG['exceptional_forums_2'] == '' )
{
   $except_forum_id = '\'start\'';
}
else
{
   $except_forum_id = $CFG['exceptional_forums_2'];
}

for ($i = 0; $i < count($forum_data); $i++)
{
   if ((!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_read']) or (!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_view']))
   {
      if ($except_forum_id == '\'start\'')
      {
         $except_forum_id = $forum_data[$i]['forum_id'];
      }
      else
      {
         $except_forum_id .= ',' . $forum_data[$i]['forum_id'];
      }
   }
}
$sql = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username
      FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u
      WHERE t.forum_id NOT IN (" . $except_forum_id . ")
         AND t.topic_status <> 2
         AND p.post_id = t.topic_last_post_id
         AND p.poster_id = u.user_id
      ORDER BY p.post_id DESC
      LIMIT " . $CFG['number_recent_topics_2'];
if (!$result = $db->sql_query($sql))
{
   message_die(GENERAL_ERROR, 'Could not query recent topics information', '', __LINE__, __FILE__, $sql);
}
$number_recent_topics = $db->sql_numrows($result);
$recent_topic_row = array();
while ($row = $db->sql_fetchrow($result))
{
   $recent_topic_row[] = $row;
}
for ($i = 0; $i < $number_recent_topics; $i++)
{
   $template->assign_block_vars('recent_topic_row_2', array(
      'U_TITLE' => append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $recent_topic_row[$i]['post_id']) . '#' .$recent_topic_row[$i]['post_id'],
      'L_TITLE' => $recent_topic_row[$i]['topic_title'],
      'U_POSTER' => append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $recent_topic_row[$i]['user_id']),
      'S_POSTER' => $recent_topic_row[$i]['username'],
      'S_POSTTIME' => create_date($board_config['default_dateformat'], $recent_topic_row[$i]['post_time'], $board_config['board_timezone'])
      )
   );
}
//
// END - Recent Topics 2
//

#
#-----[ OPEN ]-------------------------------------------------------
#
templates/subSilver/portal_body.tpl

#
#-----[ FIND ]---------------------------------------------
#
        <table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
         <tr>
         <td class="catHead" height="25"><span class="genmed"><b>{L_STATISTICS}</b></span></td>
         </tr>
         <tr>
         <td class="row1" align="left"><span class="gensmall">{TOTAL_USERS}<br />{NEWEST_USER}<br /><br/>{TOTAL_POSTS} {TOTAL_TOPICS}<br />&nbsp;</span></td>
         </tr>
        </table>
       
        <br />
#
# Scrolling Version (should work for IE)
#-----[ AFTER ADD ]----------------------------------------
#
     <table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
      <tr>
      <td class="catHead" height="25"><span class="genmed"><b>{L_RECENT_TOPICS}</b></span></td>
      </tr>
      <tr>
      <td class="row1" align="left"><span class="gensmall">
      <marquee id="recent_topics_2" behavior="scroll" direction="up" height="200" scrolldelay="100" scrollamount="2">
      <!-- BEGIN recent_topic_row_2 -->
      &raquo; <a href="{recent_topic_row_2.U_TITLE}" onMouseOver="document.all.recent_topics_2.stop()" onMouseOut="document.all.recent_topics_2.start()">{recent_topic_row_2.L_TITLE}</a><br />
      by <a href="{recent_topic_row_2.U_POSTER}" onMouseOver="document.all.recent_topics_2.stop()" onMouseOut="document.all.recent_topics_2.start()">{recent_topic_row_2.S_POSTER}</a> on {recent_topic_row_2.S_POSTTIME}<br /><br />
      <!-- END recent_topic_row_2 -->
      </marquee>
      </span></td>
      </tr>
     </table>
     
     <br />
#
# Classical Version (if scrolling did not work you could try this)
#-----[ OR ]------------------
#
     <table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
      <tr>
      <td class="catHead" height="25"><span class="genmed"><b>{L_RECENT_TOPICS}</b></span></td>
      </tr>
      <tr>
      <td class="row1" align="left"><span class="gensmall">
      <!-- BEGIN recent_topic_row_2 -->
      &raquo; <a href="{recent_topic_row_2.U_TITLE}">{recent_topic_row_2.L_TITLE}</a><br />
      by <a href="{recent_topic_row_2.U_POSTER}">{recent_topic_row_2.S_POSTER}</a> on {recent_topic_row_2.S_POSTTIME}<br /><br />
      <!-- END recent_topic_row_2 -->
      </span></td>
      </tr>
     </table>
     
     <br />

#
#-----[ SAVE/UPLOAD ALL FILES ]------------------------------------------
#
# EoF
Dieser Block verhält sich exakt so wie das Original. Das bedeutet, du musst bei $CFG['exceptional_forums_2'] = ''; alle Foren angeben, die nicht angezeigt werden sollen.

Wichtig!!!
Ich habe die Datenbankabfrage für die Berechtigungsprüfung entfernt um eine unnötige Datenbankabfrage zu sparen. Das bedeutet das du die Einträge in der portal.php auf jeden Fall direkt hinter die des Original Blocks setzen musst, damit der zweite Block auf die Ergebnisse des ersten zugreifen kann.
(In der portal_body.tpl ist die Platzieren allerdings egal.)
Die deutsche Sprache ist Freeware, du kannst sie benutzen, ohne dafür zu bezahlen. Sie ist aber nicht Open Source, also darfst du sie nicht verändern, wie es dir gerade passt.
Benutzeravatar
AmigaLink
Administrator
 
Beiträge: 3987
Registriert: 11. Aug 2004 01:06
Wohnort: NRW


Zurück zu phpBB2 Support



Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 11 Gäste

cron