The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Database work
Hi,
I'm new at creating a vB4 mod. I need to know, how I can work with the Database in templates. I have created a template, correctly with the forum Design. I want to read out the ucash field and an own Table. Can I do this with templates? I don't know how to create a php file, with the forum Design... Greetings, Andreas |
#2
|
|||
|
|||
Hi Andreas,
yeah the beginning is a difficult one thats for shure... 1 weeks ago i had the same problem, firstly i suggest you to read the following articles here on the board: Creating an own vbulletin site and getting in touch with the very few basics, but you will also see how it works with the template https://vborg.vbsupport.ru/showthread.php?t=228112 bascially if you want to show the website you can create a new template and put this code inside: Code:
{vb:stylevar htmldoctype} <html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html"> <head> <title>{vb:raw vboptions.bbtitle} - {vb:raw pagetitle}</title> {vb:raw headinclude} {vb:raw headinclude_bottom} </head> <body> {vb:raw header} {vb:raw navbar} <div id="pagetitle"> <h1>{vb:raw pagetitle}</h1> </div> <h2 class="blockhead">THIS IS AN EXTRA PART FOR YOU TO ECHO A HEADLINE</h2> <div class="blockbody"> <div class="blockrow"> YOU CAN WRITE HERE YOU MAIN TEXT, BUT YOU DONT HAVE TO USE IT </div> </div> {vb:raw footer} </body> </html> The next one you should propably read is this one: https://vborg.vbsupport.ru/showthread.php?t=231525 It will help you how conditionals work and read the red line, it is really important : ) After that, I suggest you to read: http://ragtek.org/blog/vbulletin/vbu...asse-benutzen/ if you cant understand german you can translate it on the right hand side, but actually your name sounds german anyway you should be a bit carefull in some cases "vB::$vbulletin->" doesnt work, what you can simply do is removing the "vB::" and having just "$vbulletin->etc...." In case you want to exclude some of your codes into another php file in the folder "/includes" you gotta use "global $vbulletin" otherwise you cant use those things in an external file and it would cause a blank site i hope that gave u a base to build up on.... keep asking and sometimes http://members.vbulletin.com/api/ also helps : ) all the best |
#3
|
|||
|
|||
Hi,
much thanks for the help! Yes, I'm german. So sorry for my bad english I made it like this way, yesterday: I added a custom Template, wich renders me the site in the forumdesign. Then I added an iframe to the template, in the area of the main site. So I can use my own php Page. I know php good enough to do all, I want. Only Problem is, I don't know how to create an ACP Menu ore how I can add Phrases to the php File. So all is hardcoded. This is ok for me, but I wanted to publish the AddOn (SMS send Service, with some Options for registered members, guests and to use ucash) at vbullrtin-germany.org. I think, hardcoding is bad for this... Greetings, Andy |
#4
|
|||
|
|||
Well, I am not that deep into that acp stuff as well, cant help you with that one.
But you dont have to put phrases in the php file ? - To be honest i am not certain about that, but it is enough to put them in the template therefor you could use {vbhrase phrasename} for a phrase which doesnt include html or you could that one {vb:rawphrase phrasename} the second one will allow you to use html in your phrase. btw: german as well, but fair play for the others, may it help somebody else on this english speaking board : ) |
#5
|
|||
|
|||
The Problem is, in my php file, I mixed some echo statements with php code. So I can't use phrases in the Template, I need them in PHP. Ore dit I understand it wrong?
Ok, when the AddOn is ready, I will publish it on both sides. Even here. Of course, for free. Some time ago, I searched for an AddOn like this, without much response. That's why I decidet to code it by myself, hoping that I learn fast. Somenody who knows a little bit of php/html, can use every SMS Gateway, wich provides a http gateway. I think, that is very useful. Even in connection with ucash, it can make the users more activ. |
#6
|
|||
|
|||
Do you have some example code ? And why do you have echos ? May you should replace echos with registering variables ?
|
#7
|
|||
|
|||
I don't know, how registering Variables work...
Some example Code: PHP Code:
|
#8
|
|||
|
|||
Here is a short guide how to register vars
https://vborg.vbsupport.ru/showthread.php?t=228078 this should help you. basically it looks like that all the time: PHP Code:
it has to have the name mytemplate, after that you can put anykind of html inside the code box, however, you could also use "my_var" as well as "my_array" in that template, because you were registering for that specific template those two vars... if you want to print for example "my_var" you simply write {vb:raw my_var} and with the array you could do it like this: {vb:raw my_array.key} (.key represents for example, id, titel, description or whatever else : ) my small explanation doesnt mean, that you should not read that article : ) have fun |
#9
|
|||
|
|||
Thanks, I'm really happy for your help!
I read the article tomorrow and then try a little bit around, even with your examples. Today, it is midnight, here in Germany. So I can concentrate better tomorrow. Rhank you very much! |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|