The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Uncharacteristically newbish question from me...
Hey there everyone,
I'm an experienced PHP programmer who is just starting to delve into vB hacking. I've been picking apart the code and understand almost everything there is, except for the template system. I understand it's function and why things happen, but not quite how they happen. For example, I've been trying fruitlessly for the last 20 minutes to write a simple header/footer page with no content, and it just doesn't make sense to me. I'm sure that I'm just reading too hard into the problem, but I'm just vexed by everything, and I was wondering if someone could give me a little Templates 101 lesson? If someone could even write up the aforementioned header/footer page I'm sure that I could figure it out. I hate asking because it makes me sound so newbish, which I'm definately not (I'm actually the programming forum moderator at Somethingleet), but this is something that's just got me in a corner. I'm normally the one answering the questions, not asking them. I guess you've got to start somewhere! Thanks everyone for your help! Mystis |
#2
|
||||
|
||||
Hi.
are you trying to change the vbulletin footer/header? There is already a header and footer template for vbulletin, why not edit those to your needs? or are you trying to add a footer and header to a custom page? |
#3
|
|||
|
|||
..Styles
...Fonts/Colors/Etc Header, Footer ..Templates Header, Footer The variable for header and footer is $header $footer If you call the global file from a file you create and place it in the forum/ directory then it will place the header and footer into that page for you. |
#4
|
||||
|
||||
So this should automatically place the head and foot in the page? Because it most definately doesn't.
PHP Code:
PHP Code:
PHP Code:
|
#5
|
||||
|
||||
well this is just saying display the content in the template "footer", there's another one in vb (an eval) that is like gettemplate or something like that
eval("dooutput(\"".gettemplate('footer')."\");"); and this says, make the variable work in the current template eval("\$statstable .= \"".gettemplate('battle_statsbottom')."\";"); |
#6
|
||||
|
||||
Alright, I've struggled this far:
PHP Code:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>$bbtitle - Page Title</title> $headinclude </head> <body> $header <br /> $template_nav <br /><br /> $footer </body> </html> |
#7
|
||||
|
||||
If you include global.php there is no need to call the header and footer templates...
You can just call the template you need for your page and obviously create it and then stick $header and $footer in the template when you want them Remember when calling a template in a file if it's being called all the time then add a $templatesused variable which includes the names of the templates called in the file - miSt |
#8
|
||||
|
||||
The template system is a powerful dynamic/expandable type system. It's main power comes from the 'eval()'.
Say you have a little template titled "twoPlusTwo", and it contained : Code:
<table cellpadding="0" cellspacing="0" border="0"> <td align="left" valign="center">2 + 2 = $calc_result</td> </table> PHP Code:
The 'gettemplate()' function returns the contents of 'twoPlusTwo', into the string type variable we've named 'twoPlusTwo', at the start of the 'eval()'. You notice the contents of the template has the bit '$calc_result'.... well, because you've put a value into that variable name, the getting the template in this way, puts your value into the template (your value gets expanded, and your dynamic string is created). It's just like doing this : PHP Code:
With this system, you use the gettemplate() function to retrieve all your little bits of the webpage - they are smaller chunks for easier managment, and for giving you more scope. Once you've retrieved all of your templates into string variables, and the data inside has been expanded, you are then ready for output. This is where you need an over-all page layout template. Like this, called 'testPage', for example : Code:
<html> <head> <title>Test</title> </head> <body bgcolor="#ffffff" text="#000000"> This is our example of how the vB template system works. <p> $twoPlusTwo </html> What you then do, once all your page templates are generated in the above way, is make a call to the 'dooutput()' function, like this : PHP Code:
As you now have all your dynamically created templates inside the computer memory, all your variables get expanded in the dooutput() function, and then the dooutput() function simply uses the "echo" to echo the whole job lot out to the browser. It's very powerful, very simple, very very good. I'm not a great teacher... so hopfully i've helped. aranoid: That's how the system works anyway, and you can use it in any way you see fit. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|