Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 09-16-2010, 07:17 AM
sergioloporto sergioloporto is offline
 
Join Date: Jul 2008
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Questions and errors: "Create your own vBulletin page" - receiving errors

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 Code:
<?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:

PHP Code:
// ###### 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:
Code:
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 [DATE]1284628226[/DATE] at [TIME]1284628226[/TIME] ---------------

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:

Code:
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?
Reply With Quote
  #2  
Old 09-16-2010, 01:36 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You cannot just add text like this into your php page:
PHP Code:
fdsfdsga 
You need to put PHP into your php page and that is not php.

What are you trying to do there?
Reply With Quote
  #3  
Old 09-16-2010, 01:44 PM
sergioloporto sergioloporto is offline
 
Join Date: Jul 2008
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I need to put something like this, not the same, but very similar:

HTML Code:
<form method="post" action="https://app.xxxx.com/main.php?moduleName=fm_subscribers&amp;action=add_subscriber">
<input type="hidden" name="subscribers_list_hash" value="xxxxx" />
<label for="freshmail_email"> Email </label><br /><input type="text" name="xxxmail_email" id="xxxmail_email"><br />
<input type="submit" value="confirm">
</form>
and I will need to put images and text (static text and images)

Where should I put this?
Reply With Quote
  #4  
Old 09-16-2010, 05:48 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The html goes into the template. php goes into the php file.
Reply With Quote
  #5  
Old 09-16-2010, 05:55 PM
sergioloporto sergioloporto is offline
 
Join Date: Jul 2008
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok thanks, I'll try it out.

What about the "Unable to add cookies, header already sent." message that I get when I have the page open for long time and then press refresh?
Reply With Quote
  #6  
Old 09-16-2010, 05:59 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You get that with the totally default test page and test template?
Reply With Quote
  #7  
Old 09-16-2010, 06:06 PM
sergioloporto sergioloporto is offline
 
Join Date: Jul 2008
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yes, exactly using the template and test.php as in the first page of th article, no changes. Also file names and template names are the same. Exactly copy and paste.

The only change is the: chdir ('/home/user/public_html/myforum');

It happens only when refreshing the test.php page
Reply With Quote
  #8  
Old 09-16-2010, 11:47 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Make sure you are using a text editor (not something like Word, but one just for text or php), and also make sure you put no extra lines or spaces before the <?php
Reply With Quote
  #9  
Old 09-17-2010, 06:38 AM
sergioloporto sergioloporto is offline
 
Join Date: Jul 2008
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I always use Notepad++, and I confirm there are no spaces before <php

Now I will try to see if I get the same cookies error after disable my mods and I'll let you know
Reply With Quote
  #10  
Old 09-17-2010, 10:11 AM
sergioloporto sergioloporto is offline
 
Join Date: Jul 2008
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Update:

I disabled the whole plugin system from the settings in the cp, but I get the same error.

Here attached:
-test.php
-screenshot of the error message
-screenshot of the template
-screenshot of the filetree


Password via PM
Attached Files
File Type: zip Desktop.zip (88.5 KB, 1 views)
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:53 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.09559 seconds
  • Memory Usage 2,298KB
  • Queries Executed 14 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (1)bbcode_html
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete