The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Creating a simple hit counter?
Hi all i have created a new database called mycounter and then created a plugin like this
Product : VBulletin Hook Location :Global_Start Title: Hit Counter Execution Order : 5 Plugin PHP Code : PHP Code:
PHP Code:
|
#2
|
||||
|
||||
You cannot use template conditionals in plugins. You need to use PHP code in plugins.
PHP Code:
|
#3
|
||||
|
||||
Thanks for the code but the counter still doesn't show anything when using the code you supplied, it will only show a figure if i use
PHP Code:
|
#4
|
||||
|
||||
PHP Code:
|
#5
|
||||
|
||||
Thanks, thats it!, seems to work well!
--------------- Added [DATE]1232394416[/DATE] at [TIME]1232394416[/TIME] --------------- The counter is working, but it seems too well, it seems that its counting every members hit on every page. is it possible to just lock it down to my custome page? |
#6
|
||||
|
||||
when you run it in a template use the this but warn you that you must define the script in the top of the custom pages template.
<if condition="THIS_SCRIPT == 'my_custom_page'"> <!-- execute this code --> <!-- /execute this code --> </if> That should work so it only displays it on that page and I`m sure you can pass that definition to your php code so it only respnds to hits on that page and with the conditional above it only displays that info on that page if you add it to lets say the footer no need for a custom template. I would use if (THIS_SCRIPT == 'mycustom_page') { //start code //end code } I wouldnt use an else unless you really need the option. Hope it helps you. |
#7
|
||||
|
||||
No need to use any template conditionals. (The HTML is only put in the custom template.) Just change the plugin.
PHP Code:
|
#8
|
||||
|
||||
Thanks again, but i couldn't get it to work!, my php script is helpvideos.php and my custom template is helpvids.
Thanks for continuing support for this. EDIT: As i said i am no coder, i tried helpvideos.php and helpvids in place of your script. |
#9
|
||||
|
||||
At the top of "helpvideos.php" there should be something like:
PHP Code:
|
#10
|
||||
|
||||
Dismounted, you definitely know what you're doing! your changes to the code worked, i had the script defined as helpvideos, used that and the counter is showing again, so i have reset it to zero and will post back.....thanks very much!!!!
--------------- Added [DATE]1232535496[/DATE] at [TIME]1232535496[/TIME] --------------- UPDATE: Yep, that seems to work perfect, i logged out and accessed the custom page several times, i was shown the hit counter but no figures, then logged back in, clicked the page and the counter figures were seen and incremented. 1 question, can i use the IF condition you posted in my script around the counter stuff to prevent non members even seeing the counter box? |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|