Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons

Reply
 
Thread Tools
Edit StyleVars page Details »»
Edit StyleVars page
Version: 1.3, by Lynne Lynne is offline
Developer Last Online: Oct 2022 Show Printable Version Email this Page

Category: Administrative and Maintenance Tools - Version: 4.1.11 Rating:
Released: 02-08-2011 Last Update: 03-09-2012 Installs: 37
Code Changes  
No support by the author.

This is just a new page for showing the .css template and having all the stylevars clickable and then editable in the bottom screen. This uses iframes, so if you browser doesn't support that, then it won't work and I cannot help you with this.

You will need to open up and edit the admincp/template.php file.

**edited for 4.1.11 below** Basically just add the code in red to the existing code.

Find (under $_REQUEST['do'] = 'add'):
Code:
    print_textarea_row($vbphrase['template'] . '
            <br /><br />
            <span class="smallfont">' .
            iif($vbulletin->GPC['title'], construct_link_code($vbphrase['show_default'], "template.php?" . $vbulletin->session->vars['sessionurl'] . "do=view&amp;title=" . $vbulletin->GPC['title'], 1) . '<br /><br />', '') .
            '<!--' . $vbphrase['wrap_text'] . '<input type="checkbox" unselectable="on" onclick="set_wordwrap(\'ta_template\', this.checked);" accesskey="w" checked="checked" />-->
            </span>',
        'template', $templateinfo['template_un'], 22, '5000" style="width:99%', true, true, 'ltr', 'code');
Change to:
Code:
    $isscss = strpos($vbulletin->GPC['title'],'.css');    
    print_textarea_row($vbphrase['template'] . '
            <br /><br />
            <span class="smallfont">' .
            iif($vbulletin->GPC['title'], construct_link_code($vbphrase['show_default'], "template.php?" . $vbulletin->session->vars['sessionurl'] . "do=view&amp;title=" . $vbulletin->GPC['title'], 1) . '<br /><br />', '') . 
iif($isscss === false AND $vbulletin->GPC['dostyleid'] != -1, '', construct_link_code('Edit StyleVars', "template.php?" . $vbulletin->session->vars['sessionurl'] . "do=editcss&amp;dostyleid=" .
                $vbulletin->GPC['dostyleid'] . "&amp;title=". $vbulletin->GPC['title']."&amp;templateid=" .
                $vbulletin->GPC['templateid'], 1) . '<br /><br />') .
            '<!--' . $vbphrase['wrap_text'] . '<input type="checkbox" unselectable="on" onclick="set_wordwrap(\'ta_template\', this.checked);" accesskey="w" checked="checked" />-->
            </span>',
        'template', $templateinfo['template_un'], 22, '5000" style="width:99%', true, true, 'ltr', 'code');
Then find (under $_REQUEST['do'] = 'edit'):
Code:
    print_textarea_row($vbphrase['template'] . '
            <br /><br />
            <span class="smallfont">' .
            iif($template['styleid'] != -1, construct_link_code($vbphrase['show_default'], "template.php?" . $vbulletin->session->vars['sessionurl'] . "do=view&amp;title=$template[title]", 1) . '<br /><br />', '') .
            '<!--' . $vbphrase['wrap_text'] . '<input type="checkbox" unselectable="on" onclick="set_wordwrap(\'ta_template\', this.checked);" accesskey="w" checked="checked" />-->
            </span>',
        'template', $text, 22, '5000" style="width:99%', true, true, 'ltr', 'code');
Change to:
Code:
    $isscss = strpos($template[title],'.css');    
    print_textarea_row($vbphrase['template'] . '
            <br /><br />
            <span class="smallfont">' .
            iif($template['styleid'] != -1, construct_link_code($vbphrase['show_default'], "template.php?" . $vbulletin->session->vars['sessionurl'] . "do=view&amp;title=$template[title]", 1) . '<br /><br />', '') . 
iif($isscss === false AND $template['styleid'] != -1, '', construct_link_code('Edit StyleVars', "template.php?" . $vbulletin->session->vars['sessionurl'] . "do=editcss&amp;dostyleid=" .
                $template['styleid'] . "&amp;templateid=$template[templateid]", 1) . '<br /><br />') .
            '<!--' . $vbphrase['wrap_text'] . '<input type="checkbox" unselectable="on" onclick="set_wordwrap(\'ta_template\', this.checked);" accesskey="w" checked="checked" />-->
            </span>',
        'template', $text, 22, '5000" style="width:99%', true, true, 'ltr', 'code');
Then find (at the bottom of the page):
PHP Code:
print_cp_footer(); 
Add above:
PHP Code:
// #############################################################################
// add a new page to edit stylevars
if ($_REQUEST['do'] == 'editcss')
{
require_once(
DIR '/includes/adminfunctions_stylevar.php');

    
$vbulletin->input->clean_array_gpc('r', array(
        
'title'        => TYPE_STR,
        
'group'        => TYPE_STR,
        
'searchstring' => TYPE_STR,
        
'expandset'    => TYPE_STR,
    ));

if (
$vbulletin->GPC['dostyleid'] == -1)
    {
        
$style['title'] = $vbphrase['global_templates'];
    }
    else
    {
        
$style $db->query_first("SELECT title FROM " TABLE_PREFIX "style WHERE styleid = " $vbulletin->GPC['dostyleid']);
    }

    if (
$vbulletin->GPC['title'])
    {
        
$templateinfo $db->query_first("
            SELECT * FROM " 
TABLE_PREFIX "template
            WHERE styleid IN (-1,0) AND title = '" 
$db->escape_string($vbulletin->GPC['title']) . "'
        "
);
    }
    else if (
$vbulletin->GPC['templateid'])
    {
        
$templateinfo $db->query_first("SELECT * FROM " TABLE_PREFIX "template WHERE templateid = " $vbulletin->GPC['templateid']);
        
$vbulletin->GPC['title'] = $templateinfo['title'];
    } 
        

$prepend '<style type="text/css">
.edit_scroller {
    width:100%;
    min-height:300px;
    max-height: 350px;
    max-width: 800px;
    overflow: auto;
    border: 1px solid black;
}
</style>'
;
    
    echo 
$prepend;

    
print_table_start();
    
print_table_header('Edit StyleVars');

    
construct_hidden_code('group'$vbulletin->GPC['group']);

    
$products fetch_product_list();

    if (
$vbulletin->GPC['title'])
    {
        
construct_hidden_code('product'$templateinfo['product']);
        
print_label_row($vbphrase['product'], $products["$templateinfo[product]"]);
    }
    else if (
$vbulletin->debug)
    {
        
print_select_row($vbphrase['product'], 'product'$products$templateinfo['product']);
    }
    else
    { 
// use the default as we dictate in inserttemplate, if they dont have debug mode on they can't add templates to -1 anyway
        
construct_hidden_code('product''vbulletin');
    }

    
construct_hidden_code('templateid'$templateinfo['templateid']);
    
construct_hidden_code('expandset'$vbulletin->GPC['expandset']);
    
construct_hidden_code('searchset'$vbulletin->GPC['expandset']);
    
construct_hidden_code('searchstring'$vbulletin->GPC['searchstring']);
    
print_style_chooser_row('dostyleid'$vbulletin->GPC['dostyleid'], $vbphrase['master_style'], $vbphrase['style'], iif($vbulletin->debug == 110));
    
    
$stylevars fetch_stylevars_array();

    
$templateinfo['template_new'] = $templateinfo['template_un'];
    
    
$groups array_keys($stylevars);
    foreach(
$groups AS $group)
    {
        
$stylevarids array_keys($stylevars[$group]);
        foreach (
$stylevarids AS $stylevarid)
        {
            if (
$stylevarid)
            {
                
$find = array('/\{vb:stylevar '.$stylevarid.'\}/','/\{vb:stylevar '.$stylevarid.'(\\.([^}]*))\}/');
                
$replace "<a href=\"stylevar.php?" $vbulletin->session->vars['sessionurl'] . "do=fetchstylevareditor&amp;stylevarid[]=" $stylevarid "&amp;dostyleid=" $vbulletin->GPC['dostyleid'] . "\" target=\"see_stylevar\">{vb:stylevar ".$stylevarid."$1}</a>";
        
                
$templateinfo['template_new'] = preg_replace($find$replace$templateinfo['template_new']);
            }    
        }
    }
    
    
print_input_row(
        
$vbphrase['title'],
        
'title',
        
$vbulletin->GPC['title']);
    
print_label_row($vbphrase['template'],
        
'<div class="alt1 edit_scroller"><pre>' $templateinfo['template_new'] . '</pre></div>');
        
    
print_label_row($vbphrase['stylevar'], '<iframe name="see_stylevar" id="edit_scroller" class="alt2 edit_scroller"></iframe>');

    
print_table_footer();


Now when you go to Style Manager > find Style > Edit Templates and click on a .css template to edit (it will ONLY work in .css templates!), you will have the new option on the left to "Edit StyleVars".



If you click that, you get a new tab with the .css template in the top box (not editable on this page) and it has all the *editable* stylevars clickable (for example, in userprofile.css, they use variables, not stylevars, so you won't have clickable stylevars there). If you click on a stylevar, it will open in the bottom of the window and you may edit.





Tested in Firefox, Safari, Chrome, and Opera on my Mac.

And thank you to ForumsMods for sharing a diff file - patch.zip (for version 1.1, which works, but doesn't have css changes)

1.2 - 2011-02-11 - changed some CSS for the divs and fixed a phrase.
1.3 - 2012-03-10 - added a file with the changes needed for 4.1.11

Download Now

File Type: zip Edit StyleVars1.3.zip (188.5 KB, 42 views)

Screenshots

File Type: png editstylevars1.png (30.4 KB, 0 views)
File Type: png editstylevars2.png (31.2 KB, 0 views)
File Type: png editstylevars3.png (121.6 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Благодарность от:
Hippy

Comments
  #32  
Old 09-19-2011, 05:42 PM
FReeSTER FReeSTER is offline
 
Join Date: Jun 2006
Location: Rome
Posts: 730
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok reporting back. I double checked all of my edits and I found 4 of them were merged so I fixed but results still the same
Reply With Quote
  #33  
Old 09-19-2011, 08:42 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I would suggest starting with a totally new file and redoing the file edits. Only this time, make sure you put the code on their own lines and not merge lines at all.
Reply With Quote
  #34  
Old 10-10-2011, 07:28 PM
Hippy's Avatar
Hippy Hippy is offline
 
Join Date: Dec 2001
Location: USA, New Jersey
Posts: 2,392
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I pulled the changes out from the code it self and added it in it's correct line since a couple things changed since then..this worked up till 4.1.6 then 4.1.7 it will no longer work..
the edits where perfect.. did it 2 times to make sure , used compareit..
when you click on the style manager in the admincp you just get a blank screen

code used ..
PHP Code:
$isscss strpos($vbulletin->GPC['title'],'.css'); 
PHP Code:
iif($isscss === false AND $vbulletin->GPC['dostyleid'] != -1''construct_link_code('Edit StyleVars'"template.php?" $vbulletin->session->vars['sessionurl'] . "do=editcss&amp;dostyleid=" 
PHP Code:
iif($isscss === false AND $template['styleid'] != -1''construct_link_code('Edit StyleVars'"template.php?" $vbulletin->session->vars['sessionurl'] . "do=editcss&amp;dostyleid=" 
and the large chunk of code above
Code:
 print_cp_footer();

any help with this would be great
thanks for sharing this great mod lynne
Reply With Quote
  #35  
Old 10-10-2011, 07:48 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I just went through and modified my template.php file for 4.1.7 using the instructions in post 1 and it is working just fine on my site. I am getting no blank screens. I'd suggest you check your error_logs.
Reply With Quote
  #36  
Old 10-10-2011, 08:31 PM
Hippy's Avatar
Hippy Hippy is offline
 
Join Date: Dec 2001
Location: USA, New Jersey
Posts: 2,392
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yep I should of though of that ..
this is the error
PHP Parse error: syntax error, unexpected ';' in /public_html/testvb/admincp/template.php on line 2224,
line 2224 is
Code:
'template', $templateinfo['template_un'], 22, '5000" style="width:99%', true, true, 'ltr', 'code');
this is under 3 lines under the first edit..
this line was not even touched
Reply With Quote
  #37  
Old 10-10-2011, 08:35 PM
Hippy's Avatar
Hippy Hippy is offline
 
Join Date: Dec 2001
Location: USA, New Jersey
Posts: 2,392
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

my bad I see where I went wrong...
Reply With Quote
  #38  
Old 10-10-2011, 09:14 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Glad you got it figured out.
Reply With Quote
  #39  
Old 10-10-2011, 09:27 PM
Hippy's Avatar
Hippy Hippy is offline
 
Join Date: Dec 2001
Location: USA, New Jersey
Posts: 2,392
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks you for providing this for everyone..
should be default with vb..

I don't know what I was thinking when I was editing that file..
I been fixing so much broken stuff these past few days.. I need a break to get back on track..

once again
your efforts and support are very much appreciated..
Reply With Quote
  #40  
Old 10-15-2011, 02:30 PM
voglermc's Avatar
voglermc voglermc is offline
 
Join Date: Oct 2006
Location: Piedmont Triad, NC, USA
Posts: 295
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sweet!
Reply With Quote
  #41  
Old 01-08-2012, 03:27 PM
Hippy's Avatar
Hippy Hippy is offline
 
Join Date: Dec 2001
Location: USA, New Jersey
Posts: 2,392
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Lynne
this was driving me crazy today

after checking over and over my edits .. I realized this was not a edit issue it was a IE9 issue..
I checked in ff and worked like it should..

whats happening is everytime you mouse over a style var in the template the space between the 2 boxes grow

I attached a couple screen shots so you can see what I mean..

thanks
Attached Images
File Type: jpg stylevar.jpg (76.7 KB, 0 views)
File Type: jpg stylevar-issue.jpg (59.7 KB, 0 views)
Reply With Quote
Reply

Thread Tools

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 12:28 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.04665 seconds
  • Memory Usage 2,402KB
  • Queries Executed 26 (?)
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
  • (6)bbcode_code
  • (5)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (1)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (6)postbit_attachment
  • (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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete