vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   How to write plugins replace temp (https://vborg.vbsupport.ru/showthread.php?t=317390)

Easy5s.net 02-18-2015 08:31 AM

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 :)

kh99 02-18-2015 08:43 AM

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.

Easy5s.net 02-18-2015 09:50 AM

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

kh99 02-18-2015 09:59 AM

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.

Zachery 02-18-2015 10:25 AM

Why wouldn't you just update the contents of that template with your own template code..

Easy5s.net 02-18-2015 10:44 AM

Dup temp ?
https://vborg.vbsupport.ru/external/2015/02/13.png

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

kh99 02-18-2015 10:46 AM

What plugin code are you using now?

Easy5s.net 02-18-2015 10:49 AM

Quote:

Originally Posted by kh99 (Post 2537846)
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();



kh99 02-18-2015 10:56 AM

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';
   }  



Easy5s.net 02-18-2015 12:53 PM

And this plugin, i add

PHP Code:

$vbphrase['last_post'] = '';
$vbphrase['threads_posts'] = ''

To remove Threads / Posts Last Post

but it remove all

https://vborg.vbsupport.ru/external/2015/02/12.png


All times are GMT. The time now is 04:02 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.01256 seconds
  • Memory Usage 1,763KB
  • 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
  • (6)bbcode_php_printable
  • (1)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
  • (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