vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Auto edit templates? (https://vborg.vbsupport.ru/showthread.php?t=238772)

masterross 03-21-2010 04:21 PM

Auto edit templates?
 
Hi guys can you help me with auto editing templates?

I've tried to use
PHP Code:

preg_replace() 

But seems I'm doing something wrong.
If you have some examples will be great.

Thx in advance!

TalkVirginia 03-21-2010 09:12 PM

Quote:

Originally Posted by masterross (Post 2007629)
Hi guys can you help me with auto editing templates?

I've tried to use
PHP Code:

preg_replace() 

But seems I'm doing something wrong.
If you have some examples will be great.

Thx in advance!

Can you give a bit more info on what you're doing or trying to do?

masterross 03-22-2010 01:12 AM

Hi

I'm trying to edit template reputationbit

So i put this in hook global start:
PHP Code:

$search 'test';
$replace 'blablaa';

$vbulletin->templatecache['reputationbit'] = preg_replace("/$search/"$replace$vbulletin->templatecache['reputationbit']); 

But nothing's changed...

(of course $search = 'test' is just an example)

mikey1991 03-22-2010 01:24 AM

Personally I use something like this;

PHP Code:

$find 'test';  
$replace 'blablaa';  

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

worked for my postbit mods.

--------------- Added [DATE]1269224776[/DATE] at [TIME]1269224776[/TIME] ---------------

Also the hook is important. I put mine on showthread_start. If you put it on global_start, it will be running even when it is not needed, this impacts upon performance, however if you hook it into showthread_start, then it will only run on threads, which is where it is needed. :up:

TalkVirginia 03-22-2010 01:34 AM

Quote:

Originally Posted by masterross (Post 2007860)
Hi

I'm trying to edit template reputationbit

So i put this in hook global start:
PHP Code:

$search 'test';
$replace 'blablaa';
 
$vbulletin->templatecache['reputationbit'] = preg_replace("/$search/"$replace$vbulletin->templatecache['reputationbit']); 

But nothing's changed...

(of course $search = 'test' is just an example)

you might want to look at the following guide if you are inserting your own variables:
[HOW TO - vB4] Rendering templates and registering variables - a short guide

I think a better hook would be reputation_start

mikey1991 03-22-2010 01:38 AM

heh. didn't see this was vb4 discussions, haha.

masterross 03-22-2010 11:05 AM

Quote:

Originally Posted by TalkVirginia (Post 2007874)
you might want to look at the following guide if you are inserting your own variables:
[HOW TO - vB4] Rendering templates and registering variables - a short guide

I think a better hook would be reputation_start

This guide is my home page from the beginning :)

Anyway I tested all possible but no result.
So if anyone has some practical examples or know existing hack for vb4 using auto editing will be appreciated!


All times are GMT. The time now is 05:21 PM.

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.00974 seconds
  • Memory Usage 1,739KB
  • 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
  • (5)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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