vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Footer Template (https://vborg.vbsupport.ru/showthread.php?t=315530)

Black Snow 11-21-2014 02:39 PM

Footer Template
 
I am trying to do a str_replace in the footer so my edit shows up on every page but vB doesn't seem to like it. The function works fine on every page as long as it's not in the footer.

Is there a way to do this on all pages or is there a more simple way to str_replace in the footer?
Example
Code:

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

ozzy47 11-21-2014 02:45 PM

Well first off, you are doing the replace on th forumhome template, not the footer.

Black Snow 11-21-2014 02:49 PM

Quote:

Originally Posted by ozzy47 (Post 2523633)
Well first off, you are doing the replace on th forumhome template, not the footer.

I know that, I was testing out my theory that the footer template doesn't like str_replace's. It was an example to see if there is an array or something that can edit the footer template OR do a str_replace on the pages that would need it, i.e. FORUMHOME, FORUMDISPLAY, SHOWTHREAD etc.

ozzy47 11-21-2014 03:43 PM

Well then you need to show exactly what it is you are trying to do, as providing some random example don't help to figure out what the issue is. :)

kh99 11-21-2014 04:03 PM

What hook are you using? If you want to do a replacement on the footer in the template cache then you pretty much need to use hook parse_templates for it to always work right.

Black Snow 11-21-2014 04:15 PM

I'm using process_templates_complete I think. Not sure as I'm on my phone at the moment.

kh99 11-21-2014 05:12 PM

Quote:

Originally Posted by Black Snow (Post 2523649)
I'm using process_templates_complete I think. Not sure as I'm on my phone at the moment.

If that's true then that's the problem. The footer has already been rendered at that point. But you could probably do a replacement on $footer instead of the template cache.

Black Snow 11-21-2014 05:56 PM

Quote:

Originally Posted by kh99 (Post 2523652)
If that's true then that's the problem. The footer has already been rendered at that point. But you could probably do a replacement on $footer instead of the template cache.

How would I go about doing that?

kh99 11-21-2014 06:00 PM

The same way you do it for the template cache, except you use $footer instead of $vbulletin->templatecache['footer']. But it's been rendered at that point so the "find" might not be the same as it is for the cache.

But that was just an option. It's probably easier to just change the hook location to parse_templates.

Black Snow 11-21-2014 06:12 PM

OK, cool.

I have made my own hook like this using hook: process_templates_complete
Code:

global $vbulletin;

$templater = vB_Template::create('XXX');
$templater->register('XXX', $XXX);
$template_hook[new_hook] .= $templater->render();

This correct?


All times are GMT. The time now is 05:26 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.01088 seconds
  • Memory Usage 1,729KB
  • 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
  • (2)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)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