PDA

View Full Version : Help with Forum Icon Hack


patvdv
01-27-2002, 12:43 PM
Hi,

I am trying to setup a hack that would display an icon in front of each forum title/description (see attachment). The hack is a modification from Firefly's Category sponsoring (https://vborg.vbsupport.ru/showthread.php?s=&threadid=26818) hack and I managed to do the template and MySQL part of things. However I am having problems with modifying the code in index.php. This is what I have now:

if ($forum['forumimg'] && $forum['cancontainthreads']==1 && $depth==2) {
eval("\$forumbits .= \"".gettemplate("forumhome_forumbit_level2_post_image")."\";");
} else {
eval("\$forumbits .= \"".gettemplate("forumhome_forumbit_level$depth$tempext")."\";");
}
However with this code, all my forums show up twice, so I assume somewhere the forumhome_forumbit_level2_post template is evaluated twice. The forumhome_forumbit_level2_post_image is the customized template that would show the icon.

I can't figure out how to undo the double-up on my forums. Any help much appreciated!

Admin
01-27-2002, 12:52 PM
Where are you placing that code?

patvdv
01-27-2002, 12:57 PM
Hi FireFly,

I put the code right under the code from your sponsoring hack.

Admin
01-27-2002, 12:59 PM
Can you please post the whole block of that code, plus 5-10 lines above and below? :)

patvdv
01-27-2002, 01:01 PM
There you go:


if ( !isset($forum['moderators']) ) {
$forum['moderators'] = ' ';
}

if ($forum['cancontainthreads']==1) {
$tempext = '_post';
} else {
$tempext = '_nopost';
}

// Category sponsoring hack
if ($forum['sponsorimg'] && $forum['cancontainthreads']==0 && $depth==1) {
eval("\$forumbits .= \"".gettemplate("forumhome_forumbit_level1_nopost_sponsor")."\";");
} else {
eval("\$forumbits .= \"".gettemplate("forumhome_forumbit_level$depth$tempext")."\";");
}
// Category sponsoring hack

if ($forum['forumimg'] && $forum['cancontainthreads']==1 && $depth==2) {
eval("\$forumbits .= \"".gettemplate("forumhome_forumbit_level2_post_image")."\";");
} else {
eval("\$forumbits .= \"".gettemplate("forumhome_forumbit_level$depth$tempext")."\";");
}

if ($depth<$forumhomedepth) {
$forumbits.=makeforumbit($forum['forumid'],$depth+1,$forumperms);
}
} // END if can view
} // END while ( list($key2,$forum)=each($val1) ) {
} // END while ( list($key1,$val1)=each($iforumcache["$forumid"]) ) {

unset($iforumcache["$forumid"]);

Admin
01-27-2002, 01:19 PM
if ( !isset($forum['moderators']) ) {
$forum['moderators'] = '&nbsp;';
}

if ($forum['cancontainthreads']==1) {
$tempext = '_post';
} else {
$tempext = '_nopost';
}

// Category sponsoring hack
if ($forum['sponsorimg'] && $forum['cancontainthreads']==0 && $depth==1) {
eval("\$forumbits .= \"".gettemplate("forumhome_forumbit_level1_nopost_sponsor")."\";");
} elseif ($forum['forumimg'] && $forum['cancontainthreads']==1 && $depth==2) {
eval("\$forumbits .= \"".gettemplate("forumhome_forumbit_level2_post_image")."\";");
} else {
eval("\$forumbits .= \"".gettemplate("forumhome_forumbit_level$depth$tempext")."\";");
}
// Category sponsoring hack

if ($depth<$forumhomedepth) {
$forumbits.=makeforumbit($forum['forumid'],$depth+1,$forumperms);
}
} // END if can view
} // END while ( list($key2,$forum)=each($val1) ) {
} // END while ( list($key1,$val1)=each($iforumcache["$forumid"]) ) {

unset($iforumcache["$forumid"]);

patvdv
01-27-2002, 01:30 PM
Bingo! That works like a charm. I now also understand where the double evaluation comes from :) Thanks Firefly!

Do you reckon this is worth putting up as an official hack?

Admin
01-27-2002, 01:53 PM
Up to you. :)

patvdv
01-27-2002, 02:05 PM
Might do. Just trying to elaborate on the hack: would it be possible to have the icon also show up on the 2nd level forum display? I assume this would mean to make a custom template for forumdisplay_forumbit_level2_post but I don't know what PHP code to put in?