vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   how do i do this?[php table change] (https://vborg.vbsupport.ru/showthread.php?t=48810)

filth_?_boy 02-11-2003 06:59 PM

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

Bane 02-11-2003 07:59 PM

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.

Bane 02-11-2003 08:04 PM

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?

filth_?_boy 02-11-2003 09:46 PM

that looks good thanks.

how can i store the values?

Bane 02-11-2003 10:17 PM

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.

filth_?_boy 02-11-2003 10:24 PM

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

Bane 02-11-2003 10:53 PM

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

then put the values in value.php

filth_?_boy 02-11-2003 10:57 PM

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

cheers

filth_?_boy 02-12-2003 11:08 PM

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...

Bane 02-13-2003 05:53 AM

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";

?>



All times are GMT. The time now is 04:23 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.02561 seconds
  • Memory Usage 1,753KB
  • 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
  • (4)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete