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)

kh99 01-08-2012 07:21 PM

If you switch the template names (just for a test), does it still only work in the navbar?

HMBeaty 01-08-2012 11:44 PM

1 Attachment(s)
Still not working, here is the complete code in use atm...

(code removed :))

kh99 01-09-2012 12:02 AM

Quote:

Originally Posted by HMBeaty (Post 2285396)
... the variable I'm trying to use in the header is {vb.raw navnet}, but it doesn't show anything but the raw variable...

Oh, that's different, I thought you were seeing nothing. But I think it's just that it should be vb:raw instead of vb.raw (I totally missed that in your above post).

HMBeaty 01-09-2012 01:35 AM

Quote:

Originally Posted by kh99 (Post 2285401)
Oh, that's different, I thought you were seeing nothing. But I think it's just that it should be vb:raw instead of vb.raw (I totally missed that in your above post).

Lmao, wow! It was definately ":" instead of ".". I can't believe I did that :o. Thanks. [S]On a side note, any idea as to how to adjust the position of a Google+ button? I've been at it for several hours, and it just doesn't seem to move :confused:[/S] Figured that out finally :p

TheSupportForum 01-13-2012 03:29 AM

i need help parsing a code into HEADER template using plugin

basically i need to insert a code after

Code:

<div id="toplinks" class="toplinks">
i dont want a template, i just want the plugin to insert a code directly after that shown above

using something like

Code:


$find <div id="toplinks" class="toplinks">
$mycode <div style="float:right; margin: 5px -12px 5px 10px;">{vb:raw mycode </div>

i am not sure the rest but i know its something like that

Boofo 01-13-2012 03:44 AM

Try this in the parse_templates hook:

Code:

require_once(DIR . '/includes/class_template_parser.php');
$parser = new vB_TemplateParser('<div id="toplinks" class="toplinks">');
$parser->dom_doc = new vB_DomDocument($parser->fetch_dom_compatible());
$find = trim($parser->_parse_nodes($parser->dom_doc->childNodes()));

$parser = new vB_TemplateParser('<div style="float:right; margin: 5px -12px 5px 10px;">{vb:raw mycode}</div>');
$parser->dom_doc = new vB_DomDocument($parser->fetch_dom_compatible());
$replace = trim($parser->_parse_nodes($parser->dom_doc->childNodes()));

$vbulletin->templatecache['header'] = str_replace($find, $find . $replace, $vbulletin->templatecache['header']);
unset($find, $replace);


TheSupportForum 01-13-2012 03:55 AM

Quote:

Originally Posted by Boofo (Post 2287132)
Try this in the parse_templates hook:

Code:

require_once(DIR . '/includes/class_template_parser.php');
$parser = new vB_TemplateParser('<div id="toplinks" class="toplinks">');
$parser->dom_doc = new vB_DomDocument($parser->fetch_dom_compatible());
$find = trim($parser->_parse_nodes($parser->dom_doc->childNodes()));

$parser = new vB_TemplateParser('<div style="float:right; margin: 5px -12px 5px 10px;">{vb:raw mycode}</div>');
$parser->dom_doc = new vB_DomDocument($parser->fetch_dom_compatible());
$replace = trim($parser->_parse_nodes($parser->dom_doc->childNodes()));

$vbulletin->templatecache['header'] = str_replace($find, $find . $replace, $vbulletin->templatecache['header']);
unset($find, $replace);



I thank you very much it worked 100% :)

updating templates this way works perfect without the need to go into the template to manually input it
thx

Boofo 01-13-2012 04:01 AM

Quote:

Originally Posted by simonhind (Post 2287137)
I thank you very much it worked 100% :)

updating templates this way works perfect without the need to go into the template to manually input it
thx

You actually had doubts it would work? ;)

TheSupportForum 01-13-2012 04:17 AM

Quote:

Originally Posted by Boofo (Post 2287142)
You actually had doubts it would work? ;)

lol, i have lost touch with vb coding in a long time, i just need to get used to it, plus i am glad you repsonded i have seen your great work and advice on here
many thanks

Boofo 01-13-2012 04:42 AM

Quote:

Originally Posted by simonhind (Post 2287145)
lol, i have lost touch with vb coding in a long time, i just need to get used to it, plus i am glad you repsonded i have seen your great work and advice on here
many thanks

vb 4 handles str_replace differently, for some reason. Glad I could help. ;)


All times are GMT. The time now is 08:50 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.01519 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_code_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)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