vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Hook for vb 3 (https://vborg.vbsupport.ru/showthread.php?t=233735)

alnassrah 01-21-2010 01:04 PM

Hook for vb 3
 
Hello

Can you modify this hook to suit the vb 4

PHP Code:

$getviewstoday=$db->query_first("SELECT SUM(views) AS threadviews FROM thread WHERE dateline>='$vbs_today'"); 

$viewstoday=number_format($getviewstoday['threadviews']); 

Please help me

Thanks

Lynne 01-21-2010 01:39 PM

Most likely there is nothing wrong with that code (I see nothing wrong with it). It's just php and php is not different for vB4.

If you are changing templates/plugins for vB4, Cellarius wrote a really good article that you may be interested in - [vB4] Rendering templates and registering variables - a short guide

alnassrah 01-21-2010 03:19 PM

Added a hook in the forumhome_complete

And inside this code

PHP Code:

$getviewstoday=$db->query_first("SELECT SUM(views) AS threadviews FROM thread WHERE dateline>='$vbs_today'");  

$viewstoday=number_format($getviewstoday['threadviews']); 

I have added a phrase viewstoday

Went to the template FORUMHOME

I added this

PHP Code:

<dt>{vb:rawphrase viewstoday}</dt
><dd>{vb:raw viewstoday,}</dd

But does not count the number of visitors

Can you help me ?

Lynne 01-21-2010 04:51 PM

You haven't registered the variable for use in the template. Did you read that article I posted a link to for you? It explains about registering variables for vB4.


All times are GMT. The time now is 08:36 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.00934 seconds
  • Memory Usage 1,722KB
  • 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
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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