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
Better "Preview" for templates in the CP Details »»
Better "Preview" for templates in the CP
Version: 1.00, by Admin (Coder) Admin is offline
Developer Last Online: Nov 2024 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 05-21-2002 Last Update: Never Installs: 25
 
No support by the author.

This is a very quick hack that enhaces the "Preview" feature in the Template Editor. Currently I find the preview to be useless, I can also see funky colors and odd tables.
With this hack, you will get a slightly better idea of how the template will really look like, because all the {replacement} variables will be replaced with their real value.

If you have Mutt's "Advanced Template Editor" hack installed, please follow the directions in this post:
https://vborg.vbsupport.ru/showthrea...&postid=253878
Thanks Mutt!


In template.php replace:
PHP Code:
function dotemplatejavascript() {

    
$buttonextra="
<SCRIPT LANGUAGE=\"JavaScript\">
function displayHTML() {
var inf = document.name.template.value;
win = window.open(\", \", 'popup', 'toolbar = no, status = no, scrollbars=yes'); 
With this:
PHP Code:
function dotemplatejavascript() {
    global 
$DB_site$bburl;

    
$replacementsetid 1;    ### Change me to use a different replacement set!

    
$vars $DB_site->query("
        SELECT findword,replaceword FROM replacement
        WHERE replacementsetid IN(-1,'
$replacementsetid')
        ORDER BY replacementsetid DESC,replacementid DESC
    "
);
    while (
$var=$DB_site->fetch_array($vars)) {
        if (
$var['findword']!="") {
            if (
$var['findword'] == '{images[i][/i]folder}'
                
or $var['findword'] == '{titl[i][/i]eimage}'
                
or $var['findword'] == '{newthr[i][/i]eadimage}'
                
or $var['findword'] == '{closed[i][/i]threadimage}') {
                
$var['replaceword'] = $bburl '/' $var['replaceword'];
            }
            
$varinf .= 'inf = replace(inf,"'.addslashes($var['findword']).'","'.addslashes($var['replaceword']).'");
'
;
        }
    }

    
$buttonextra="
<SCRIPT LANGUAGE=\"JavaScript\">

function replace(string,text,by) {
// Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}

function displayHTML() {
var inf = document.name.template.value;
$varinf
win = window.open(\", \", 'popup', 'toolbar=no,status=no,scrollbars=yes,width=800,height=600'); 
You can change the $replacementsetid if you want:
Code:
	$replacementsetid = 1;	### Change me to use a different replacement set!
Enjoy!

Show Your Support

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

Comments
  #22  
Old 05-23-2002, 05:57 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ahhh, life is so much easier now. Thanks, Firefly! (Now I can see all of my mistakes as I do them. )
Reply With Quote
  #23  
Old 05-23-2002, 06:04 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is it just me, or is the PHP code box not clickable now here? I tried it on my sire and I can still click them. But I can't seem to do it here now.
Reply With Quote
  #24  
Old 05-23-2002, 06:07 AM
scsa20's Avatar
scsa20 scsa20 is offline
 
Join Date: Mar 2002
Location: Mars
Posts: 458
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

really, really, nice
Reply With Quote
  #25  
Old 05-23-2002, 06:50 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I removed it Boofo, it became annoying when you just want to copy a small portion of the code.
Reply With Quote
  #26  
Old 05-23-2002, 06:58 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Did it add any extra load to the site? The reason I am asking is I just got it set up on my site and think it is the greatest thing to come along on any system. Do you still have it for the larger code or is it gone altogether? Can it be set up for a certain length of code or higher?

Quote:
Originally posted by FireFly
I removed it Boofo, it became annoying when you just want to copy a small portion of the code.
Reply With Quote
  #27  
Old 05-23-2002, 07:05 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It doesn't add any load, no.
Reply With Quote
  #28  
Old 05-23-2002, 07:07 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I was just curious. What about being able to set it up for a certain size of code or larger? Can that be done?
Reply With Quote
  #29  
Old 05-23-2002, 07:10 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Not sure what you mean, but can you please ask this in the hack's thread? Thanks.
Reply With Quote
  #30  
Old 05-23-2002, 07:20 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

np, sorry.
Reply With Quote
  #31  
Old 05-23-2002, 09:35 AM
FleaBag's Avatar
FleaBag FleaBag is offline
 
Join Date: Dec 2001
Posts: 1,674
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Good work FireFly!
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 10:16 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.06403 seconds
  • Memory Usage 2,319KB
  • 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
  • (1)bbcode_code
  • (2)bbcode_php
  • (1)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
  • (4)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