vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   How to create your own vBulletin-powered page! (uses vB templates) (https://vborg.vbsupport.ru/showthread.php?t=62164)

amcd 07-06-2009 04:27 AM

Yes, if that is what you want to show. The html (design and fixed data) part of the form can be put directly into the template, and any dynamic data can be displayed through variables set in the php code.

The basic purpose of templating (whether vbulletin or otherwise) is to separate the front end design from the business logic. The template holds just enough code (actually html with conditionals, not programming code) to show whatever needs to be shown. The template is simply 'shown', and that is why you cannot have php code in there.

The vbulletin manual has a section on templates, and reading the default vb templates can be very instructive for newcomers.

--------------- Added [DATE]1246858288[/DATE] at [TIME]1246858288[/TIME] ---------------

This will work:

php:
Code:

$htmlform = "<form>........</form>"
template:
Code:

$header
$navbar
$htmlform
$footer

But that is not how it is intended to be. You are not supposed to write any HTML at all in the PHP. Otherwise the whole purpose of templating is defeated.

pspmodandcfw 07-07-2009 06:34 AM

Thanks AMCD i finally got it to work.

Davidx3 07-08-2009 02:31 PM

Sorry, but this makes no sence at all to me

anyone care to explain it in more detail for me?

Sorry Gary, i just dont find your instructions very clear at all :S

Lynne 07-08-2009 03:02 PM

Quote:

Originally Posted by Davidx3 (Post 1845129)
Sorry, but this makes no sence at all to me

anyone care to explain it in more detail for me?

Sorry Gary, i just dont find your instructions very clear at all :S

It is explained as well as it can be. The best thing to do is just copy exactly what he did and then analyze it yourself after you get it up and working. If you need further help, the best thing to do is to create your own thread in the main forums and post the exact php file you wrote and the exact template you wrote (both using the php/html tags).

ilrglen 07-12-2009 05:07 PM

Okay, I accidentally deleted my test file that I finally got working and really can't spend another week reading through all 76 pages of this topic, fun as that was the first time, to find the answer to this simple question. What do I change in this code to make this page viewable by nonmembers?

Quote:

<?php

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'TEST'); // 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(
'TEST',
);

// pre-cache templates used by specific actions
$actiontemplates = array(

);

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
if (!$vbulletin->userinfo['userid']) print_no_permission();

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

$navbits = array();
$navbits[$parent] = 'Test Page';

$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('TEST') . '");');

?>
If somebody could change the code for me in the above quoted code and highlight the change in a different color that would make my day. Thanks.

cellarius 07-12-2009 06:40 PM

Remove
Code:

if (!$vbulletin->userinfo['userid']) print_no_permission();
And please, next time when posting code, use the code tags. They are there for a reason ;)

ilrglen 07-13-2009 01:26 AM

Sorry, I couldn't figure out those tags. And thanks for the help. Much appreciated.

Quote:

Originally Posted by cellarius (Post 1847592)
Remove
Code:

if (!$vbulletin->userinfo['userid']) print_no_permission();
And please, next time when posting code, use the code tags. They are there for a reason ;)


HMBeaty 07-13-2009 01:31 AM

They're the same as the quote tags..... just php, code, and html

Kottonmouth801 07-19-2009 06:55 PM

Quote:

Originally Posted by Digital Jedi (Post 1827560)
Depends in if Ultimate Side Columns requires you to make any template edits.

Got ya.....

I have fixed issue...

It was a template issue.

Thanks 4 your time & help.

:D:D:D

sheep92032 07-21-2009 09:06 AM

is there any way to insert html into the template, something like this:

eval('$showhtml = "' .$showhtml . '";'); // with $showhtml containing html

I want to convert one of my scripts but if I can't do this it'll be a huge headache.


All times are GMT. The time now is 01:18 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07936 seconds
  • Memory Usage 1,746KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (4)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete