vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Inserting a counter... (https://vborg.vbsupport.ru/showthread.php?t=56095)

Ksilebo 08-11-2003 02:06 AM

Inserting a counter...
 
I'm trying to insert a counter somewhere within my board, but cant figure out the best place to do it.

Basically, its a single line that calls a count.php file...

PHP Code:

<?
### IMAGE FORMAT
$format = ".png";

#######################################
## (C) 2000 Total Eclipse Scripts
#
### This script is free for personal
### or commercial use.
#
#   problems? [email]scripts@tescripts.net[/email]
#######################################

$file = file("count.txt");
$num = ($file[0] + 1);
exec("echo $num > count.txt");
switch($type) {
 case "text":
  echo $num;
  break;
 case "gfx":
  $i = 0;
  $cntn = strlen($num);
  while($i < $cntn) {
   $tmpnum = substr($num, $i, 1);
   echo("<img src=\"$dir/$tmpnum$format\">");
   $i++;
  }
  break;
 case "q":
 break;
 default:
 echo("count.php <b>error</b> : type not specified.");
 break;
}
?>

And the little line of code that should spit out an image is this...

PHP Code:

$type "gfx"$dir "counter"; include("count.php"); 

Where should I put this? I tried a few things, but couldnt get it right.

noppid 08-12-2003 05:16 PM

Count.txt needs to be in a writable folder most likely.

Ksilebo 08-12-2003 05:20 PM

Its writeable, but thats not the issue.

The issue is where/what file to put the code in. count.php is seperate, but where to put the include() for it.

noppid 08-13-2003 12:45 PM

Assuming you want the counter to fire on hits to forum_home put it in the index.php. I'd put it just before the very last eval at the bottom of the file myself.

Ksilebo 08-13-2003 12:48 PM

My index just becomes a blank page.

noppid 08-13-2003 01:19 PM

Now that I look at the code, I see a few issues that seem to be show stoppers. The switch statement uses $type, but $type is not set.

The output would need to be intergrated into a template to display.

Ksilebo 08-13-2003 05:20 PM

How exactly do I do that?


All times are GMT. The time now is 08:17 PM.

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.01119 seconds
  • Memory Usage 1,721KB
  • 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
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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