Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Details »»

Version: 1.00, by Mutt Mutt is offline
Developer Last Online: Mar 2013 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 02-08-2002 Last Update: Never Installs: 16
 
No support by the author.

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.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 02-10-2002, 08:42 PM
the_sisko's Avatar
the_sisko the_sisko is offline
 
Join Date: Oct 2001
Location: Hamburg,Germany
Posts: 132
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nice feature. I like it!
Reply With Quote
  #13  
Old 02-11-2002, 05:07 AM
kippesp kippesp is offline
 
Join Date: Jan 2002
Posts: 52
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #14  
Old 02-11-2002, 06:41 AM
FWC's Avatar
FWC FWC is offline
 
Join Date: Oct 2001
Location: Ontario, CA
Posts: 821
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:
Reply With Quote
  #15  
Old 02-15-2002, 01:12 AM
Mutt's Avatar
Mutt Mutt is offline
 
Join Date: Nov 2001
Posts: 331
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks for the bugfix!! It worked great
Reply With Quote
  #16  
Old 03-10-2002, 05:33 PM
Mutt's Avatar
Mutt Mutt is offline
 
Join Date: Nov 2001
Posts: 331
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #17  
Old 03-10-2002, 10:57 PM
FWC's Avatar
FWC FWC is offline
 
Join Date: Oct 2001
Location: Ontario, CA
Posts: 821
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!!
Reply With Quote
  #18  
Old 03-26-2002, 04:00 PM
Jawelin Jawelin is offline
 
Join Date: Nov 2001
Posts: 557
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 ?
Thanks again.
Reply With Quote
  #19  
Old 06-18-2003, 02:37 PM
Oblivion Knight's Avatar
Oblivion Knight Oblivion Knight is offline
 
Join Date: May 2002
Location: Sheffield, UK
Posts: 1,757
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I seem to be having a problem with this..
Screenshot attached, any help would be much appreciated.
Reply With Quote
  #20  
Old 06-18-2003, 05:02 PM
S.Shady's Avatar
S.Shady S.Shady is offline
 
Join Date: Apr 2003
Location: Cleveland, Ohio
Posts: 179
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Im sorry but i dont understand this

make sure you change '705' to the correct templateid
Reply With Quote
  #21  
Old 06-18-2003, 05:17 PM
squawell's Avatar
squawell squawell is offline
 
Join Date: Oct 2001
Posts: 681
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.....
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 07:50 PM.


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.04760 seconds
  • Memory Usage 2,332KB
  • Queries Executed 25 (?)
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
  • (3)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete