Icons vom POST ICON hack auf dem index.. kleine hilfe bitte

In diesem Forum können Mod-Autoren ihre Mods vorstellen, die sich noch im Entwicklungsstatus befinden. Der Einbau in Foren im produktiven Betrieb wird nicht empfohlen.
Forumsregeln
phpBB 2.0 hat das Ende seiner Lebenszeit überschritten
phpBB 2.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 2.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf phpBB 3.0, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
Benutzeravatar
ATARI
Mitglied
Beiträge: 1684
Registriert: 22.02.2004 16:51
Wohnort: Monaco Di Bavaria

Icons vom POST ICON hack auf dem index.. kleine hilfe bitte

Beitrag von ATARI »

So, servus.


Also ich hab mr da jetzt ein kleines Addon gebastelt um die Icons vom POST ICONs Mod auch im Index darstellen zu lassen, was auch prima funzt, nur leider einen kleinen Schönheitsfehler drin hat, aber dazu komm ich später.


Hier erstmal das Addon:

Code: Alles auswählen

##############################################################
## MOD Title: Index AddOn for Post Icons MOD
## MOD Author: Darezettl <darezettl> (Thomas Zettl) http://darezettl.de
## MOD Description: Shows Post Icons on the Forum Index
## MOD Version: 0.0.1
##
## Installation Level: easy
## Installation Time: 
## Files To Edit: 2
##                index.php
##                templates/subSilver/index_body.tpl
## Included Files: n/a
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MODs not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
index.php

#
#-----[ FIND ]------------------------------------------
#

include($phpbb_root_path . 'common.'.$phpEx);

#
#-----[ AFTER, ADD ]------------------------------------------
#

include($phpbb_root_path . 'includes/def_icons.'. $phpEx);

#
#-----[ FIND ]------------------------------------------
#

$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id, t.topic_icon, t.topic_title, t.topic_last_post_id " .

#
#-----[ IN-LINE FIND ]------------------------------------------
#

t.topic_title,

#
#-----[ BEFORE, ADD ]------------------------------------------
#

t.topic_icon, 

#
#-----[ FIND ]------------------------------------------
#

$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];

#
#-----[ AFTER, ADD ]------------------------------------------
#

$icon = get_icon_title($forum_data[$j]['topic_icon'], 1, $type);

#
#-----[ FIND ]------------------------------------------
#

'TOPICS' => $forum_data[$j]['forum_topics'],

#
#-----[ AFTER, ADD ]------------------------------------------
#

'ICON' => $icon,

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

#
#-----[ FIND ]------------------------------------------
#

{catrow.forumrow.LAST_POST}

#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#

{catrow.forumrow.ICON}&nbsp;

Gut, der Schönheitsfehler ist dass wenn man das Topic kein Icon enthält, der Platz für das selbige im Index trotzdem "freigehalten" wird, im Gegensatz zu vBulletin.

Ich hab mal zwei Screenshots gemacht zur Verdeutlichung.

Auf den Screenhots seht ihr jeweils ein Topic mit -und eins ohne Topic Icon (im Index).


Screenshot von vBulletin:
[ externes Bild ]

Screenshot von meiner Lösung für phpBB:
[ externes Bild ]


Wie macht dem Script nun klar, dass wenn kein Icon ausgewählt wurde, der Platz nicht "freigehalten" werden braucht?
Man soll aufhören wenn´s am schönsten ist!

Servus phpBB! ;)
fanrpg
Mitglied
Beiträge: 2909
Registriert: 13.12.2004 22:41

Beitrag von fanrpg »

In deiner php datei nach:

Code: Alles auswählen

$icon = get_icon_title($forum_data[$j]['topic_icon'], 1, $type);
das setzen:

Code: Alles auswählen

if( !empty($icon) )
{
$template->assign_block_vars('switch_icon', array());
}
und dann in deine tpl Datei anstatt:

Code: Alles auswählen

# 
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------ 
# 

{catrow.forumrow.ICON}&nbsp;
das hier setzen:

Code: Alles auswählen

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
<!-- BEGIN switch_icon -->
{catrow.forumrow.ICON}&nbsp;
<!-- END switch_icon -->
Das dürfte schon reichen um das Problem zu beseitigen :wink:
Benutzeravatar
ATARI
Mitglied
Beiträge: 1684
Registriert: 22.02.2004 16:51
Wohnort: Monaco Di Bavaria

Beitrag von ATARI »

Also dann wird gar kein Icon mehr angezeigt im Index.
fanrpg: irgendwelche Vorschläge?
Mag es jemand anders mal testen?
Man soll aufhören wenn´s am schönsten ist!

Servus phpBB! ;)
fanrpg
Mitglied
Beiträge: 2909
Registriert: 13.12.2004 22:41

Beitrag von fanrpg »

füge diesen block einfach mal in den index rein bei der schleife von forumrow (den alten block weg)

Code: Alles auswählen

if( !empty($icon) ) 
{ 
$template->assign_block_vars('catrow.forumrow.switch_icon', array()); 
}
Das dürfte dann aber jetzt helfen!
Benutzeravatar
ATARI
Mitglied
Beiträge: 1684
Registriert: 22.02.2004 16:51
Wohnort: Monaco Di Bavaria

Beitrag von ATARI »

Dann st der komplette Index verzogen.
Liegt wahrscheinlich da dran, dass der Switch von dir innerhalb eines anderes Switches wär (Forumtitle as weblink von oxpus)..

>>

Code: Alles auswählen

<!-- BEGIN catrow -->
<table width="98%" align="center" cellpadding="2" cellspacing="1" border="0" class="forumline">
  <tr>
   <th colspan="2" nowrap="nowrap">&nbsp;{L_FORUM}&nbsp;</th>
   <th width="50" nowrap="nowrap">&nbsp;{L_TOPICS}&nbsp;</th>
   <th width="50" nowrap="nowrap">&nbsp;{L_POSTS}&nbsp;</th>

   <th nowrap="nowrap">&nbsp;{L_LASTPOST}&nbsp;</th>
  </tr>
  <tr>
   <td class="thSides" colspan="5" height="28">&nbsp;<a href="{catrow.U_VIEWCAT}" class="headmenu" title="{catrow.CAT_DESC}">&raquo; {catrow.CAT_DESC}.</a></td>
  </tr>
<!-- BEGIN forumrow -->
<!-- IF ! forumrow.PARENT -->
  <tr>
   <td class="row1" align="center" valign="middle" height="50" onMouseOver="this.style.backgroundColor='#F3F3F3'; this.style.cursor='default';" onMouseOut="this.style.backgroundColor='#F9F9F9';">{catrow.forumrow.S_MARK_LINK_START}<img src="{catrow.forumrow.FORUM_FOLDER_IMG}" id="forumimage_{catrow.forumrow.FORUM_ID}" title="{catrow.forumrow.L_FORUM_FOLDER_ALT}" border="0" width="32" height="32" hspace="15" />{catrow.forumrow.S_MARK_LINK_END}</td>
   <td class="row1" width="100%" onMouseOver="this.style.backgroundColor='#F3F3F3'; this.style.cursor='default';" onMouseOut="this.style.backgroundColor='#F9F9F9';" onclick="window.location.href='{catrow.forumrow.U_VIEWFORUM}'">
      <a href="{catrow.forumrow.U_VIEWFORUM}" class="forumlink" title="{catrow.forumrow.FORUM_DESC}">{catrow.forumrow.FORUM_NAME}</a><span class="gensmall">
	<!-- BEGIN switch_users_viewing -->
	({catrow.forumrow.USERS_VIEWING} {L_USERS_VIEWING})
	<!-- END switch_users_viewing -->
	</span><br /><span class="genmed">{catrow.forumrow.FORUM_DESC}<br /></span>
<!-- IF catrow.forumrow.MODERATORS --><span class="gensmall">{catrow.forumrow.L_MODERATOR} {catrow.forumrow.MODERATORS}<br /></span><!-- ENDIF -->
	  <!-- BEGIN sub --><!-- DEFINE $HAS_SUB = 1 --><!-- IF catrow.forumrow.sub.NUM > 0 -->, <!-- ELSE --><span class="genmed">{L_SUBFORUMS}<b><u>:</u></b> <!-- ENDIF -->{catrow.forumrow.sub.LAST_POST_SUB} <a href="{catrow.forumrow.sub.U_VIEWFORUM}" <!-- IF catrow.forumrow.sub.UNREAD -->class="topic-new"<!-- ENDIF --> title="{catrow.forumrow.sub.FORUM_DESC_HTML}">{catrow.forumrow.sub.FORUM_NAME}</a><!-- END sub -->
	  <!-- IF $HAS_SUB --></span><!-- UNDEFINE $HAS_SUB --><!-- ENDIF -->
	</td>
	<!-- BEGIN switch_forum_link_off -->
   <td class="row2" align="center" valign="middle" onMouseOver="this.style.backgroundColor='#F9F9F9'; this.style.cursor='default';" onMouseOut="this.style.backgroundColor='#F3F3F3';"><span class="gensmall">{catrow.forumrow.TOPICS}</span></td>
   <td class="row2" align="center" valign="middle" onMouseOver="this.style.backgroundColor='#F9F9F9'; this.style.cursor='default';" onMouseOut="this.style.backgroundColor='#F3F3F3';"><span class="gensmall">{catrow.forumrow.POSTS}</span></td>
   <td class="row2" align="center" valign="middle" nowrap="nowrap" onMouseOver="this.style.backgroundColor='#F9F9F9'; this.style.cursor='default';" onMouseOut="this.style.backgroundColor='#F3F3F3'" onclick="window.location.href='{catrow.forumrow.LAST_POSTLINK_HYPERCELL}';"><span class="gensmall">
<!-- BEGIN switch_icon -->
{catrow.forumrow.ICON}&nbsp;
<!-- END switch_icon -->
{catrow.forumrow.LAST_POST}</span></td>
  <!-- END switch_forum_link_off -->
<!-- BEGIN switch_forum_link_on -->
	<td class="row2" align="center" valign="middle" colspan="3" onMouseOver="this.style.backgroundColor='#F9F9F9'; this.style.cursor='default';" onMouseOut="this.style.backgroundColor='#F3F3F3';"><span class="gensmall">{catrow.forumrow.FORUM_LINK_COUNT}</span></td>
<!-- END switch_forum_link_on -->
  </tr>
  <!-- ENDIF -->
  <!-- END forumrow -->
</table><br />
<!-- END catrow -->
schade.
wär schön gewesen..

kann man gar nix machen oder??
Man soll aufhören wenn´s am schönsten ist!

Servus phpBB! ;)
fanrpg
Mitglied
Beiträge: 2909
Registriert: 13.12.2004 22:41

Beitrag von fanrpg »

Code: Alles auswählen

if( !empty($icon) ) 
{ 
$template->assign_block_vars('catrow.forumrow.switch_forum_link_off.switch_icon', array()); 
}
Versuch den Codeblock mal so
Aber verziehen dürfte an sich der Index sich nicht.
Benutzeravatar
ATARI
Mitglied
Beiträge: 1684
Registriert: 22.02.2004 16:51
Wohnort: Monaco Di Bavaria

Beitrag von ATARI »

Ne, sieht genauso verzogen aus wie beim anderen.
So hätt ichs gemacht jetzt:

Code: Alles auswählen

##############################################################
## MOD Title: Index AddOn for Post Icons MOD
## MOD Author: Darezettl <darezettl> (Thomas Zettl) http://darezettl.de
## MOD Description: Shows Post Icons on the Forum Index
## MOD Version: 0.0.1
##
## Installation Level: easy
## Installation Time:
## Files To Edit: 2
##                index.php
##                templates/subSilver/index_body.tpl
## Included Files: n/a
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MODs not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
index.php

#
#-----[ FIND ]------------------------------------------
#

include($phpbb_root_path . 'common.'.$phpEx);

#
#-----[ AFTER, ADD ]------------------------------------------
#

include($phpbb_root_path . 'includes/def_icons.'. $phpEx);

#
#-----[ FIND ]------------------------------------------
#

$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id, t.topic_icon, t.topic_title, t.topic_last_post_id " .

#
#-----[ IN-LINE FIND ]------------------------------------------
#

t.topic_title,

#
#-----[ BEFORE, ADD ]------------------------------------------
#

t.topic_icon,

#
#-----[ FIND ]------------------------------------------
#

$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];

#
#-----[ AFTER, ADD ]------------------------------------------
#

$icon = get_icon_title($forum_data[$j]['topic_icon'], 1, $type);
if( !empty($icon) )
{
$template->assign_block_vars('catrow.forumrow.switch_forum_link_off.switch_icon', array());
}

#
#-----[ FIND ]------------------------------------------
#

'TOPICS' => $forum_data[$j]['forum_topics'],

#
#-----[ AFTER, ADD ]------------------------------------------
#

'ICON' => $icon,

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

#
#-----[ FIND ]------------------------------------------
#

{catrow.forumrow.LAST_POST}

#
#-----[ BEFORE, ADD ]------------------------------------------
#

<!-- BEGIN switch_icon -->
{catrow.forumrow.ICON}&nbsp;
<!-- END switch_icon -->
Man soll aufhören wenn´s am schönsten ist!

Servus phpBB! ;)
fanrpg
Mitglied
Beiträge: 2909
Registriert: 13.12.2004 22:41

Beitrag von fanrpg »

verlinke mal deine index.php bitte, danke :wink:
John Doe
Mitglied
Beiträge: 684
Registriert: 30.03.2005 01:06

Beitrag von John Doe »

wenn man den Block

Code: Alles auswählen

if($icon) 
{
$template->assign_block_vars('catrow.forumrow.switch_icon', array());
}
unter

Code: Alles auswählen

if($users_viewing)
							{
								$template->assign_block_vars('catrow.forumrow.switch_users_viewing', array());
							}
setzt und

noch nach

Code: Alles auswählen

'USERS_VIEWING' => $users_viewing,
ein

Code: Alles auswählen

'ICON' => $icon,
wird zwar alles nicht auseinandergerissen ,aber die Lücke ist immer noch da, wenn der Beitrag kein Icon hatte.

allerdings kommt die Lücke wohl schlicht durch die spacer.gif mit einer Breite von 20 die hier in der functions.php erzeugt wird.

Code: Alles auswählen

	switch ($empty)
		{
			case 0:
				$res = '';
				break;
			case 1:
				$res = '<img width="20" align="' . $align . '" src="' . $admin_path . $images['spacer'] . '" alt="" border="0">';
				break;
			case 2:
				$res = isset($lang[ $icones[$icon_map]['alt'] ]) ? $lang[ $icones[$icon_map]['alt'] ] : $icones[$icon_map]['alt'];
				break;
		}
Das bedeutet doch sobald ich auf das Icon in der index.php prüfe bekomme ich so zwangläufig immer mindestens den spacer.gif dahin ?

// grad getestet. Der Zwischenraum wird durch die functions.php erzeugt.
Benutzeravatar
ATARI
Mitglied
Beiträge: 1684
Registriert: 22.02.2004 16:51
Wohnort: Monaco Di Bavaria

Beitrag von ATARI »

@fanrpg: index.php & index_body.tpl


@John Doe: Irgendne Ahnung wie man den Spacer rausmachen kann?
Soweit ich das sehe ist ja für den ACP oder?
$res = '<img width="20" align="' . $align . '" src="' . $admin_path . $images['spacer'] . '" alt="" border="0">';
break;
case 2:
Man soll aufhören wenn´s am schönsten ist!

Servus phpBB! ;)
Antworten

Zurück zu „phpBB 2.0: Mods in Entwicklung“