vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   [HOW TO - vB4] Rendering templates and registering variables - a short guide (https://vborg.vbsupport.ru/showthread.php?t=228078)

HMBeaty 08-19-2011 12:12 AM

Quote:

Originally Posted by kh99 (Post 2235142)
You might try taking this line out of the php file:

PHP Code:

$templater->register('usml_military_ranks_sidebar'$usml_military_ranks_sidebar); 

you don't need this and the PreRegister, and this line might actually be registering a null value.

LOL! That did it! It's always something simple I end up overlooking :o Thanks!

Raeven 08-28-2011 07:05 PM

Hi, I kinda only have a short question (before I waste another few days of my life, because I didn't wanted to ask for help lol).

My Problem is, that I would like to hook a template on {vb:raw header} (so I don't need any Template edits anymore).
But all I get to work is, when I add in for example Forumhome Template {vb:raw header2} (then my template gets shown, but not if I try to use the real one).

So the Question is:
Is it actual possible or not (to use {vb:raw header})?

The Plugin Code I am using:

PHP Code:

$templater vB_Template::create('dev3_main');
    
$templater->register('my_var'$my_var);
    
$templater->register('my_array'$my_array);
$templatevalues['header'] = $templater->render();
vB_Template::preRegister('FORUMHOME'$templatevalues); 

hook: process_template_complete (tried also a few others).

And sorry for asking stupid Questions ;).

kh99 08-30-2011 08:22 PM

Quote:

Originally Posted by Raeven (Post 2239220)
Is it actual possible or not (to use {vb:raw header})?

Sorry, you were trying to save a few days but it took a few days to get an answer. :o

But the answer is that it probably won't work because I think if 'header' gets registered somewhere else (which it probably is, just before the template is rendered), it will override what you pre-registered.

Raeven 08-31-2011 04:48 AM

That's what I almost feared. So back to thinking how to get rid of the last template edit.

And thanks for the answer.

cellarius 08-31-2011 07:25 AM

It may not be wise to use additional templates etc. just to get rid of a template edit. It adds considerable overhead.

Raeven 09-05-2011 10:41 PM

There is always 2 things to consider:

- the right way
- the way people / customers and such prefer it (and thats usually no template edits :P)

zhai 11-28-2011 08:34 AM

1 Attachment(s)
I have been trying to do this for days, but ended up failing all the times. I have read this entire thread twice, from page 1-14 but still couldn't figure this out.

So I'm trying to change this part of showthread:
https://vborg.vbsupport.ru/attachmen...1&d=1322471332

I want to change it into my own moderation action instead of just closing the thread. I want to change the template with plug-in, but I couldn't get the right variable in which the informations about showthread quickreply are stored. On the early page of this thread, someone tried to change the footer just by accessing $footer .= "things to add"; on process_template_complete. So what variable should I be focusing on with my problem? I have already prepared a new template to replace that "checkbox", I just don't know how to access the existing template by using a plugin.

Any help is appreciated..

HMBeaty 01-08-2012 08:44 AM

Ok, I'm obviously missing something, but not sure what. I'm trying to display a variable in the header template, and what I have works just fine in the navbar. Here's what I have to display my mod in the navbar (this works):
PHP Code:

$templater vB_Template::create('usml_navnet_navbar');
$template_hook[navtab_end] .= $templater->render(); 

And this is what I was trying for the header (this doesn't work):
PHP Code:

$templater vB_Template::create('usml_navnet_header');
$templatevalues['navnet'] = $templater->render();
vB_Template::preRegister('header'$templatevalues); 

And, I believe, according to the 1st post, I would just add {vb.raw navnet} in the header template. However, it's not working, so I'm obviously overlooking something...

BirdOPrey5 01-08-2012 04:45 PM

What hook are you using? Header is rendered early, you may need a hook that is executed earlier.

HMBeaty 01-08-2012 05:57 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2285272)
What hook are you using? Header is rendered early, you may need a hook that is executed earlier.

parse_templates


All times are GMT. The time now is 01:12 AM.

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.01704 seconds
  • Memory Usage 1,752KB
  • 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
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (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