vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Question about creating a custom template (https://vborg.vbsupport.ru/showthread.php?t=169067)

GotVtec 01-29-2008 02:12 PM

Question about creating a custom template
 
I am trying to use a custom template on a page: http://www.v6performance.net/featuredcar/. However, the paths to the images and links in the $navbar are all incorrect because they are relative to the /forums/, how can I fix this for all of my custom templates?

Thanks!

RobDog888 01-29-2008 02:24 PM

<font color="darkgreen">I believe if you prepend the paths with "forums/" it will set the proper path for the images.</font>

GotVtec 01-30-2008 01:25 AM

Here is my script,

Code:

<?php

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

// ##################### DEFINE IMPORTANT CONSTANTS #######################
// change the line below to the actual filename without ".php" extention.
// the reason for using actual filename without extention as a value of this constant is to ensure uniqueness of the value throughout every PHP file of any given vBulletin installation.

define('THIS_SCRIPT', 'custompage');

// #################### 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(
        // change the lines below to the list of actual templates used in the script
        'custompage'
);

// pre-cache templates used by specific actions
$actiontemplates = array();

// ########################## REQUIRE BACK-END ############################
chdir('/path/to/forums');
require_once('./global.php'); 

// #################### HARD CODE JAVASCRIPT PATHS ########################
$headinclude = str_replace('clientscript', $vbulletin->options['bburl'] . '/clientscript', $headinclude);

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

$navbits = array();
// change the line below to contain whatever you want to show in the navbar (title of your custom page)
$navbits[$parent] = 'Custom Page';

$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');

$custompage = implode('', file('/path/to/custom/page.html'));

// change the line below to contain the name of the actual main output template used in your script
eval('print_output("' . fetch_template('custompage') . '");');

?>

How do I set the $navbar back to /forums/ ?

RobDog888 01-30-2008 02:42 AM

You would have to do it in your template code where you use the path to your images.

Code:

<img src="forums/$stylevar[imgdir_statusicon]/thread$thread[statusicon].gif" title="Test" />
Also, if this is a shared template then you can just add a variable in place of "/forums/" and then only populate it if its the custom page as it will be blank for regular pages and populated for custom ;)


Code:

<img src="$forums/$stylevar[imgdir_statusicon]/thread$thread[statusicon].gif" title="Test" />


All times are GMT. The time now is 05:24 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.00930 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
  • (4)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