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

Reply
 
Thread Tools
Post Icons - drop down list (good for lots of icons!) Details »»
Post Icons - drop down list (good for lots of icons!)
Version: 1.00, by Gary King Gary King is offline
Developer Last Online: Jun 2020 Show Printable Version Email this Page

Version: 3.0.0 Rating:
Released: 03-15-2004 Last Update: Never Installs: 17
 
No support by the author.

This hack will put all the post icons into a dropdown list instead, which will save lots of space especially if you have lots of post icons available (or WANT to have a lot of post icons available )

Look at attached screenshot to see how it looks like
If you have a suggestion, let me know!

Anyways, here we go

Please make sure that all your icons have a title because this title will be shown in the dropdown menu! Otherwise it will be blank; it will still work and people can select it, but it doesn't help in knowing what the icon will show

Instructions

Open up includes/functions_newpost.php and find
PHP Code:
        if ($seliconid == $iconid)
        {
            
$iconchecked HTML_CHECKED;
            
$selectedicon = array('src' => $iconpath'alt' => $alttext);
        }
        else
        {
            
$iconchecked '';
        } 
Replace with
PHP Code:
    if ($seliconid == $iconid
    { 
        if (
$show['dropdownicons']) 
        { 
            
$iconselect " selected"
        } 
        else 
        { 
            
$iconchecked HTML_CHECKED
            
$selectedicon = array('src' => $iconpath'alt' => $alttext); 
        } 
    } 
    else 
    { 
        if (
$show['dropdownicons']) 
        { 
            
$iconselect ''
        } 
        else 
        { 
            
$iconchecked ''
        } 
    } 
Find:
PHP Code:
    $show['posticons'] = false
Below, add
PHP Code:
    $show['dropdownicons'] = 1;

    if (
$show['dropdownicons'])
    {
        
$posticondropdown '<option value="0">' $vbphrase[no_icon] . '</option>';

    } 
Find:
PHP Code:
        eval('$posticonbits .= "' fetch_template('posticonbit') . '";'); 
Below, add
PHP Code:
        eval('$posticondropdown .= "' fetch_template('posticon_dropdown') . '";'); 
Open up posticons template and find
HTML Code:
				<td width="12%" nowrap="nowrap"><label for="rb_iconid_0"><input type="radio" name="iconid" value="0" id="rb_iconid_0" tabindex="1" onclick="swap_posticon(null)" $iconchecked />$vbphrase[no_icon] &nbsp; &nbsp;</label></td>
				$posticonbits
Replace it with
HTML Code:
				<if condition="$show['dropdownicons']"><td><select name="iconid" id="iconid" onchange="changeImage(this.value)">$posticondropdown</select> <img id="posticonimage" /></td><else /><td width="12%" nowrap="nowrap"><label for="rb_iconid_0"><input type="radio" name="iconid" value="0" id="rb_iconid_0" tabindex="1" onclick="swap_posticon(null)" $iconchecked />$vbphrase[no_icon] &nbsp; &nbsp;</label></td>$posticonbits</if>
Find
HTML Code:
	// -->
Above, add
HTML Code:
	<if condition="$show['dropdownicons']">
function changeImage(selVal)
{
if (selVal != 0)
{
 document.getElementById('posticonimage').src = selVal;
}
else
{
document.getElementById('posticonimage').src = 'clear.gif';
}
}
	</if>
Create a new template called posticon_dropdown with the following content:
HTML Code:
<option value="$iconpath"$iconselect>$alttext</option>
All done! Now if you ever want to turn this off and use the old way of viewing post icons, then just change $show['dropdownicons'] = 1; in includes/functions_newpost.php to $show['dropdownicons'] = 0; (basically just change 1 to 0.)

I hope you enjoy this hack

Show Your Support

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

Comments
  #2  
Old 03-16-2004, 07:59 PM
Owen Owen is offline
 
Join Date: Jan 2002
Posts: 163
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

how much good is this if it doesnt show the actual icons in the list?
Reply With Quote
  #3  
Old 03-16-2004, 08:15 PM
Gary King's Avatar
Gary King Gary King is offline
 
Join Date: Jan 2002
Posts: 2,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If someone has the Javascript where I can display the image depending on the value selected, then I would be more than happy to add it in
Reply With Quote
  #4  
Old 03-16-2004, 08:22 PM
Owen Owen is offline
 
Join Date: Jan 2002
Posts: 163
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I dont think its possible with regular drop down menu's... Maybe its possible to use one of those vb3 dropdown menu's?
Reply With Quote
  #5  
Old 03-16-2004, 08:30 PM
Gary King's Avatar
Gary King Gary King is offline
 
Join Date: Jan 2002
Posts: 2,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nevermind I got it I will add it in a sec
Reply With Quote
  #6  
Old 03-16-2004, 08:39 PM
Gary King's Avatar
Gary King Gary King is offline
 
Join Date: Jan 2002
Posts: 2,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay updated It now shows the icons - BUT, it will only work when icons are in the images/icons/ folder and in the correct file format, for now. So it will work with default vB3 icons. If you add any new icons, just make sure they are the same format and same folder.
Reply With Quote
  #7  
Old 03-16-2004, 08:48 PM
alkatraz alkatraz is offline
 
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 384
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

cool hack!
Reply With Quote
  #8  
Old 03-17-2004, 12:20 AM
Pikok Pikok is offline
 
Join Date: Jul 2002
Posts: 53
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Gary W
Okay updated It now shows the icons - BUT, it will only work when icons are in the images/icons/ folder and in the correct file format, for now. So it will work with default vB3 icons. If you add any new icons, just make sure they are the same format and same folder.
Why not use this in includes/functions_newpost.php:
PHP Code:
        if ($seliconid == $iconid)
        {
            if (
$show['dropdownicons'])
            {
                
$iconselect " selected";
            }
            else
            {
                
$iconchecked HTML_CHECKED;
                
$selectedicon = array('src' => $iconpath'alt' => $alttext);
            }
        }
        else
        {
            if (
$show['dropdownicons'])
            {
                
$iconselect '';
            }
            else
            {
                
$iconchecked '';
            }
        } 
This in the posticons template:
Code:
	function changeImage(selVal)
	{
		if (selVal != 0)
		{
		 	document.getElementById('posticonimage').src = selVal;	
		}
		else
		{
			document.getElementById('posticonimage').src = 'clear.gif';
		}
	}
This in the posticon_dropdown template:
Code:
<option value="$iconpath"$iconselect>$alttext</option>
That would use the correct SRC path for all icons and would also have the icon pre-selected if the post already had one (i.e. when editing).
Reply With Quote
  #9  
Old 03-17-2004, 12:48 AM
Gary King's Avatar
Gary King Gary King is offline
 
Join Date: Jan 2002
Posts: 2,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Pikok
Why not use this in includes/functions_newpost.php:
PHP Code:
        if ($seliconid == $iconid)
        {
            if (
$show['dropdownicons'])
            {
                
$iconselect " selected";
            }
            else
            {
                
$iconchecked HTML_CHECKED;
                
$selectedicon = array('src' => $iconpath'alt' => $alttext);
            }
        }
        else
        {
            if (
$show['dropdownicons'])
            {
                
$iconselect '';
            }
            else
            {
                
$iconchecked '';
            }
        } 
This in the posticons template:
Code:
	function changeImage(selVal)
	{
		if (selVal != 0)
		{
		 	document.getElementById('posticonimage').src = selVal;	
		}
		else
		{
			document.getElementById('posticonimage').src = 'clear.gif';
		}
	}
This in the posticon_dropdown template:
Code:
<option value="$iconpath"$iconselect>$alttext</option>
That would use the correct SRC path for all icons and would also have the icon pre-selected if the post already had one (i.e. when editing).
Okay I integrated your steps now
Reply With Quote
  #10  
Old 03-17-2004, 03:15 AM
gmarik's Avatar
gmarik gmarik is offline
 
Join Date: May 2002
Location: Mocsow
Posts: 1,288
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This one is good for coding similiar hacks, great one!
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 01:18 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.04642 seconds
  • Memory Usage 2,354KB
  • Queries Executed 23 (?)
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
  • (4)bbcode_code
  • (5)bbcode_html
  • (8)bbcode_php
  • (2)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
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)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