Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Building Forums With vBulletin (2006).pdf
Скачиваний:
42
Добавлен:
17.08.2013
Размер:
6.3 Mб
Скачать

Chapter 4

Template Structure

Let's take a quick look at the structure of the FORUMHOME template before we go on to make some changes to it.

Right at the top of the template is the beginning of the HTML code for the actual page displayed in the browser.

$stylevar[htmldoctype]

<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]"> <head>

<!-- no cache headers -->

<meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Expires" content="-1" />

<meta http-equiv="Cache-Control" content="no-cache" /> <!-- end no cache headers -->

<title><phrase 1="$vboptions[bbtitle]">$vbphrase [x_powered_by_vbulletin]</phrase></title>

$headinclude </head>

There are a number of vBulletin variables in this small section of code. Variables can be easily spotted because they are all prefixed with the $ character. Some of these variables refer to phrases that we looked at earlier while others control the running for the forum. For example,

$vbphrase[x_powered_by_vbulletin] refers to a phrase in vBulletin—this is the phrase that adds the—powered by vBulletin to the menu bar of the browser, while the $vboptions[bbtitle] variable extracts the forum title from the vBulletin options settings and displays it. Both of these are shown below. All the templates follow this format—HTML combined with vBulletin-specific variables.

The other variables, such as $stylevar[htmldoctype] and $stylevar[languagecode], control

settings outputted to the HTML header, shown below:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html dir="ltr" lang="en">

<head>

<!-- no cache headers -->

<meta http-equiv="Pragma" content="no-cache" />

..<meta http-equiv="Expires" content="-1" />

..<meta http-equiv="Cache-Control" content="no-cache" />

..<!-- end no cache headers -->

..<title>The Example Forums Forum - powered by vBulletin</title>

..<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <meta name="generator" content="vBulletin 3.5.2" />

<meta name="keywords" content="vbulletin,forum,bbs,discussion,jelsoft,bulletinboard" />

<meta name="description" content="This is a discussion forum powered by vBulletin. To find out about vBulletin, go to http://www.vbulletin.com/ ." />

These settings are stored and edited through the vBulletin Style Manager.

Further along in the code, you will find other variables, and you might be able to guess at what some of them do—for example, $navbar. The code that controls the display of the navbar is stored in a separate template, which is inserted into the main page. This allows different parts of the forum to be stored (and edited) separately. Because the navbar is used extensively in vBulletin discussion boards, it makes sense to store that code in one place—this results in less code overall

103