vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   How to work out a formula from custom fields and display in postbit (https://vborg.vbsupport.ru/showthread.php?t=161442)

Spank 10-29-2007 08:49 PM

How to work out a formula from custom fields and display in postbit
 
Hi, I'm wondering if anyone knows how to do a formula from the vales of certain custome profile fields and display it in the post bit.

I know
Code:

$post[fieldx]
will display the vale of the filed in the post bit. What I need to do is field7 (divided by) field6 (muliply by) 100 and display the result in the post bit.

Is this even possible?

Thanks :)

Paul M 10-29-2007 08:56 PM

You will need to do the calculation in a plugin.

Spank 10-29-2007 08:58 PM

Any idea how this is done? I'm a n00b at this sort of thing lol

Opserty 10-29-2007 09:02 PM

You can't do it in a template unless you figure a way to make it work in the if conditional, but its not supposed to be there :p

Best bet would be to make a plugin in one of the postbit hooks, postbit_display_complete? I think or something, can't remember off the top of my head.

EDIT: Whoops forgot to refresh.

You can try maybe:
PHP Code:

$percentage = (intval($post['field7']) / intval($post['field6'])) * 100


Spank 10-30-2007 08:38 AM

Is anyone able to help with this? :)

Dilmah 10-31-2007 01:32 PM

They did?

Spank 11-01-2007 01:28 AM

They did what?

Dilmah 11-01-2007 03:57 AM

Help. If you are still having problems, you need to post what they are.

We can't help unless we know what problems you are having.

Spank 11-01-2007 06:56 AM

Well the whole thing, I have no idea how to create a plugin or how the formula should be layed out, and thern getting it to display on the postbit.

Analogpoint 11-01-2007 07:03 AM

Create a plugin on the postbit_display_start hook and add the code posted by Opserty:

Code:

$percentage = (intval($post['field7']) / intval($post['field6'])) * 100;
Then edit your postbit template and insert $percentage where you want it displayed.


All times are GMT. The time now is 06:49 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.01045 seconds
  • Memory Usage 1,725KB
  • 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_code_printable
  • (1)bbcode_php_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