vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Include part of headinclude codes in other template (https://vborg.vbsupport.ru/showthread.php?t=293064)

adabros 12-17-2012 11:03 AM

Include part of headinclude codes in other template
 
Hi.
I have a question.
I want include part of headinclude template codes in other template (custom template).
Because I have many js conflicts.

I create home.php
Code:

<?php

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

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

define('THIS_SCRIPT', 'home');
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('HOME',
);

// 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 ('/path/to/your/forums');
//require_once('./global.php');
$curdir = getcwd ();
chdir('/home/acquarit/public_html/forums');
require_once('/home/acquarit/public_html/forums/global.php');
chdir ($curdir); 

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

$navbits = construct_navbits(array('' => 'Test Page'));
$navbar = render_navbar_template($navbits);

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'Acquaritalia';

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

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

//
global $vbulletin, $vbphrases, $show, $stylevar;
include("/home/acquarit/public_html/forums/vblinklist/widgets/widget_linklist_stats.php");
//
?>

HOME template
Code:

<!DOCTYPE html>
<html lang="{vb:stylevar languagecode}" >
  <head>.......

        <phpcode><![CDATA[global $vbulletin, $vbphrases, $show, $stylevar;
include(DIR . "/vblinklist/widgets/widget_linklist_stats.php");]]></phpcode>

        {vb:raw header}
    {vb:raw headinclude}
    {vb:raw headinclude_bottom}....
</head>

I want replace {vb:raw headinclude } with custom codes (parts of headinclude template).

kh99 12-17-2012 11:50 AM

I don't understand the question - can't you just replace {vb:raw headinclude} with whatever you want?

adabros 12-17-2012 12:41 PM

Hi kh99.
I have some problems with js files.
I use a script in all forum, that in my custom page (home template) causes js errors.
I want exclude this script in home template, which is integrated with variable {vb:raw headinclude}.
What I do?

kh99 12-17-2012 02:03 PM

OK, maybe something like this (in the headinclude template)

Code:

<vb:if condition="THIS_SCRIPT != 'home'">
Things that go in pages except home
</vb:if>


adabros 12-17-2012 04:09 PM

Ok thanks.
Solved.

:)

I was trying to solve with javascript.


All times are GMT. The time now is 04:26 PM.

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.01238 seconds
  • Memory Usage 1,719KB
  • 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
  • (3)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete