The last Five...

Hulp nodig bij een modificaties of op zoek naar een MOD? Bekijk ons archief. Support wordt helaas niet meer verleend.
Forumregels

Sinds 1 januari 2009 wordt phpBB2 niet meer ondersteund.
Onderstaande informatie is verouderd en dient uitsluitend als archief.
phpBB2.0.x
Gesloten
Pianoplayer
Berichten: 68
Lid geworden op: 27 jul 2004, 12:04
Contacteer:

The last Five...

Bericht door Pianoplayer » 22 aug 2004, 12:29

mod name: The last Five and the Five popular (answers/views) on index.php

Ik heb hem op template.php (mn portal) gezet, maar daar werkt ie niet.
Dit heb ik in template.php gezet (gewoon zoals de mod zei):

Code: Selecteer alles

	//
	// Okay, let's build the topic recent and popular
	//
$active_topics_sql="SELECT a.topic_id,a.topic_title,  a.topic_replies,  a.topic_last_post_id, c.post_time 
			FROM phpbb_topics a, phpbb_users b, phpbb_posts c, phpbb_forums d 
			where a.topic_last_post_id=c.post_id and b.user_id=c.poster_id 
				and d.forum_id=a.forum_id 
				and d.auth_view=0 
			ORDER BY topic_last_post_id DESC 
			LIMIT 5"; 
$active_topics = $db->sql_query($active_topics_sql); 

$active_topics_sql2="SELECT a.topic_id,a.topic_title,  a.topic_replies,  a.topic_last_post_id, c.post_time 
			FROM phpbb_topics a, phpbb_users b, phpbb_posts c, phpbb_forums d 
			where a.topic_last_post_id=c.post_id and b.user_id=c.poster_id 
				and d.forum_id=a.forum_id 
				and d.auth_view=0 
			ORDER BY topic_replies DESC 
			LIMIT 5"; 
$active_topics2 = $db->sql_query($active_topics_sql2); 

$active_topics_sql3="SELECT a.topic_id,a.topic_title,  a.topic_views, a.topic_replies,  a.topic_last_post_id, c.post_time
			FROM phpbb_topics a, phpbb_users b, phpbb_posts c, phpbb_forums d 
			where a.topic_last_post_id=c.post_id and b.user_id=c.poster_id 
				and d.forum_id=a.forum_id 
				and d.auth_view=0 
			ORDER BY topic_views DESC 
			LIMIT 5"; 
$active_topics3 = $db->sql_query($active_topics_sql3); 

	while (($line = mysql_fetch_array($active_topics)) and ($line2 = mysql_fetch_array($active_topics2)) and ($line3 = mysql_fetch_array($active_topics3)))
	{
		if (strlen($line['topic_title']) > 40)
		{
			$line_topic_title = substr($line['topic_title'], 0, 40)." ...";
		}
		else
		{
			$line_topic_title = $line['topic_title'];
		}
		if (strlen($line2['topic_title']) > 40)
		{
			$line_topic_title2 = substr($line2['topic_title'], 0, 40)." ...";
		}
		else
		{
			$line_topic_title2 = $line2['topic_title'];
		}
		if (strlen($line3['topic_title']) > 40)
		{
			$line_topic_title3 = substr($line3['topic_title'], 0, 40)." ...";
		}
		else
		{
			$line_topic_title3 = $line3['topic_title'];
		}
		$lastpost = "<a href=\"".$phpbb_root_path."viewtopic.php?t=" . $line['topic_id'] . "\" title=\"" . $line['topic_title'] ."\">" . $line_topic_title . "</a>";
		$poppost = "<a href=\"".$phpbb_root_path."viewtopic.php?t=" . $line2['topic_id'] . "\" title=\"" . $line2['topic_title'] ."\">" . $line_topic_title2 . "</a>";
		$poppostc = $line2['topic_replies'];
		$popviewpost = "<a href=\"".$phpbb_root_path."viewtopic.php?t=" . $line3['topic_id'] . "\" title=\"" . $line3['topic_title'] ."\">" . $line_topic_title3 . "</a>";
		$popviewpostc = $line3['topic_views'];
		$template->assign_block_vars('topicrecentpopular', array(
			'TOPICSPOPULAR' => $poppost, 
			'TOPICSPOPULARC' => $poppostc, 
			'TOPICSPOPULARVIEW' => $popviewpost, 
			'TOPICSPOPULARVIEWC' => $popviewpostc, 
			'TOPICSRECENT' => $lastpost)
		);
	}

en dit in template.tpl:

Code: Selecteer alles

<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
  <tr> 
	<th width="25%" class="thTop" nowrap="nowrap">&nbsp;{L_TOPICSRECENT}&nbsp;</th>
	<th width="38%" colspan="2" class="thTop" nowrap="nowrap">&nbsp;{L_TOPICSPOPULAR}&nbsp;</th>
	<th width="37%" colspan="2" class="thTop" nowrap="nowrap">&nbsp;{L_TOPICSPOPULARVIEW}&nbsp;</th>
  </tr>
  <!-- BEGIN topicrecentpopular -->
  <tr> 
	<td width="29%" class="row2" align="left" valign="middle"><span class="gensmall">{topicrecentpopular.TOPICSRECENT}</span></td>
	<td width="31%" class="row2" align="left" valign="middle"><span class="gensmall">{topicrecentpopular.TOPICSPOPULAR}</span></td>
	<td width="6%" class="row2" align="center" valign="middle"><span class="gensmall">{topicrecentpopular.TOPICSPOPULARC}</span></td>
	<td width="29%" class="row2" align="left" valign="middle"><span class="gensmall">{topicrecentpopular.TOPICSPOPULARVIEW}</span></td>
	<td width="6%" class="row2" align="center" valign="middle"><span class="gensmall">{topicrecentpopular.TOPICSPOPULARVIEWC}</span></td>
  </tr>
  <!-- END topicrecentpopular -->
</table>

&nbsp;
Hier kan je zelf kijken.

zitten er fouten in ofzo? op index.php werkt hij wel gewoon...

Alvast bedankt :thumb:
Afbeelding Be Welcome...
Show off van mn forum, nog weinig reacties... :P

Gebruikersavatar
mosymuis
Berichten: 6940
Lid geworden op: 05 feb 2003, 14:00
Locatie: Amsterdam
Contacteer:

Re: The last Five...

Bericht door mosymuis » 22 aug 2004, 15:08

Pianoplayer schreef:maar daar werkt ie niet.
Wees eens duidelijker...?

Pianoplayer
Berichten: 68
Lid geworden op: 27 jul 2004, 12:04
Contacteer:

Bericht door Pianoplayer » 22 aug 2004, 16:14

In template.php(mijn portal) komt gewoon helemaal niks te staan zoals je kan zien. Maar in index.php als je daar kijkt onderin, werkt hij wel zoals hij moet werken. Uhm, wil je verder nog wat weten?

Alvast bedankt :thumb:
Afbeelding Be Welcome...
Show off van mn forum, nog weinig reacties... :P

Gesloten