vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin Tips & Tricks (https://vborg.vbsupport.ru/forumdisplay.php?f=239)
-   -   Perform simple calculations inside templates! (https://vborg.vbsupport.ru/showthread.php?t=188930)

Lea Verou 07-14-2009 11:01 PM

Quote:

Originally Posted by L2V (Post 1848852)
Anyone know what kinds of simple calculations can be done using this method?

Anything that doesn't involve functions or the functions involved are allowed within templates.

xlguy 08-13-2009 02:18 PM

Thanks for sharing.

Could you do a multiplication? So

$newfigure = $oldfigure + $oldfigure * 0.15

Any idea?

Lea Verou 08-13-2009 02:27 PM

Yes you can.

xlguy 08-13-2009 02:33 PM

Thanks, sorry I should have been a bit clearer, what would the syntax be? :)

Lea Verou 08-13-2009 04:58 PM

Code:

<if condition="$newfigure = $oldfigure + $oldfigure * 0.15"></if>
And after that, use $newfigure normally in your template

TimberFloorAu 09-03-2009 04:58 AM

What would be the format for:

Displaying the cumulative count of all a users posts ?

so if they have 5 threads.

thread a has 23 views
thread b has 34 views
thread 3 has 26 views

so on and so on...

and create code to echo the total of those views a+b+c etc

Lea Verou 09-03-2009 06:04 AM

If I understood what you're trying to do correctly, that's not possible in the templates alone.

TimberFloorAu 09-03-2009 09:50 PM

Ok thanks, back to the drawing board.

Dax IX 10-21-2009 05:36 PM

This is a great tip! I've already found a couple of uses for it. :)


All times are GMT. The time now is 08:35 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.00940 seconds
  • Memory Usage 1,728KB
  • 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
  • (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
  • (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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete