vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   [vBulletin|PHP|HTML]Automatic Template Edits (https://vborg.vbsupport.ru/showthread.php?t=125173)

Zachery 10-12-2006 07:48 PM

Making your end users do less and less creates the problems we have now. Make your users do the template edits.

Luggruff 11-02-2006 02:13 PM

Quote:

Originally Posted by Ziki
??????

As Zachery said:

I for one have a hack (CYB - Forum Rules) and he has done this, He have placed the link to the forumrules in my navbar, and I can't change it, or the location of it.

Think that's fun when you want to make a custom style? For one: If I change my navbar to the header, that link does not follow.. and so on.

Bad, bad, bad bad bad bad bad bad.

Paul M 11-02-2006 05:40 PM

Whether you like automatic editing of templates is a personal choice, not a fact. If you want to discuss the merits of doing it please start a new thread, not clutter up this one.

Ziki 11-03-2006 05:35 PM

Quote:

Originally Posted by Paul M
Whether you like automatic editing of templates is a personal choice, not a fact. If you want to discuss the merits of doing it please start a new thread, not clutter up this one.

That was a plus for me?

RedTyger 11-11-2006 07:50 PM

Nicely done Ziki. :D And as an extra bonus, something I just found out. Namely that you don't need to create or insert a template if all you want to insert is one value from your settings.

Code:

$str = 'findthis';
$vbulletin->templatecache['footer'] = str_replace($str,$str.$vbulletin->options['kerjigger'],$vbulletin->templatecache['footer']);

Because str_replace uses up a little bit of resources, if whether or not it's going to be used is dependent on settings in your plugin then it's worth surrounding the replace code with a variable to ensure it only runs when it has to. Like so:

Code:

if ($vbulletin->options['mysetting'])
{
$str = 'findthis';
$vbulletin->templatecache['footer'] = str_replace($str,$str.$vbulletin->options['kerjigger'],$vbulletin->templatecache['footer']);
}


RedTyger 03-10-2007 08:25 AM

Two small additional notes.

Firstly, templatecache identities are CASE SENSITIVE. So $vbulletin->templatecache['SHOWTHREAD'] will work but $vbulletin->templatecache['showthread'] will not, because the the template is named with capitals.

Secondly, if you are doing a find/replace it's slightly more efficient to include what you're finding in the replacement text instead of appending it in the str_replace. So

Code:

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

is more efficient than

Code:

$find = 'this';
$replace = ' that';
$vbulletin->templatecache['SHOWTHREAD'] = str_replace($find, $find.$replace, $vbulletin->templatecache['SHOWTHREAD']);

Doing it the first way also has another advantage in that you can add your replacement immediately before what you're finding. If you do it the second way, you can only add it after.

ragtek 03-10-2007 08:43 AM

there is a very nice product from andreas http://www.vbhacks-germany.org/showthread.php?t=5572

Luky 04-02-2007 12:43 PM

Didnt read, but ALL mods should use this! :P I hate editing templates for mods, it means you gota do it for every style, i have alot of styles =/

Ziki 09-26-2008 08:44 PM

Article was updated.

Ziki 05-16-2009 06:13 AM

Updated


All times are GMT. The time now is 10:06 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.01394 seconds
  • Memory Usage 1,736KB
  • 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
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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