vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   [How-To] Using Plugins for Automatic Template Edits (https://vborg.vbsupport.ru/showthread.php?t=151254)

Mutt 05-18-2010 12:50 PM

i was advised against trying to do it this way anymore.
https://vborg.vbsupport.ru/showthread.php?p=2028323

using template hooks was recommended if possible. if not, manual template edit

Lynne 05-18-2010 02:05 PM

It is still possible in vB4 using the same method. But, you need to realize that if a user changes their template and they change the line that is your $find variable, then this won't work. For that reason, it isn't always advised to use this method.

Dragonsys 10-11-2010 06:57 PM

I am trying to do this to hide/remove a section from the template, but it does not work for me...

My code for the plugin is this:
Code:

$find = '<div class=\"block\" id=\"foldercontrols\">';
$replace = '/* ';
$vbulletin->templatecache['pm_messagelist'] = str_replace($find, $replace . $find, $vbulletin->templatecache['pm_messagelist']);

$find2 = '<div id=\"pmlist_info\" class=\"floatcontainer\">';
$replace2 = '*/ ';
$vbulletin->templatecache['pm_messagelist'] = str_replace($find2, $replace2 . $find2, $vbulletin->templatecache['pm_messagelist']);

and I am using hook: private_complete
I have also tried private_start

but there is no change to what is displayed
This should hide the PM Folder Controls, but they are still displayed without change.

BirdOPrey5 10-11-2010 08:59 PM

I didn't think you could edit a template on the fly like that- I think you have to make an alternative template and use code to display that instead- at least that is how I always did it, which was once...:D

Dragonsys 10-11-2010 09:03 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2109226)
I didn't think you could edit a template on the fly like that- I think you have to make an alternative template and use code to display that instead- at least that is how I always did it, which was once...:D

that would be fine, how do I inject the new template into the existing one though, if a hook does not exist where I am trying to make the changes?

BirdOPrey5 10-11-2010 10:09 PM

I don't know. :(

kh99 11-28-2010 10:13 PM

Quote:

Originally Posted by Dragonsys (Post 2109179)
...but there is no change to what is displayed
This should hide the PM Folder Controls, but they are still displayed without change.

This was a long time ago now, but anyway - I think it may have been because you were inserting /* and */ instead of <!-- and -->

Dragonsys 12-29-2010 01:36 PM

Quote:

Originally Posted by kh99 (Post 2126902)
This was a long time ago now, but anyway - I think it may have been because you were inserting /* and */ instead of <!-- and -->

I wouldn't think so, as this plugin is changing the PHP code (unless I am understanding it wrong), but I will try that.

kh99 12-29-2010 02:05 PM

Quote:

Originally Posted by Dragonsys (Post 2140715)
I wouldn't think so, as this plugin is changing the PHP code (unless I am understanding it wrong), but I will try that.

I see what you mean, but in that case it seems like your replacements would end up part of a string constant instead of outside of any string (where they'd need to be to work as comment delimiters). But I could be wrong. It might help to somehow look at the exact string in the template cache.


All times are GMT. The time now is 11:16 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.01233 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
  • (1)bbcode_code_printable
  • (4)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
  • (9)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