Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-11-2003, 06:59 PM
filth_?_boy filth_?_boy is offline
 
Join Date: Feb 2003
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default how do i do this?[php table change]

first, sorry is this is in the wrong forum...

i want to display the progress of a fundraise from donations for a forum.

i've been searching but i don't know what i should be searching for.

so far i've found this

http://www.evolt.org/help_support_evolt/index.html

thats exactly the effect i'm looking for(top left). if someone could explain how its done?

ideally I want to have a form in the admin protected section of vbulletin where we can enter our total needed and achieved thus far. then it displays like evolt.org on the /index.php.

some idea of how its done or what kind of script i can use will help.

cheers
Reply With Quote
  #2  
Old 02-11-2003, 07:59 PM
Bane's Avatar
Bane Bane is offline
 
Join Date: Oct 2001
Posts: 411
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you could just do something like finding the percentage then using a second table inside with a different colored background and do

<table><tr>
<td width=".$percent." bgcolor="green"> </td>
<td bgcolor="red"></td>
</tr><table>

smoething to that effect.
Reply With Quote
  #3  
Old 02-11-2003, 08:04 PM
Bane's Avatar
Bane Bane is offline
 
Join Date: Oct 2001
Posts: 411
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
$value1="";
$value2="";
$percent = ($value1 $value2) * 100;
$percent round($percent)."%";

echo (
"<table><tr>");
echo (
"  <td width=\"".$percent."\" bgcolor=\"green\"> </td>");
if (
$percent!="100") { echo("<td bgcolor=\"red\"></td>"); }
echo (
"</tr><table>"); 
would something like that work for you?
Reply With Quote
  #4  
Old 02-11-2003, 09:46 PM
filth_?_boy filth_?_boy is offline
 
Join Date: Feb 2003
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

that looks good thanks.

how can i store the values?
Reply With Quote
  #5  
Old 02-11-2003, 10:17 PM
Bane's Avatar
Bane Bane is offline
 
Join Date: Oct 2001
Posts: 411
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thats a little more difficult if you want it intergrated with vb, if you dont mind waiting till Im done with my current project I can make a hack out of this, till then you could just use

$value1="189"; // Amount Recieved
$value2="1000"; // Amount We Need

assuming you have earned $189 of the $1000 you need.
Reply With Quote
  #6  
Old 02-11-2003, 10:24 PM
filth_?_boy filth_?_boy is offline
 
Join Date: Feb 2003
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

no i don't need it integrated. I can put that php you made me into the header i would like a

value.cfg file or something the admin could edit and upload to the webroot.

i don't know how to make the values come from another file.

thanks for your help already has made it seem easier though
Reply With Quote
  #7  
Old 02-11-2003, 10:53 PM
Bane's Avatar
Bane Bane is offline
 
Join Date: Oct 2001
Posts: 411
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

include("../value.php");

then put the values in value.php
Reply With Quote
  #8  
Old 02-11-2003, 10:57 PM
filth_?_boy filth_?_boy is offline
 
Join Date: Feb 2003
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks i'll tinker with this tomorrow after some sleep.

cheers
Reply With Quote
  #9  
Old 02-12-2003, 11:08 PM
filth_?_boy filth_?_boy is offline
 
Join Date: Feb 2003
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hmm i'm not good at this. i can't even make the script start to work. i should say i know nothing about php i'm just fiddling trying to make it work.

i've got my value.php file in the same dir. inside this file i only have
$value1="682"; // Amount Recieved
$value2="1400"; // Amount We Need

now i'm trying to use the php you made me print this html, changing the $ from the values in the include file and altering the size of the table to reflect the donations..
Code:
<table width="337" height="52" bgcolor="black" align="center">
  <tr> 
    <td height="26" colspan="2">
      <img src="images/donation.gif" width="337" height="26">
    </td>
  </tr>
  <tr height="26"> 
    <td width="65%" bgcolor="#FF0000">
      <p align="right">$648 received </p>
    </td>
    <td>
      <p align="right"><font color="red">$880 needed</font></p>
    </td>
  </tr>
</table>
when i put your code into a file eg.
PHP Code:
<?php
include("value.php");
$percent = ($value1 $value2) * 100;
$percent round($percent)."%";
echo (
"<table><tr>");
echo (
"  <td width=\"".$percent."\" bgcolor=\"green\"> </td>");
if (
$percent!="100") { echo("<td bgcolor=\"red\"></td>"); }
echo (
"</tr><table>");
?>
i get
Quote:
$value1="682"; // Amount Recieved $value2="1400"; // Amount We Need
Warning: Division by zero in e:\foxserv\www\2try.php on line 3
i hope its a silly mistake i'm making, i just put the <?php around the whole thing..

thanks for any pointers you can give me...
Reply With Quote
  #10  
Old 02-13-2003, 05:53 AM
Bane's Avatar
Bane Bane is offline
 
Join Date: Oct 2001
Posts: 411
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

First File table.php:
PHP Code:
<?php
include("value.php");
$percent = ($value1 $value2) * 100;
$percent round($percent)."%";

echo (
"<table width=\"150\" border=\"0\"><tr>");
echo (
"  <td width=\"".$percent."\" bgcolor=\"green\" height=\"10\">".$value1." </td>");
if (
$percent!="100") { echo("<td bgcolor=\"red\" align=\"right\">".$value2."</td>"); }
echo (
"</tr><table>");
echo (
"<br /><br />".$value1."/".$value2);
?>

Second File value.php:
PHP Code:
<?php

$value1
="682";
$value2="1400";

?>
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:43 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.08099 seconds
  • Memory Usage 2,268KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (4)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete