Seite 1 von 2

zweite recent topics box für ezportal

Verfasst: 23.11.2003 17:40
von peter17
hallo, grüss euch!

ich habe nun auf www.webicoo.com den ezportal mod installiert. alles funkt soweit, nur hätte ich nun gerne eine zweite recent topic news box eingebaut.

jetzt habe ich mir gedacht, " .... ganz einfach ..., ich nehme smartors recent topic mod und benenne die variablen um .... und baue das ganze nochmals ein ....". leichter gesagt als getan. ich bin mir nicht ganz klar, was ich alles "umtaufen" muss, kann mir vielleicht jemand helfen?

hier ist der mod code für die erste recent topic box.

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';

// Exceptional 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&" . 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
#-----[ 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
#-----[ 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

ich habe es schon einmal probiert, nur leider funkte dies nicht.

würde euch sehr für eure hilfe dankbar sein.

mfg peter

Verfasst: 24.11.2003 17:11
von peter17
kann mir keiner den obigen code für eine zweite recent topics box adaptieren ?
danke für eure hilfe
lg peter

Verfasst: 26.11.2003 06:45
von peter17
hallo phpbbler!

bin leider noch nicht weitergekommen, vielleicht hat doch jemand zeit mir zu helfen.
danke

mfg peter

Verfasst: 03.12.2003 09:19
von peter17
hallo leute!

kann mir denn niemand den obigen code für eine 2. news box anpassen? oder habt ihr einen anderen tipp, welchen mod ich in smartors portal einbauen kann, um eine 2. recent topic box zu bekommen ?

danke euch im voraus

mfg
peter

Verfasst: 03.12.2003 09:42
von Acid
Soll das auf der gleichen Seite wie die 1. recent-Box angezeigt werden?
Und dieselben Foren sollen ausgelesen werden?

Verfasst: 03.12.2003 09:53
von peter17
hallo acid :grin:

ja die 2. box soll auch auf der portalseite eingebaut werden. im prinzip soll die 2. box oberhalb der ersten positioniert werden, (also links).
ausgelesen werden sollte aber nur das forum mit der nummer 5.
(aber das kann ich mir schon konfigurieren)

übrigens ich verwende nur die classical version, d.h. die scrolling version könnte man vernachlässigen.

danke dir für deine hilfe!

mfg peter

Verfasst: 03.12.2003 10:13
von Acid

Code: Alles auswählen

$special_forums = '5';
$sql2 = "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 IN (" . $special_forums . ")
                      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( !$result2 = $db->sql_query($sql2) )
{
           message_die(GENERAL_ERROR, 'Could not query recent topics information from special forum.', '', __LINE__, __FILE__, $sql2);
}
$number_recent_topics2 = $db->sql_numrows($result2);
$recent_topic_row2 = array();
while( $row2 = $db->sql_fetchrow($result2) )
{
           $recent_topic_row2[] = $row2;
}
for ($i = 0; $i < $number_recent_topics2; $i++)
{
           $template->assign_block_vars('special_forum', array(
                      'U_TOPIC' => append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $recent_topic_row2[$i]['post_id']) . '#' .$recent_topic_row2[$i]['post_id'],
                      'TOPIC' => $recent_topic_row2[$i]['topic_title'],
                      'U_AUTHOR' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $recent_topic_row2[$i]['user_id']),
                      'AUTHOR' => $recent_topic_row2[$i]['username'],
                      'POST_TIME' => create_date($board_config['default_dateformat'], $recent_topic_row2[$i]['post_time'], $board_config['board_timezone']),
           ));
}
..füge das mal in der *.php unter..

Code: Alles auswählen

// END - Recent Topics
// 
..ein. Bei $special_forum kannst du die ForenID des besagten Forums angeben (wenn du mehrere eingeben willst, dann müssen sie mit ´nem Komma getrennt werden) und für den *.tpl Teil kannst du dann folgendes benutzen..

Code: Alles auswählen

<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 special_forum -->
         &raquo; <a href="{special_forum.U_TOPIC}">{special_forum.TOPIC}</a><br />
         by <a href="{special_forum.U_AUTHOR}">{special_forum.AUTHOR}</a> on {special_forum.POST_TIME}<br /><br />
         <!-- END special_forum -->
         </span></td>
  </tr>
</table><br /> 
..sollte eigentlich funktionieren.

Verfasst: 03.12.2003 20:40
von peter17
hallo acid!

1000 dank!

es funktioniert prächtig. :lol:

eine frage hätte ich noch zur 2. newsbox:

Code: Alles auswählen

<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 special_forum --> 
ich hätte gerne die über schrift der 2. newsbox

Code: Alles auswählen

<b>{L_RECENT_TOPICS}</b>
anders benannt.

(derzeit habe ich die überschrift hardcoded in die portal_body.tpl seite geschrieben)

aber wo kann ich diese 2. überschrift übersteuern???

ich dachte so wie man in der lang_main.php
die überschrift für die 1. box übersteuert

Code: Alles auswählen

$lang['Recent_topics'] = 'Neueste Beitr&auml;ge im Forum'; // Recent Topics
definiere ich ganz einfach für die 2. box eine neue überschrift

Code: Alles auswählen

$lang['Special_forum'] = 'Neueste Beitr&auml;ge im Spezialforum'; // Recent Topic 2
aber irgendwie funkt das nicht???

wie siehst du das?

danke
mfg peter

Verfasst: 04.12.2003 11:36
von Acid
Du musst unter ..

Code: Alles auswählen

'L_RECENT_TOPICS' => $lang['Recent_topics'],
..noch folgendes eintragen..

Code: Alles auswählen

'L_SPECIAL_FORUM' => $lang['Special_forum'],
..in der *.tpl dann {L_RECENT_TOPICS} mit {L_SPECIAL_FORUM} ersetzen.

Verfasst: 04.12.2003 17:06
von peter17
danke acid!

habe es nun durchschaut. ich habe vergessen, dass man 3 dateien modifizieren muss.

nämlich die portal.php, portal_body.tpl und lang_main.php

mfg peter