vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Custom Pages/Template Help (https://vborg.vbsupport.ru/showthread.php?t=120863)

maximux1 07-11-2006 12:32 AM

Custom Pages/Template Help
 
Thanks for taking a few moments,

I understand how to create basic templates & external vb pages and include vb vars into those templates/pages. What I am now strugling with is how to create more advanced templates to be able to take advantage of some of the more advanced vb internals.

If you could assist me with a simple example I will likely be able to gain the knowledge I need to move forward.

Here's my basic example;

Template
Code:

<!-- logged-in users -->

<a style="float:$stylevar[right]" href="#top">
<img id="collapseimg_forumhome_activeusers" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_activeusers].gif" alt="" border="0" /></a>
                       
<a href="online.php$session[sessionurl_q]" rel="nofollow">$vbphrase[currently_active_users]</a>: $totalonline (<phrase 1="$numberregistered" 2="$numberguest">$vbphrase[x_members_and_y_guests]</phrase>)

<!-- end logged-in users -->


PHP file
PHP Code:

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

define('THIS_SCRIPT''test'); 

// #################### 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
        
'test_template',
);

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

// ########################## REQUIRE BACK-END ############################
chdir("./forum");
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] = 'Test Page';

$navbits construct_navbits($navbits);

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

The output of the above file is;

Currently Active Users: ( members and guests)

The data is empty as if I am not including the proper files, however no error or anything suggesting a solution.

The problem is likely obvious to the pro's. I just can't seem to figure out how to take advantage of the vb vars such as $totalonline, etc. I believe the issue is likely related to a missing require file, but it has not been made clear to me yet.

You're help with this simple example would be greatly apprecaited.

Thank you.

Kirk Y 07-11-2006 08:09 PM

Take a look at lines 336-425 in your index.php file.

maximux1 07-14-2006 03:41 PM

Thank you, I appreciate your help.

Paul M 07-14-2006 05:59 PM

The data is empty because your not actually extracting it anywhere - all your file does is display the template, therefore '$totalonline' has nothing in it.

JimmyN 07-14-2006 08:13 PM

Be sure to check these out..
https://vborg.vbsupport.ru/showthrea...ustom+php+page
https://vborg.vbsupport.ru/showthread.php?t=92203

maximux1 07-14-2006 09:29 PM

Thanks guys, got this figured out shortly after posting it.

I appreciate all the help!


All times are GMT. The time now is 08:54 AM.

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.02018 seconds
  • Memory Usage 1,733KB
  • 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
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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