View Full Version : Post Icons - drop down list (good for lots of icons!)
Gary King
03-15-2004, 10:00 PM
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
if ($seliconid == $iconid)
{
$iconchecked = HTML_CHECKED;
$selectedicon = array('src' => $iconpath, 'alt' => $alttext);
}
else
{
$iconchecked = '';
}
Replace with 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: $show['posticons'] = false;
Below, add $show['dropdownicons'] = 1;
if ($show['dropdownicons'])
{
$posticondropdown = '<option value="0">' . $vbphrase[no_icon] . '</option>';
}
Find: eval('$posticonbits .= "' . fetch_template('posticonbit') . '";');
Below, add eval('$posticondropdown .= "' . fetch_template('posticon_dropdown') . '";');
Open up posticons template and find <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] </label></td>
$posticonbits
Replace it with <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] </label></td>$posticonbits</if>
Find // -->
Above, add <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:<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 :p
how much good is this if it doesnt show the actual icons in the list?
Gary King
03-16-2004, 08:15 PM
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 :)
I dont think its possible with regular drop down menu's... Maybe its possible to use one of those vb3 dropdown menu's?
Gary King
03-16-2004, 08:30 PM
Nevermind I got it :) I will add it in a sec :)
Gary King
03-16-2004, 08:39 PM
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.
alkatraz
03-16-2004, 08:48 PM
cool hack!
Pikok
03-17-2004, 12:20 AM
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: 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: function changeImage(selVal)
{
if (selVal != 0)
{
document.getElementById('posticonimage').src = selVal;
}
else
{
document.getElementById('posticonimage').src = 'clear.gif';
}
}
This in the posticon_dropdown template:<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).
Gary King
03-17-2004, 12:48 AM
Why not use this in includes/functions_newpost.php: 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: function changeImage(selVal)
{
if (selVal != 0)
{
document.getElementById('posticonimage').src = selVal;
}
else
{
document.getElementById('posticonimage').src = 'clear.gif';
}
}
This in the posticon_dropdown template:<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 :)
gmarik
03-17-2004, 03:15 AM
This one is good for coding similiar hacks, great one!
ah nifty, forgot to think you could load the image next to it.
Good Work.
For some reason, i now have dropdown AND the original list to chose from.
Any idea what could be wrong?
Gary King
03-20-2004, 01:14 PM
For some reason, i now have dropdown AND the original list to chose from.
Any idea what could be wrong?
You didn't follow instructions properly then :)
The code you did wrong was in the posticons template.
hmm i just double checked and everything is like it should be. afaik :(
<if condition="$show['posticons']">
<script type="text/javascript">
<!--
function swap_posticon(imgid)
{
out = fetch_object("display_posticon");
img = fetch_object(imgid);
if (img)
{
out.src = img.src;
out.alt = img.alt;
}
else
{
out.src = "$vboptions[cleargifurl]";
out.alt = "";
}
}
<if condition="$show['dropdownicons']">
function changeImage(selVal)
{
if (selVal != 0)
{
document.getElementById('posticonimage').src = selVal;
}
else
{
document.getElementById('posticonimage').src = 'clear.gif';
}
}
</if>
// -->
</script>
<fieldset class="fieldset" style="margin:10px 0px 0px 0px">
<legend>$vbphrase[post_icons]</legend>
<div style="padding:$stylevar[formspacer]px">
<table cellpadding="0" cellspacing="$stylevar[cellspacing]" border="0" width="95%">
<tr>
<td colspan="15"><div style="margin-bottom:$stylevar[formspacer]px">$vbphrase[may_choose_icon_for_message]:</div></td>
</tr>
<tr>
<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] </label></td>$posticonbits</if>
$posticonbits
<if condition="$show['addedspan']"><td colspan="$remainingspan"> </td></if>
</tr>
</table>
</div>
</fieldset>
<else />
<input type="hidden" name="iconid" value="0" />
</if>
Gary King
03-20-2004, 04:06 PM
hmm i just double checked and everything is like it should be. afaik :(
Can I please see your forums then.
<a href="http://forums.soi-guild.org" target="_blank">http://forums.soi-guild.org</a>
test/test u can login with !
and thanks !
Gary King
03-20-2004, 04:26 PM
Weird, maybe a problem with Gold? Although I sincerely doubt it; it looks like it has something to do with the conditionals but that should be fine.
How it is right now is that you can change between the two, but to fix this for you, simply do the following then:
open the posticons template, find:
<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] </label></td>$posticonbits
And then just delete that :)
u are god ! thanks man.
one last question when u click on new thread
no icon is picked this gif file logol shows up. how can i get rid of this?"
Gary King
03-20-2004, 04:32 PM
What do you mean? Please make a screenshot and circle it.
As you can see they are still there :( And i circled the gif thing.
<if condition="$show['dropdownicons']"><td><select name="iconid" id="iconid" onchange="changeImage(this.value)">$posticondropdown</select> <img id="posticonimage" /></td></if>
thats whats i got in posticon template now.
Gary King
03-20-2004, 05:57 PM
Wow, you have something really messed up there; you removed the code from the template but it still shows? :eek:
Make sure you modify the correct styleset.
i don't understand lol i added posticons template in the SOI style. (which is style i use) and they are sitll there lol.
what about that image btw ? and thanks loads ! i really want this to work since it's godly, i am not giving up :)
Gary King
03-20-2004, 06:38 PM
I can't believe what's going on, something is broken :p
I can't really help you much farther in terms of removing the post icons radio buttons because it shouldn't be there in the first place.
LOL i turned the 1 into a 0 in the functions_newpost.php
and now all icons are there twice
Gary King
03-20-2004, 07:26 PM
Yep that's why it should be 1.
ok not sure how when and why, but i fixed it !
Just that little graphics shows up. If i pick another icon and then go back to " no icon" it's no longer there.
Gary King
03-20-2004, 07:45 PM
Yep it's a Javascript thing, it's not really that important but if someone wants to try to fix it to be my guest :)
Tim Wheatley
03-20-2004, 10:11 PM
Can I please see your forums then.
Works perfectly with vB3 Gold here. :up:
Just a note for future users, in order for the text to show in the list, you must have edited the titles/names in your cp here:
www.yourdomain.com/admincp/image.php?do=modify&table=icon
Gary King
03-20-2004, 10:30 PM
Works perfectly with vB3 Gold here. :up:
Just a note for future users, in order for the text to show in the list, you must have edited the titles/names in your cp here:
www.yourdomain.com/admincp/image.php?do=modify&table=icon
Good idea about notifying that, I added in the post :)
wrongful
03-21-2004, 04:27 AM
Does anyone know a way to make the "No Icon" selection show the default icon?
oh my god....
I thought everything worked fine, but when i select and icon when posting it doesn't showup !
Anyone have any clue what i could have messed up this time?
noonespecial
04-02-2004, 06:29 AM
oh my god....
I thought everything worked fine, but when i select and icon when posting it doesn't showup !
Anyone have any clue what i could have messed up this time?
exact same issue ..
everything looks like it works, i can select the icon, it shows up next to it .. then i push post, and no icon appears in the forum.. ?!
Jolten
04-02-2004, 07:44 AM
Find // -->
Above, add <if condition="$show['dropdownicons']">
function changeImage(selVal)
{
if (selVal != 0)
{
document.getElementById('posticonimage').src = selVal;
}
else
{
document.getElementById('posticonimage').src = 'clear.gif';
}
}
</if>
Where do these steps go??
noonespecial
04-02-2004, 07:48 AM
Where do these steps go??
posticon template.
Jolten
04-02-2004, 08:02 AM
Thanks noonespecial.
I've got the same issue as others. It appears to work. But back in thread view no icons change. They only appear to change when you select them from the menu.
noonespecial
04-02-2004, 09:26 AM
Thanks noonespecial.
I've got the same issue as others. It appears to work. But back in thread view no icons change. They only appear to change when you select them from the menu.
exactly.. slightly annoyed at the moment, but i am hoping the author will be on tomorrow, and sort this all out .. so, for now this remains uninstalled with a sincere hope to get it fixed and working, because I have way too many icons on my website .. and this would save so much bandwidth, loading time ..
Jolten
04-03-2004, 06:36 PM
Any chance for a fix Gary?
Gary King
04-03-2004, 10:25 PM
Any chance for a fix Gary?
I'm working on it, just real busy :)
noonespecial
04-03-2004, 10:26 PM
I'm working on it, just real busy :)
yay!!!.. i've been working on it too, so far no luck .. and well, i suck. so that's prolly why.
Jolten
04-09-2004, 09:22 PM
This one works like a charm for me:
https://vborg.vbsupport.ru/showthread.php?t=62886&highlight=post+icons
yeah works but i'd like to have people see a preview of em.., hope this one gets fixed soon.
Taco John
04-15-2004, 05:40 AM
A question about the hack... When you add new icons, do they get inserted in alphabetical order? I had a similar hack loaded on VB 2.9, but it got unweildy because when I added new icons, they didn't get inserted in alphabetical order and people simply stopped using it.
Taco John
05-07-2004, 07:52 AM
any answer on this one?
Jolten
05-07-2004, 06:46 PM
The get listed by display order. If youwant them sorted any other way, you need to alter the display order numbers.
Flow Fusion
06-08-2004, 09:03 PM
I installed this hack, but I also got rid of the original post icons and installed new ones. The dropdown box and preview work correctly, but when the post is submitted, the icon doesn't show next to the post. What does show is the original notepad-looking icon. What is even odder is that if I turn the dropdown box off ($show['dropdownicons'] = 0), which returns to the radio buttons, the new icons will show next to posts.
Does anyone know what is going on here? Do I have to name the files in /images/icons like the originals were named (icon1, icon2, etc), or is there something else that I'm missing?
grief
07-13-2004, 08:32 PM
this hack doesnt work, its a nifty idea though gj for that
*grief clicks uninstall
dfmafia
09-03-2004, 12:01 PM
any update to this?
many of us would like to see this work
Yeah i wish it would work!
Jolten
09-05-2004, 06:33 AM
Read the thread folks.
this one DOES work
https://vborg.vbsupport.ru/showthread.php?t=62886&highlight=post+icons
Suzie
09-30-2004, 02:34 AM
I am having the same problem it shows when creating a post but not once you get to the list of posts.
RaZor Edge
02-17-2005, 07:24 PM
You can make this hack work if you don't need the icon preview.
Just make this 2 changes:
Change
<option value="$iconpath"$iconselect>$alttext</option>
to
<option value="$iconid"$iconselect>$alttext</option>
and
<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] </label></td>$posticonbits</if>
to
<if condition="$show['dropdownicons']"><td><select name="iconid" id="iconid">$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] </label></td>$posticonbits</if>
Icon will now show on post, BUT, icon preview won't work.
T3MEDIA
02-27-2005, 03:38 PM
This author always takes hacks from other sites and mangles them together. just look at all his releases... 90% are all people complaining it doesnt work.
Never use this guys hacks.
Rickk
03-10-2005, 03:00 PM
I should note that this hack worked fine on my boards.
I am running 3.0.1, though.
I'm very happy with this hack. :)
Suzie
04-14-2005, 12:20 AM
Is there a more recent or similar hack out that does this? If not, does this work on 3.07? :ermm:
Silmarillion
04-26-2005, 08:01 PM
Anybody able to fix the problem with the icon-preview? Would be great! :squareeyed:
mfg
Renee
05-23-2005, 06:47 PM
Nice Hack,
I have 2 icon-categories, one with the standart-icons, one with flags.
The standart-icons should be seen normal and the category with the should be displayed with this Dropdown-hack.
It would this going with this hack?
any chanse the outher update this hack to vB3.5
RaZor Edge
03-07-2006, 04:59 PM
I would also like to see this hack updated for 3.5...
One of my icon category have more that 950 icons!!! :-/
DieselMinded
11-11-2007, 05:48 AM
can someone make this for 3.6.8.........
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.