vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Adding specific count of views (https://vborg.vbsupport.ru/showthread.php?t=73070)

okc 12-19-2004 05:19 AM

Adding specific count of views
 
Someone suggested I add the following code if I want to put the totalviews of a forum onto the forumdisplay page, instead of total posts.

SELECT SUM(views) FROM thread

I think I need a number value string (right?) - what do you suggest and where can I place it to generate the totalviews?

thx for your help -

okc 12-20-2004 12:02 AM

Anyone? thx

Colin F 12-20-2004 03:52 AM

well you'll want to limit that to a specific forum:
[sql]SELECT SUM(views) AS views FROM " . TABLE_PREFIX . "thread WHERE forumid = $forumid[/sql]

or, do it with something like GROUP BY forumid.

Now that I think about it, the second would be even better :)

okc 12-20-2004 04:49 AM

So

SELECT SUM(views) AS views FROM " . TABLE_PREFIX . "thread GROUP BY forumid = $forumid ???

& what table should I add it to in mysql?

Will it generate a number I can use in my boards -

thx!

Colin F 12-20-2004 03:09 PM

you could cache it in the datastore table...

that should generate a number, which you can call in your boards, but you'll have to fetch it from the database then...

okc 12-20-2004 04:30 PM

Thx - is this the correct GROUP BY string?

SELECT SUM(views) AS views FROM " . TABLE_PREFIX . "thread GROUP BY forumid = $forumid

& how do I call it back from the datastore? - it doesn't appear to have a name like $threadviews...

Colin F 12-20-2004 05:25 PM

no, just GROUP BY forumid

you'll have to add it to the datastore first

okc 12-20-2004 06:10 PM

Bear with me, Colin - sorry for the newbie questions -

So i can put the string into the data store, but how would I have it display within forumdisplay on my board - what do I ask for to get that value? i.e. $threadviews

Thx


All times are GMT. The time now is 04: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.00947 seconds
  • Memory Usage 1,714KB
  • 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)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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