The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
array/database/template
For example I have a table with UserID, Points, Timestamp,open and I want to fetch it
PHP Code:
So if I fetch it via mysql_fetch_object how do I use that so I can create a list ? Normally I would just use a while and echo, but here I have to register the variables to the template... So how would I use this? thanks |
#2
|
||||
|
||||
It depends, how are you printing the template? There many ways to do it: you can register variables and print the template in the cycle and you will get printed the template with different values per each row. Or you can register an array to the template and then use the vb:each function in that template. See documentation about vb:each:https://www.vbulletin.com/docs/html/...mplates_syntax
|
#3
|
|||
|
|||
Do I need something extra to register a variable as array ?
Or just use mysql_fetch_array, register it with the templater and go ? |
#4
|
||||
|
||||
You can register it as you would register a variable, if you have any problems just let me now and please provide some codes so it's easier to help you
|
#5
|
||||
|
||||
Cellarius wrote a really good article that you may be interested in - [vB4] Rendering templates and registering variables - a short guide
|
#6
|
|||
|
|||
Found the problem
Was a very stupid typo on my side. Didn't think all that would be working that easy... if I really get this game running I'll mostly going to check how to make it into a real addon. edit: @Lynne thats quite handy too, but I did it this way which is far more userfriendly, at least for my coding type: http://www.vbulletin.com/forum/forum...hin-while-loop And I did it with mysql_fetch_object as I find it way easier to understand than the array way, which was just as last resort. Edit 2: How do I round numbers in the template? edit 3: Found out. nice you can stack those {vb:XX YY} stuff into oblivion... |
#7
|
||||
|
||||
Glad you got it working.
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|