vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   [HOW TO - vB4] Create your own vBulletin page (https://vborg.vbsupport.ru/showthread.php?t=228112)

sergioloporto 09-15-2010 03:01 PM

Hi... I understand that test.php should be put in the root /.
If I put the test.php in /folder/ should it work fine or I need to edit something?

Lynne 09-15-2010 05:33 PM

Quote:

Originally Posted by sergioloporto (Post 2098662)
Hi... I understand that test.php should be put in the root /.
If I put the test.php in /folder/ should it work fine or I need to edit something?

See this in the code:
PHP Code:

// 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'); 


sergioloporto 09-15-2010 06:09 PM

I am getting the following error when I go to the file:

PHP Code:

Warning: require_once(./global.php) [function.require-once]: failed to open streamNo such file or directory in /home/user/public_html/forumfolder/newfolder/file.php on line 29

Fatal error
: require_once() [function.require]: Failed opening required './global.php' (include_path='.:/usr/lib/php:/usr/local/lib/php'in /home/user/public_html/forumfolder/newfolder/file.php on line 29 


This is how I wrote the file:

PHP Code:

<?php

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

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

define('THIS_SCRIPT''file-name');
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('file name',
);

// 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 ('/home/user/public_html/forumfolder/newfolder');
require_once(
'./global.php');

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

$navbits construct_navbits(array('' => 'page title'));
$navbar render_navbar_template($navbits);

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle 'page title';

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

$templater vB_Template::create('file name');
$templater->register_page_templates();
$templater->register('navbar'$navbar);
$templater->register('pagetitle'$pagetitle);
print_output($templater->render());

?>

What I did wrong?

Lynne 09-15-2010 07:09 PM

Your vbforums are in a directory called /newfolder? You are supposed to chdir to the vbulletin forums directory.

sergioloporto 09-15-2010 07:15 PM

Excellent, thank you!

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

Question/problem 1)

However if I put some text after this:

PHP Code:

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle 'page title'

it says
Code:

Parse error: syntax error, unexpected T_VARIABLE in [and then the line number of the code I put]
Should I put my custom code on this php or on the template I created?

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

Questio/problem 2)

If I stay on the page file.php for a bunch of minutes, and then I refresh the page, this is what I get:

PHP Code:

Unable to add cookiesheader already sent.
File: /home/user/public_html/forumfolder/newfolder/page file.php
Line



Lynne 09-16-2010 03:27 AM

If you are getting those errors, then you are creating your page wrong. You should start your own thread and post your php code and template code so someone may help you out.

sergioloporto 09-16-2010 07:17 AM

Here it is: https://vborg.vbsupport.ru/showthread.php?p=2098965
Thank you for your help

joejoemaker 09-17-2010 02:50 PM

How can I use another template in the template for the new page?
Like this:

HTML 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">Title</h2>
    <div class="blockbody">
      <div class="blockrow">
        {vb:raw another_template}
      </div>
    </div>
   
    {vb:raw footer}
  </body>
</html>


"{vb:raw another_template}" should be replaced with the Template "another_template"

Someone who understand my querstion?

Lynne 09-17-2010 03:38 PM

Quote:

Originally Posted by joejoemaker (Post 2099657)
How can I use another template in the template for the new page?

You will need to render the template in your php code.

PHP Code:

$newTemplate vB_Template::create('someTemplate');
    
$newTemplate->register('variable1'$somearray);
    
$newTemplate->register('variable2'$variabletwo);
$another_template $newTemplate->render(); 

Then make sure you register $another_template for use in the TEST template.

joejoemaker 09-17-2010 04:57 PM

It works, Thanks!!

Have I to do this for every Template I want to use or is there a short version?


All times are GMT. The time now is 12:26 AM.

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

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02352 seconds
  • Memory Usage 1,773KB
  • 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
  • (1)bbcode_code_printable
  • (1)bbcode_html_printable
  • (6)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (3)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