Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 03-21-2010, 04:21 PM
masterross's Avatar
masterross masterross is offline
 
Join Date: Nov 2005
Location: Bulgaria
Posts: 315
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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!
Reply With Quote
  #2  
Old 03-21-2010, 09:12 PM
TalkVirginia's Avatar
TalkVirginia TalkVirginia is offline
 
Join Date: Oct 2008
Location: Virginia
Posts: 545
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by masterross View Post
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?
Reply With Quote
  #3  
Old 03-22-2010, 01:12 AM
masterross's Avatar
masterross masterross is offline
 
Join Date: Nov 2005
Location: Bulgaria
Posts: 315
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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)
Reply With Quote
  #4  
Old 03-22-2010, 01:24 AM
mikey1991's Avatar
mikey1991 mikey1991 is offline
 
Join Date: Oct 2008
Location: United Kingdom
Posts: 654
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:
Reply With Quote
  #5  
Old 03-22-2010, 01:34 AM
TalkVirginia's Avatar
TalkVirginia TalkVirginia is offline
 
Join Date: Oct 2008
Location: Virginia
Posts: 545
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by masterross View Post
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
Reply With Quote
  #6  
Old 03-22-2010, 01:38 AM
mikey1991's Avatar
mikey1991 mikey1991 is offline
 
Join Date: Oct 2008
Location: United Kingdom
Posts: 654
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

heh. didn't see this was vb4 discussions, haha.
Reply With Quote
  #7  
Old 03-22-2010, 11:05 AM
masterross's Avatar
masterross masterross is offline
 
Join Date: Nov 2005
Location: Bulgaria
Posts: 315
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by TalkVirginia View Post
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!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:39 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.04257 seconds
  • Memory Usage 2,227KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (5)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete