![]() |
Need help with product coding
I'm creating a vb product and having this scenario which i don't know how to do it.
In the product there is two textbox options that the administrator can alter their values. The first box got a values like 3,4,7,...,100 and the second can take any integer number like 2. A variable x in the product should start with the first number in the first textbox which is 3. The second textbox represent a time in hours where each time the system time elapsed that time the variable x will jump to the next value of the first textbox which is 4 in the example above and so on until it reaches 100 then it will get back to value 3. regards, |
You need to create a scheduled task that runs once an hour then use some PHP along the lines of:
PHP Code:
|
Thanks Opserty for your reply but the problem I don't know how to
create a scheduled task for the plugin or product?:o I tried to search the forum to see how but to many posts to find what i need. |
Admin CP > Scheduled Task > Add New Task?
|
Quote:
But I don't get it! this is ok for my forum but how to distribute the corn with the product files to be used by other vb forums. Also what is the line in code to check if number of hours had elapsed in the corn php file something like if((timenow-lasttimesaved)>numberofhours){ lasttimesaved=timenow; do something... } Thanks for your time |
Have you turned on debug mode, attached the task to your product, and export the product like that?
|
Ok I got this task working but how to read a variable like $curval in the product templates? It always returns null!
|
PHP Code:
Then run build_options(). Then you should be able to read curval from $vbulletin->options array. Bear in mind this is just a rough guide to the procedure to follow, it is by no means a work example. You will need to refine it appropriately. |
Quote:
|
Anybody has any clue on how to solve this issue? Hint , example...
|
You need to do a query to the database to update the setting in the setting table. You will need to this through PHP, if you don't know PHP or MySQL I suggest you learn and understand what is going on before proceeding with your product.
Check the "Articles" section for more information on these subjects. |
Not only check the Articles section, but on Google for PHP tutorials, as they will provide more information on PHP/MySQL.
|
Quote:
Quote:
I know php and mysql coding and i've build many products before but this is the first that i need cron to be used in a product. I'am just confused about what the meaning of "RUN A QUERY TO UPDATE SETTINGS TABLE". As is this settings table already exist as a part of vbulliten or i have to create? What is its name exactly? Also do i have to create a field in that table for each of the variables i want to pass its value to the template? Sorry if it is still not clear what i want to do, but this is my best in english. Regards, |
All times are GMT. The time now is 11:49 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|