vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Help with Forum Icon Hack (https://vborg.vbsupport.ru/showthread.php?t=34532)

patvdv 01-27-2002 12:43 PM

1 Attachment(s)
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 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:

PHP Code:

        if ($forum['forumimg'] && $forum['cancontainthreads']==&& $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:

PHP Code:

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

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

        
// Category sponsoring hack
        
if ($forum['sponsorimg'] && $forum['cancontainthreads']==&& $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']==&& $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

Code:

        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")."\";");
        } else[high]if ($forum['forumimg'] && $forum['cancontainthreads']==1 && $depth==2) {
          eval("\$forumbits .= \"".gettemplate("forumhome_forumbit_level2_post_image")."\";");
        } else[/high] {
          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?


All times are GMT. The time now is 11:42 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01266 seconds
  • Memory Usage 1,751KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete