Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 02-18-2015, 08:31 AM
Easy5s.net Easy5s.net is offline
 
Join Date: Jun 2011
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How to write plugins replace temp

How to create a new template instead of VBB templates are used.
For example, I've created a custom template to replace the template forumhome_forumbit_level2_post, and I need a plugins to do this automatically. Thank
Reply With Quote
  #2  
Old 02-18-2015, 08:43 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't know if you'd want a product to replace that template, because some people might have custom styles (and there's also the issue of multiple styles and mobile styles). I'm not sure of the right way to handle that. But one thing you could do is name your new template something else, then arrange for your template to be used. The code that uses that template is in functions_forumlist and looks like this:

PHP Code:
    // build the template for the current forum
    
($hook vBulletinHook::fetch_hook('forumbit_display')) ? eval($hook) : false;
    
$templater vB_Template::create("forumhome_forumbit_level$depth$tempext");
        
$templater->register('childforumbits'$childforumbits);
        
$templater->register('collapseimg_forumid'$collapseimg_forumid); 
so you could have a plugin using hook forumbit_display that changed $depth or $tempext so that it was using your new name.

I guess this still causes issues if someone has a custom style, so I'm not sure if this is really any better.
Reply With Quote
  #3  
Old 02-18-2015, 09:50 AM
Easy5s.net Easy5s.net is offline
 
Join Date: Jun 2011
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i have add plugin

PHP Code:
$templater vB_Template::create("custom_forumhome_forumbit");
                
$templater->register('childforumbits'$childforumbits);
                
$templater->register('collapseimg_forumid'$collapseimg_forumid);
                
$templater->register('collapseobj_forumid'$collapseobj_forumid);
                
$templater->register('forum'$forum);
                
$templater->register('forumid'$forumid);
                
$templater->register('parent_is_category'$parent_is_category);
                
            
$forumbits .= $templater->render(); 

hook work good but show dup temp
Reply With Quote
  #4  
Old 02-18-2015, 09:59 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, what I was thinking was that your plugin would not render a template but would change $tempext so that the template name was changed. Like maybe:
PHP Code:
if ($depth == && $tempext == '_post')
{
   
$tempext '_post_custom';

Then your new template would be named forumhome_forumbit_level2_post_custom.
Reply With Quote
  #5  
Old 02-18-2015, 10:25 AM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Why wouldn't you just update the contents of that template with your own template code..
Reply With Quote
  #6  
Old 02-18-2015, 10:44 AM
Easy5s.net Easy5s.net is offline
 
Join Date: Jun 2011
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Dup temp ?


I want
if (in_array ($ forum ['forumid'], '5,6,7,8'))

forumids 5,6,7,8 then show it to the temp custom, while others still show forumid default temp vbb
Reply With Quote
  #7  
Old 02-18-2015, 10:46 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What plugin code are you using now?
Reply With Quote
  #8  
Old 02-18-2015, 10:49 AM
Easy5s.net Easy5s.net is offline
 
Join Date: Jun 2011
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
What plugin code are you using now?
PHP Code:
$forumids explode(',''5,6,7,8');// add vboption after
if (in_array($forum['forumid'], $forumids))
{
    
$templater vB_Template::create("forumhome_forumbit_level2_custom");
        
$templater->register('childforumbits'$childforumbits);
        
$templater->register('collapseimg_forumid'$collapseimg_forumid);
        
$templater->register('collapseobj_forumid'$collapseobj_forumid);
        
$templater->register('forum'$forum);
        
$templater->register('forumid'$forumid);
        
$templater->register('parent_is_category'$parent_is_category);
    
$forumbits .= $templater->render();

Reply With Quote
  #9  
Old 02-18-2015, 10:56 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try using only this code:

PHP Code:
$forumids explode(',''5,6,7,8');// add vboption after
if (in_array($forum['forumid'], $forumids))
{
   if (
$depth == && $tempext == '_post')
   {
      
$tempext '_post_custom';
   }  

Reply With Quote
Благодарность от:
Easy5s.net
  #10  
Old 02-18-2015, 12:53 PM
Easy5s.net Easy5s.net is offline
 
Join Date: Jun 2011
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

And this plugin, i add

PHP Code:
$vbphrase['last_post'] = '';
$vbphrase['threads_posts'] = ''
To remove Threads / Posts Last Post

but it remove all

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 12:34 AM.


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.04376 seconds
  • Memory Usage 2,277KB
  • Queries Executed 13 (?)
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
  • (6)bbcode_php
  • (1)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
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (1)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)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_postinfo_query
  • fetch_postinfo
  • 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