sergioloporto
09-16-2010, 07:17 AM
Hello, my VB4 CMS is installed here: '/home/user/public_html/myforum
I am using/trying to create a custom page with the same template as in the example. So this is the code of my test.php [the test.php is inside /home/user/public_html/myforum/concorso]:
<?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('TEST',
);
// 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/myforum');
require_once('./global.php');
// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################
$navbits = construct_navbits(array('' => 'Test Page'));
$navbar = render_navbar_template($navbits);
// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'My Page Title';
fdsfdsga
// ###### NOW YOUR TEMPLATE IS BEING RENDERED ######
$templater = vB_Template::create('TEST');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
print_output($templater->render());
?>
Also the template is the same (for testing purposes) as the one of this article: https://vborg.vbsupport.ru/showthread.php?t=228112
In the test.php there is a field:
// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'My Page Title';
fdsfdsga
But if I add text like the one you see above I get an error:
Parse error: syntax error, unexpected T_VARIABLE in /home/user/public_html/myforum/concorso/test.php on line 46
Question: Why I get that error? What kind of code should go there?
If I want to put some <script> and html, should it go here in the test.php or in the template?
--------------- Added 1284628226 at 1284628226 ---------------
If I in the browser I stay in the test.php page for long time (about 10 - 20 minutes) and then I refresh the page, this is what I get:
Unable to add cookies, header already sent.
File: /home/user/public_html/myforum/concorso/test.php
Line: 1
In order to see the test.php page I need to go to a normal page of the forum, and then I have to go back to the test.php in order to see it without errors.
Question 2: why this is happening? How to resolve it?
I am using/trying to create a custom page with the same template as in the example. So this is the code of my test.php [the test.php is inside /home/user/public_html/myforum/concorso]:
<?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('TEST',
);
// 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/myforum');
require_once('./global.php');
// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################
$navbits = construct_navbits(array('' => 'Test Page'));
$navbar = render_navbar_template($navbits);
// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'My Page Title';
fdsfdsga
// ###### NOW YOUR TEMPLATE IS BEING RENDERED ######
$templater = vB_Template::create('TEST');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
print_output($templater->render());
?>
Also the template is the same (for testing purposes) as the one of this article: https://vborg.vbsupport.ru/showthread.php?t=228112
In the test.php there is a field:
// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'My Page Title';
fdsfdsga
But if I add text like the one you see above I get an error:
Parse error: syntax error, unexpected T_VARIABLE in /home/user/public_html/myforum/concorso/test.php on line 46
Question: Why I get that error? What kind of code should go there?
If I want to put some <script> and html, should it go here in the test.php or in the template?
--------------- Added 1284628226 at 1284628226 ---------------
If I in the browser I stay in the test.php page for long time (about 10 - 20 minutes) and then I refresh the page, this is what I get:
Unable to add cookies, header already sent.
File: /home/user/public_html/myforum/concorso/test.php
Line: 1
In order to see the test.php page I need to go to a normal page of the forum, and then I have to go back to the test.php in order to see it without errors.
Question 2: why this is happening? How to resolve it?