The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#21
|
|||
|
|||
Quote:
Not to criticize the other guys who are being helpful, but I didn't want to rewrite all your code for you because you didn't ask. But one thing I think I would do is change the function so it only gets the array once and saves it in a static or a global variable. That way at least you aren't getting it from a remote server once for each post. Edit : BTW, there's also a function that swaps keys and values, but I can't remember what that one's called either. |
#23
|
||||
|
||||
Quote:
Another thing to think about is what happens if the server you're fetching from is down? Well so will your "plugin" |
Благодарность от: | ||
ozzy47 |
#24
|
||||
|
||||
Yup, that is why I suggested getting the info in a cron.
|
#25
|
||||
|
||||
Do I simply need to define a global variable in the cron itself and save it?
|
#26
|
|||
|
|||
If you can get it into the form of a php array you could serialize it and store it in datastore. Is it available as such an array? I could get some code for storing in datastore.
Also, did you see my post in the country flags thread? I have small flags for all countries. Not sure how up to date it is though |
#27
|
||||
|
||||
I was able to get a set that matches the list pretty well. I can get the array and serialize it yes.
|
#28
|
|||
|
|||
To store in datastore
Code:
require_once(DIR . '/includes/functions.php'); build_datastore('countries', serialize($countries), 1); You need a plugin in "init_startup" Code:
if(THIS_SCRIPT == 'showthread') // or whatever file reads the array { $datastore_fetch[] = "'countries'"; } --------------- Added [DATE]1417752544[/DATE] at [TIME]1417752544[/TIME] --------------- Quote:
http://www.w3schools.com/php/func_array_flip.asp |
Благодарность от: | ||
KGodel |
#29
|
||||
|
||||
I decided to save the codes to a DB where I can add/edit as I please. Is there a way to get them as you did in the init_startup without using datastore, or by using datastore some other way? Right now I have:
PHP Code:
|
#30
|
|||
|
|||
Well, I think init_startup is as good a place to run your SELECT query as any (provided it's not too early, before the connection to the database is created), but showthread_start would work too. Theoretically you can edit the contents of datastore but it's stored as a compressed blob that's hard to read.
As for your flag images have you considered a country flag sprite? I'm working on converting a project to use sprites instead of images. There are several such sprites open source to download. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|