Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #21  
Old 09-12-2014, 11:52 AM
ozzy47's Avatar
ozzy47 ozzy47 is offline
 
Join Date: Jul 2009
Location: USA
Posts: 10,929
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you want, pm me a admin account and I can see if I can figure it out when I get home today.
Reply With Quote
  #22  
Old 09-17-2014, 03:01 PM
Black Snow Black Snow is offline
 
Join Date: Jul 2012
Location: Scotland
Posts: 471
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ozzy47 View Post
O create a new template, in each style, with the exact contents you want. Then create this plugin using the hook location, template_render_output

PHP Code:
    if ($this->template == 'OLD TEMPLATE NAME')
    {
        
$this->template 'NEW TEMPLATE NAME';
    } 
I eventually got this to work. Not sure why it won't work on my custom pages.

Anyway, is there any way to use the above code and have 10 different templates changed using an array or something like this?

PHP Code:
    if ($this->template == 'OLD TEMPLATE NAME 1')
    {
        
$this->template 'NEW TEMPLATE NAME 1';
    }
if (
$this->template == 'OLD TEMPLATE NAME 2')
    {
        
$this->template 'NEW TEMPLATE NAME 2';
    }
if (
$this->template == 'OLD TEMPLATE NAME 3')
    {
        
$this->template 'NEW TEMPLATE NAME 3';
    }
if (
$this->template == 'OLD TEMPLATE NAME 4')
    {
        
$this->template 'NEW TEMPLATE NAME 4';
    } 
So instead of a new plugin for each template I change something in, I can do it all in one plugin.
Reply With Quote
  #23  
Old 09-17-2014, 05:38 PM
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Posts: 1,987
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Black Snow View Post
I eventually got this to work. Not sure why it won't work on my custom pages.
Probably you did not cache your custom template. If it's not in the cache, there's nothing to replace. It will be queried directly from the database as is.

Quote:
Anyway, is there any way to use the above code and have 10 different templates changed using an array or something like this?

PHP Code:
    if ($this->template == 'OLD TEMPLATE NAME 1')
    {
        
$this->template 'NEW TEMPLATE NAME 1';
    }
if (
$this->template == 'OLD TEMPLATE NAME 2')
    {
        
$this->template 'NEW TEMPLATE NAME 2';
    }
if (
$this->template == 'OLD TEMPLATE NAME 3')
    {
        
$this->template 'NEW TEMPLATE NAME 3';
    }
if (
$this->template == 'OLD TEMPLATE NAME 4')
    {
        
$this->template 'NEW TEMPLATE NAME 4';
    } 
So instead of a new plugin for each template I change something in, I can do it all in one plugin.
You don't need more than one plugin. You can put that code as is into one plugin. Of course you could also do something like
PHP Code:
$replace = array(
        
'old1' => 'new1'
        
'old2' => 'new2',
        
'old3' => 'new3'
    
);

foreach (
$replace as $key => $value)
{
    if (
$this->template == $key)
    {
        
$this->template $value;
    }

Reply With Quote
3 благодарности(ей) от:
Black Snow, ozzy47, tbworld
  #24  
Old 09-17-2014, 05:43 PM
Black Snow Black Snow is offline
 
Join Date: Jul 2012
Location: Scotland
Posts: 471
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for that. I will test it out.
Reply With Quote
  #25  
Old 09-18-2014, 06:17 PM
Black Snow Black Snow is offline
 
Join Date: Jul 2012
Location: Scotland
Posts: 471
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I want to add something under the navbar. How do I add something to the end of the navbar temaplate OR include a template after the navbar? I'm not quite sure on using the pre-defined hooks or add new hooks into templates.
Reply With Quote
  #26  
Old 09-18-2014, 08:13 PM
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Posts: 1,987
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

See https://vborg.vbsupport.ru/showthread.php?t=228078
Reply With Quote
Благодарность от:
ozzy47
  #27  
Old 09-19-2014, 07:27 AM
Black Snow Black Snow is offline
 
Join Date: Jul 2012
Location: Scotland
Posts: 471
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by cellarius View Post
I havd a look and not sure what I am doing wrong. This is my plugin:

Code:
$templater = vB_Template::create('custom_template');
    $templater->register('custom_template', $custom_template);
    $template_hook['postbit_userinfo_right_after_posts'] .= $templater->render();
It doesn't show the contents of custom_template after user posts using hook location postbit_display_complete.

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

Sorry, I never added the cache and it now shows. Does the code I used above look OK?

I have now added a new plugin for the forumhome using forumhome_complete hook location. I want it to show at the end of the navbar template. How do I insert my OWN custom template hook into the navbar template without having to manually edit the navbar template?
Reply With Quote
  #28  
Old 09-28-2014, 02:32 PM
Black Snow Black Snow is offline
 
Join Date: Jul 2012
Location: Scotland
Posts: 471
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How do I add my own CSS to the additional.css template using a plugin?
Reply With Quote
  #29  
Old 09-28-2014, 02:34 PM
ozzy47's Avatar
ozzy47 ozzy47 is offline
 
Join Date: Jul 2009
Location: USA
Posts: 10,929
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can't, you need to include your own css template, and call it in the script.
Reply With Quote
  #30  
Old 09-29-2014, 12:26 PM
Black Snow Black Snow is offline
 
Join Date: Jul 2012
Location: Scotland
Posts: 471
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is more for ozzy47 lol as I have used your mod [OzzModz] Change Forumrow Color On Mouseover as an example to make my own mod. I am making this plugin to change the background of moderated posts, does this look OK?

Code:
global $vbulletin;

if (THIS_SCRIPT == 'showthread') {
if ($vbulletin->options['mod_post_background_enable'])
{
    if ($vbulletin->options['storecssasfile'])
    {
        $template_hook['custom_css_links'] .= '<link type="text/css" rel="stylesheet" href="' . vB_Template::fetch_css_path() . 'mod_post_background_color.css' . '?d=' . $style['dateline'] . '" />';
    } else {
        $template_hook['custom_css_list'] .= 'mod_post_background_color.css';
    }

$find = '<div class=\"postbody\">'; 
$replace =  '<div class=\"postbody <vb:if condition="$show['moderated']">moderated</vb:if>\">'; 
$vbulletin->templatecache['postbit_legacy'] = str_replace($find, $replace, $vbulletin->templatecache['postbit_legacy']);
}
}
I am unsure if I escaped the quotes properly or if it is working. What's the quickest way to making a moderated post also?
Reply With Quote
Reply


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 02:44 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.04361 seconds
  • Memory Usage 2,303KB
  • Queries Executed 12 (?)
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
  • (2)bbcode_code
  • (4)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (10)post_thanks_box
  • (4)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete