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)

Shamil. 12-19-2010 11:24 AM

Quote:

Originally Posted by stevectaylor (Post 2136287)
Thanks lynne, I did guess that, but when inserted to the php it appears at the very top. How do you position a php include statement.

This is what I did

PHP Code:

<?php

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

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

define('THIS_SCRIPT''MANAGE');
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('manage_index',
);

// 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/hostcule/public_html');
require_once(
'./global.php');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
if (!in_array($vbulletin->userinfo['usergroupid'], array(5,6,7))) print_no_permission();

$navbits construct_navbits(array('' => 'Hosting Manager'));
$navbar render_navbar_template($navbits);

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle 'Hostcule Manager';

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

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

?>

It went in after: Start Main Script.

stevectaylor 12-19-2010 04:39 PM

Quote:

Originally Posted by ct2k7 (Post 2136322)
This is what I did

PHP Code:

<?php

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

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

define('THIS_SCRIPT''MANAGE');
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('manage_index',
);

// 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/hostcule/public_html');
require_once(
'./global.php');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
if (!in_array($vbulletin->userinfo['usergroupid'], array(5,6,7))) print_no_permission();

$navbits construct_navbits(array('' => 'Hosting Manager'));
$navbar render_navbar_template($navbits);

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle 'Hostcule Manager';

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

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

?>

It went in after: Start Main Script.

Thanks but can't really see how it changed.

Lynne 12-19-2010 04:45 PM

Quote:

Originally Posted by stevectaylor (Post 2136287)
Thanks lynne, I did guess that, but when inserted to the php it appears at the very top. How do you position a php include statement.

In the php page, test.php, after you include global.php, just include your script also - something like:
PHP Code:

chdir ('/home/hostcule/public_html');
require_once(
'./global.php');
include(
"offers/choice_ad1.php"); 

It should not have any output. If it does, then you need to assign it to a variable and then output that variable in your template where you want it.

stevectaylor 12-19-2010 04:56 PM

Quote:

Originally Posted by Lynne (Post 2136414)
In the php page, test.php, after you include global.php, just include your script also - something like:
PHP Code:

chdir ('/home/hostcule/public_html');
require_once(
'./global.php');
include(
"offers/choice_ad1.php"); 

It should not have any output. If it does, then you need to assign it to a variable and then output that variable in your template where you want it.

I had done this and seperately set a variable but both print the output before that header of the page.

Lynne 12-19-2010 05:28 PM

Quote:

Originally Posted by stevectaylor (Post 2136287)
Thanks lynne, I did guess that, but when inserted to the php it appears at the very top. How do you position a php include statement.

Quote:

Originally Posted by stevectaylor (Post 2136428)
I had done this and seperately set a variable but both print the output before that header of the page.

You need to look at the contents of that file. If it has any echo statements, then that is going to cause what you are seeing. You cannot use echo if you want to put the ads where you want them.

stevectaylor 12-19-2010 06:20 PM

I think I might have suused the issue. When I put in custom variables it doesn't like them e.g

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'My Page Title';
$pagead = 'trial';

Then in template add

{vb:raw pagead}

Nothing shows, but alter the standards and the standards work fine.

Lynne 12-19-2010 06:38 PM

Quote:

Originally Posted by stevectaylor (Post 2136469)
I think I might have suused the issue. When I put in custom variables it doesn't like them e.g

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'My Page Title';
$pagead = 'trial';

Then in template add

{vb:raw pagead}

Nothing shows, but alter the standards and the standards work fine.

You need to register any variable for use in a template.

stevectaylor 12-20-2010 08:57 AM

Quote:

Originally Posted by Lynne (Post 2136452)
You need to look at the contents of that file. If it has any echo statements, then that is going to cause what you are seeing. You cannot use echo if you want to put the ads where you want them.

Registered the variable. What are the acceptable alternatives to echo as the print function also returns the same result?

Lynne 12-20-2010 03:14 PM

Quote:

Originally Posted by stevectaylor (Post 2136754)
Registered the variable. What are the acceptable alternatives to echo as the print function also returns the same result?

instead of:
PHP Code:

echo "Hello World!"

use
PHP Code:

$outputvar .= "Hello World!"


stevectaylor 12-20-2010 03:28 PM

Quote:

Originally Posted by Lynne (Post 2136853)
instead of:
PHP Code:

echo "Hello World!"

use
PHP Code:

$outputvar .= "Hello World!"


Thanks Lynne,

I found the answer in another thread of yours on vbulletin.com and used the following which works a dream.

PHP Code:

ob_start();
  include(
'offers/accommodation.php');
  
$pagead ob_get_contents();
  
ob_end_clean(); 



All times are GMT. The time now is 11:10 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.02287 seconds
  • Memory Usage 1,787KB
  • 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
  • (9)bbcode_php_printable
  • (10)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