vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Including templates in VBulletin (https://vborg.vbsupport.ru/showthread.php?t=199361)

Sothside40 12-20-2008 02:24 PM

Including templates in VBulletin
 
Hey, I'm currently trying to write a mod (my first) for vBulletin, and from the mods I've read it seems like they've been able to include their templates inside of other templates such as:

Quote:

<template name="myTemplate" etc="" etc="">
<div>This is what the first template is</div>
</template>
Then from there I go into the style editor, and inside of the footer template I throw in: $myTemplate. The desired result is for the template I defined as "myTemplate" to be shown inside of the footer. Am I mistaken on the functionality of this? And if so, can you please tell me what I've done wrong?

Lynne 12-20-2008 03:40 PM

You need to eval a template before it can be used. Look in any of the php pages and you will see templates evaled:
PHP Code:

eval('print_output("' fetch_template('tracker_newupload') . '");'); 


Sothside40 12-20-2008 08:25 PM

fetch_template() seems to be returning null, no matter what template I use it on.

Lynne 12-20-2008 09:14 PM

Well, you probably need to include it in the global templates first.

You should take a look at these articles - How to create your own vBulletin-powered page! (uses vB templates) or [How-To] vBulletin API Basics: Creating Custom Pages & Misc.

Sothside40 12-22-2008 12:49 AM

I've read those articles, and I can't even get the examples working. fetch_template() is still returning absolutely nothing, even with templates that already exist (footer, navbar, etc).

PHP Code:

array_push($globaltemplates'test');
eval(
'print_output("' fetch_template('test') . '");'); 

Result is a blank page, when it should be displaying a table. (that I have defined and am 100% positive exists in my boards templates)

Lynne 12-22-2008 02:59 AM

Post your full php page and your full template. That way we can see what you are doing wrong.

Sothside40 12-22-2008 09:12 AM

Template: test
PHP Code:

<table class="tborder" cellpadding="$stylevar[cellpadding]cellspacing="$stylevar[cellspacing]border="0" width="100%" align="center">
    <
tr>

    <
td class="tcat" width="100%">
    <
a  style="float:$stylevar[right]href="#top" onclick="return toggle_collapse('my_table')"><img id="collapseimg_my_table" src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_my_table].gif" alt="" border="0" /></a>
    <
div style="text-align: center;">
      New 
Table Title
    
</div>
    </
td>
    <
tbody id="collapseobj_my_table" style="$vbcollapse[collapseobj_my_table]">
    </
tr>

    <
tr>

    <
td class="alt1" width="100%">
      <
div class="smallfont">
        [
snip]
      </
div>
    </
td>

    </
tr>
</
table

PHP: plugin hooked to cache_templates
PHP Code:

array_push($globaltemplates'test');
eval(
'print_output("' fetch_template('test') . '");'); 

That's all there is to it.

Adam21 12-22-2008 09:47 AM

Whats your full php page?Is this page gonna be a link in your navbar or?

Sothside40 12-22-2008 03:07 PM

I'm gathering the boards last.fm group statistics via the API (which are received with no problem) formatting them into HTML, and then placing them on the forum.

This will add a table(for content) between the main boards and navbar. I know currently my example would merely output just a table, but that's easily remedied once I can get my issues resolved.


All times are GMT. The time now is 03:29 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.01144 seconds
  • Memory Usage 1,744KB
  • 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
  • (4)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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