Hướng dẫn tạo 1 page cho vbb từ mẫu có sẵn

  • Thread starter Thread starter AdminAdmin is verified member.
  • Start date Start date
Admin

AdminAdmin is verified member.

Well-Known Member
Staff member
Administrator
Nhân tiện làm luôn cái Ví Dụ "Tra cứu Điểm thi Đại Học, Cao đẳng" luôn cho các bạn dễ nhìn

Bước 1: Tạo 1 file PHP có nội dung sau, Save lại Upload lên thư mục gốc của forum:
<?php

// ####################### SET PHP ENVIRONMENT ###########################

error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################

define('THIS_SCRIPT', 'test');

define('CSRF_PROTECTION', true);

// change this depending on your filename

// ################### PRE-CACHE TEMPLATES AND DATA ######################

// get special phrase groups

$phrasegroups = array();

// get special data templates from the datastore

$specialtemplates = array();

// pre-cache templates used by all actions

$globaltemplates = array('TRACUU',

);

// pre-cache templates used by specific actions

$actiontemplates = array();

// ######################### REQUIRE BACK-END ############################

// if your page is outside of your normal vb forums directory, you should change directories by uncommenting the next line

// chdir ('/path/to/your/forums');

require_once('./global.php');

// ################################################## #####################

// ######################## START MAIN SCRIPT ############################

// ################################################## #####################

$navbits = construct_navbits(array('' => ''));

$navbar = render_navbar_template($navbits);

// ###### YOUR CUSTOM CODE GOES HERE #####

$pagetitle = 'Tra cứu điểm thi Đại học, Cao đẳng 2012';

// ###### NOW YOUR TEMPLATE IS BEING RENDERED ######

$templater = vB_Template::create('TRACUU');

$templater->register_page_templates();

$templater->register('navbar', $navbar);

$templater->register('pagetitle', $pagetitle);

print_output($templater->render());
?>
Chú ý: bạn cần lưu ý 2 dòng này:
$globaltemplates = array('TRACUU',
$templater = vB_Template::create('TRACUU');
Bạn sữa thông tin này cho phù hợp:
$pagetitle = 'Tra cứu điểm thi Đại học, Cao đẳng 2012';

Bước 2: Vào vBulletin Admin Control Panel -> Styles & Templates -> Style Manager -> Chọn Add New Template (của Skin đang sử dụng), dán đoạn Code sau vào và save lại với tên cần lưu ý ở Bước 1, đó là TRACUU. (Phân biệt chữ hoa, thường)
{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} - Tra cứu điểm thi Đại học, Cao đẳng 2012</title>
{vb:raw headinclude}
</head>
<body>

{vb:raw header}

{vb:raw navbar}

<h2 class="blockhead">Tra cứu điểm thi Đại học, Cao đẳng 2012</h2>
<div class="blockbody" style="background: #E7E4DC;">
<div style="padding:2px 0px 0px 0px; margin: 0 auto;">
<iframe src="http://diemthidh.net/tra-diem-thi/" frameborder="0" style="background: #E7E4DC; width:100%;height:500px;overflow:auto;">
</iframe>
</div>
</div>

{vb:raw footer}
</body>
</html>

Vậy là xong, demo: forumit.vn/diendan/tql_tracuu.php
 

Facebook Comments

Similar threads

cuongpro9x
Replies
3
Views
2K
AdminAdmin is verified member.
Admin
Admin
Replies
0
Views
764
AdminAdmin is verified member.
Admin
Admin
Replies
1
Views
861
Kenhtai.net
K
Admin
Replies
2
Views
3K
thahtrung06
T
Admin
Replies
0
Views
10K
AdminAdmin is verified member.
Admin
Back
Top