vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Programming Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=188)
-   -   How To Include A Custom Template Via Plugins (https://vborg.vbsupport.ru/showthread.php?t=119933)

tipoboy 03-31-2009 06:45 PM

this help a lot thanks

kronnos 04-05-2009 07:29 AM

Can these instructions be take a little further so the following can be done. When making a template, can that template include a variable that can be entered somewhere in the admincp? For example I want the temple to show "THIS". The only thing is I do not want to go to the template all the time and edit "THIS". Can I make a little addition to the admin CP so I can specify what "THIS" is?

Also, can all these template hooks, templates and all related to me showing "THIS" be saved in one package like a mod is so It can be uploaded to another forum easily?

Thanks

IdanB 06-12-2009 11:01 AM

Thanks for this guide. Indeed good tutorial.

I've crossed into weird thing though (vbulletin version 3.8.2), maybe someone came aross it & can give few tips on what i could have missed - i can't get rid of "uncached template" warning eventhough I have plugin on "cache_templates" adding it to $globaltemplates[], so not sure what am i missing.

ragtek 06-12-2009 11:02 AM

what hook are you using and whats the plugincode?
nobody can help you without that infos;)

IdanB 06-12-2009 11:11 AM

2 plugins:
1] location: "global_start"
name: "alt_lp_template"
with followign code:
PHP Code:

$alt_lp_template fetch_template('alternate_view'); 

2] location: "cache_templates"
name: "Tempalte Cache"
with followign code:
PHP Code:

$globaltemplates[] = 'alt_lp_template'

and on forum i keep getting "uncached template" warning for "alternate_view".
Note this template was added to master style.

EDIT: what's more weird, i know it's cached, as later on i can access it from $vbulletin->templatecache['alternate_view']

ragtek 06-12-2009 11:38 AM

You have to make it this way:
to cache it:
PHP Code:

 $globaltemplates[] = 'alternate_view'

and save the content from the template into a variable:
PHP Code:

eval('$varname = "' fetch_template('alternate_view') . '";'); 

Now you can use $varname

IdanB 06-12-2009 12:04 PM

thanks, that solved it, wrote under cache name the var name instead... silly me :p

street tactic 06-14-2009 06:22 AM

Excellent Post. Including my Javascript php file worked in parse_templates rather than cache_templates.

warrentr2 06-24-2009 11:15 PM

Hi Everyone,
Lets say I set some variable:

$domain = "testsub.domain.com";

from within a global_start plugin. SHOULD I be able to use this in any template??

I seem to have very mixed results. Some pages with links that contain this domain are just broken...

Any ideas?

ragtek 07-24-2009 07:28 AM

No, some templates are called from functions/methods, so you would have to create plugins to make your variable in the scope there.

You could write your variable into $vbulletin['myvarname'] = 'foo.bar.tld'; because $vbulletin should be everywhere in the scope.

I hope you can understand what i mean


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

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.02041 seconds
  • Memory Usage 1,734KB
  • 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)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (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