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

the_sisko 02-10-2002 08:42 PM

nice feature. I like it!

kippesp 02-11-2002 05:07 AM

Quote:

Originally posted by FireFly
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. :)

I didn't duplicate this in my browser. But from your screenshot, I had similar indentation issues. The attached modified hack may correct this since some tags were left unterminatd.

I also enhanced the hack a bit by giving the anchor/target different values for the custom templates. (Expanding on a default template would jump me to the custom template group if it exists.) All same-named groups are still expanded, but at least the anchor gets you to the right spot.

The attached file is the same hack with two minor changes.

FWC 02-11-2002 06:41 AM

Quote:

Originally posted by kippesp
I also enhanced the hack a bit by giving the anchor/target different values for the custom templates. (Expanding on a default template would jump me to the custom template group if it exists.) All same-named groups are still expanded, but at least the anchor gets you to the right spot.
Nice upgrade, kippesp. Works quite well. :up:

Mutt 02-15-2002 01:12 AM

thanks for the bugfix!! It worked great

Mutt 03-10-2002 05:33 PM

Now you can add new template groups right from the CP

I rewrote the original directions to include the new cp addon and kippesp's bugfix / addon.

thanks to kippesp & Firefly for thier help

FWC 03-10-2002 10:57 PM

Quote:

Originally posted by Mutt
Now you can add new template groups right from the CP

Outstanding, Mutt! I loved the original hack. I put the new version on when I upgraded to 2.2.4 this morning. This hack rules!! :cool:

Jawelin 03-26-2002 04:00 PM

Great hack !!!
Till now I used your old one adding groups to template.php, but this one is much better!!!
Thanks.

Just one thing. As I don't like to fix the templateid within the php code (it isn't ever done even for options template... ;)), I made this slight upgrade:

PHP Code:

// change
  
template.php?s=&action=customedit&templateid=xx

// into
  
template.php?s=&action=customedit&templatename=templategroups


// and


// change
  
$templates=$DB_site->query("SELECT templateid,templatesetid,title,template FROM template WHERE templateid=$templateid");
  
$template=$DB_site->fetch_array($templates);

// into
  
if (isset($templatename))
     
$templates=$DB_site->query("SELECT templateid,templatesetid,title,template FROM template WHERE title='$templatename'");
  else
     
$templates=$DB_site->query("SELECT templateid,templatesetid,title,template FROM template WHERE templateid='$templateid'");

  
$template=$DB_site->fetch_array($templates); 

What do you think about ? :D
Thanks again.

Oblivion Knight 06-18-2003 02:37 PM

I seem to be having a problem with this.. :(
Screenshot attached, any help would be much appreciated.

S.Shady 06-18-2003 05:02 PM

Im sorry but i dont understand this

make sure you change '705' to the correct templateid

squawell 06-18-2003 05:17 PM

Quote:

Today at 02:02 AM S.Shady said this in Post #19
Im sorry but i dont understand this

make sure you change '705' to the correct templateid

i think 705 is his style template id....the default style templateid=1

so... i think that should be his mean.....

gmarik 06-18-2003 05:27 PM

And how about 2.3?
This is what would be good on vB3 too.

S.Shady 06-18-2003 05:48 PM

it worked fine on 2.3 but i added the fix by Jawelin and i was getting db errors. ill try again later.

the error with the miss align is still here though

Red Blaze 10-14-2003 05:29 PM

Wooow, so much cleaner. I love it, thanks alot for sharing this. ^___^


All times are GMT. The time now is 05:38 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.01920 seconds
  • Memory Usage 1,786KB
  • 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
  • (3)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (23)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete