vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Groups for Custom Templates (https://vborg.vbsupport.ru/showthread.php?t=34919)

Mutt 02-08-2002 10:00 PM

I was getting my templates ready to upgrade to 2.2.2 and I came up with this idea. vbLinks set it's templates as part of the default set and needed to be changed over to custom templates.

the default templates are seperated into groups, but when you make a bunch of custom templates, wouldn't it be nice to have them be grouped as well? Anyway, it was really easy.

open template.php and scroll down to the "Start Modify" section

you'll see

$only['calendar'] = 'Calendar';
$only['emailsubject'] = 'Email Subject';
etc.

they are set up like this
$only['**begining of template title**'] = '**Group Title**';

name your template something like
links_firsttemplate
links_secondtempate

then with all the other $only[*] lines add
$only['links'] = 'vbLinks';

links is the begining of all the links templates and vbLinks is the title for the group of templates

maybe later I'll make a admin cp form to add the group titles but for now just add them to template.php


just making these changes would make the new groups show up under the default templates, but to make them appear in the custom section

find
PHP Code:

    while ($template=$DB_site->fetch_array($templates)) {
      if (!
$donecustom) {
        
$donecustom=1;
        echo 
"<b>Custom templates</b>";
      } 

right below it add
PHP Code:

      $under 0;
      
reset($only);
      while(list(
$text,$display)=each($only)) {
        if (
strpos($template[title]"$text)==1) {
          
$under $display;
          
$shortname $text;
          break;
        }
      }

        if (
$under) {
          if (
$lastunder!=$under and $lastunder and $shrink) {
            echo 
"</ul></li>\n";
            
$shrink 0;
          }

          
$lastunder $under;
          if (!
$shrink) {
            echo 
"<li><a name=\"".urlencode($shortname)."\"><b></a>$under Templates <a href=\"template.php?s=$session[sessionhash]&action=modify&expandset=$templateset[templatesetid]&group=".urlencode($shortname)."#".urlencode($shortname)."\">[expand]</a></b>\n<ul>\n";
          }
          
$shrink 1;
          if (
$group!=$shortname and $group!="all") {
            continue;
          }
        } else {
          if (
$shrink) {
            echo 
"</ul></li>\n";
          }
          
$shrink 0;
        } 

(I just grabed this from the default template section)

thats it. now your custom template will be grouped as well.

whats real nice is say you added some custom templates that should be grouped with the default ones like new error message, postbit, or getinfo templates, they will not only get grouped with that group name under custom templates, but when you expand the default postbit templates, the custom postbit templates will be expanded as well.


If I missed something let me know.

afterlab 02-09-2002 06:06 PM

Nice idea. I was wondering about this the other day. Thanks for sharing the hack, I look forward to installing and using it shortly.

FWC 02-09-2002 07:30 PM

Well done, Mutt! My template listings are so much cleaner now. :)

LuBi 02-10-2002 01:18 AM

screen shot!

Mutt 02-10-2002 12:10 PM

OK, here's a screen shot. I didn't think you'd need one. it looks just like the Default templates are organized

Jawelin 02-10-2002 12:16 PM

Evil's Advocate question: does it work with FireFly's TBS hack ?
I make an extensive use of it and wouldn't create uncompatibilities... ;)
Thnx

Admin 02-10-2002 12:39 PM

Quote:

Originally posted by Jawelin
Evil's Advocate question: does it work with FireFly's TBS hack ?
I make an extensive use of it and wouldn't create uncompatibilities... ;)
Thnx

My hack is completely independent so you shouldn't worry.
I'm gonna install this hack myself soon (since I pretty much have more custom templates than default... I think ;)).

Oh, and I think it's Devil's advocate. ;) :)

Admin 02-10-2002 12:43 PM

Working great, good hack. :)

Admin 02-10-2002 12:49 PM

It appears that if you group the last template under a category the category is not closed and this what happens (attached).

I couldn't care less but just thought I'd let you know. :)

Jawelin 02-10-2002 06:23 PM

Quote:

Originally posted by FireFly

My hack is completely independent so you shouldn't worry.
[...]
Oh, and I think it's Devil's advocate. ;) :)

Of course... :)
MisTYPO!

Actually I didn't realize that groups are built only at displaying time... Though they where folders of templates... ;)
Sorry for such a silly question
Thnx


All times are GMT. The time now is 11:19 AM.

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.01033 seconds
  • Memory Usage 1,755KB
  • 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
  • (2)bbcode_php_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