vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Beta Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=34)
-   -   Fix for smilie display problem (https://vborg.vbsupport.ru/showthread.php?t=73266)

Boots 12-23-2004 10:00 PM

Fix for smilie display problem
 
As many of you know, the parsing of vB smilies is rather odd and can be a huge headache when it comes to multiple codes not parsing correctly

ie:

:puke: and :p

as you can see, the smilies are parsed by display order so
Code:

:p
gets parsed before
Code:

:puke:
therefore the longer smilie code doesn't display correctly. An easy fix is to parse the smilies in order of their code length. The following two quick hacks will do just that!

BEFORE ATTEMPTING THIS - MAKE BACKUP COPIES OF:

/includes/adminfunctions.php
/includes/functions_bbcodeparse.php

Whenever you are changing files you should always have a proper backup!



open /includes/adminfunctions.php and goto line 2192

you will see this line
Code:

        $items = $DB_site->query("SELECT * FROM " . TABLE_PREFIX . "$table ORDER BY imagecategoryid, displayorder");
replace that line with this code
Code:

        if ($table == 'smilie')
                {
                    $items = $DB_site->query("SELECT * FROM " . TABLE_PREFIX . "smilie ORDER BY LENGTH(smilietext) DESC"); 
                }
                else
                {
                    $items = $DB_site->query("SELECT * FROM " . TABLE_PREFIX . "$table ORDER BY imagecategoryid, displayorder"); 
                }

open includes/functions_bbcodeparse.php and goto line 385

you will see this line
Code:

SELECT smilietext, smiliepath, smilieid FROM " . TABLE_PREFIX . "smilie
replace it with this
Code:

SELECT smilietext, smiliepath, smilieid FROM " . TABLE_PREFIX . "smilie  ORDER BY LENGTH(smilietext) DESC
After this is complete, go into your Admin CP, view your smilies and just click "Save Display Order" This will update the cached smilie's datastore. This hack won't have any effect until this is done

Enjoy proper smilies ! :D Let me know how it works for ya! :D

sabret00the 12-24-2004 01:18 PM

that's great work although theirs a mistake
PHP Code:

    if ($table == 'smilie'
                {
                     
$items $DB_site->query("SELECT * FROM " TABLE_PREFIX "smilie ORDER BY LENGTH(smilietext) DESC");  
                |
                else
                {
                    
$items $DB_site->query("SELECT * FROM " TABLE_PREFIX "$table ORDER BY imagecategoryid, displayorder");  
                } 

should read

PHP Code:

    if ($table == 'smilie'
                {
                     
$items $DB_site->query("SELECT * FROM " TABLE_PREFIX "smilie ORDER BY LENGTH(smilietext) DESC");  
                }
                else
                {
                    
$items $DB_site->query("SELECT * FROM " TABLE_PREFIX "$table ORDER BY imagecategoryid, displayorder");  
                } 


sabret00the 12-24-2004 01:19 PM

will this also fix the :lol:) problem?

GenSec 12-24-2004 01:34 PM

Very usefull. Thanks!

Boots 12-24-2004 02:08 PM

fixed this in the original post. I don't know how the | got in there as I copied it directly from my code ? weird. Oh well, fixed now :D


Quote:

Originally Posted by sabret00the
that's great work although theirs a mistake
PHP Code:

    if ($table == 'smilie'
                {
                     
$items $DB_site->query("SELECT * FROM " TABLE_PREFIX "smilie ORDER BY LENGTH(smilietext) DESC");  
                |
                else
                {
                    
$items $DB_site->query("SELECT * FROM " TABLE_PREFIX "$table ORDER BY imagecategoryid, displayorder");  
                } 

should read

PHP Code:

    if ($table == 'smilie'
                {
                     
$items $DB_site->query("SELECT * FROM " TABLE_PREFIX "smilie ORDER BY LENGTH(smilietext) DESC");  
                }
                else
                {
                    
$items $DB_site->query("SELECT * FROM " TABLE_PREFIX "$table ORDER BY imagecategoryid, displayorder");  
                } 



Boots 12-24-2004 02:10 PM

Quote:

Originally Posted by sabret00the
will this also fix the :lol:) problem?

yes

(:lol:)

displays perfectly fine on my forum :)

Boofo 12-24-2004 10:08 PM

Can you please post this in a text file also for easier downloading and saving? ;)

Boots 12-24-2004 11:53 PM

Sure thing. i'll post one up tommorow :)

NYI Fan 12-25-2004 12:55 AM

thanks, i was wondering when Iw as going to find some time to clean this mess up LOL and youve saved me the trouble!

*clicks install*

NuclioN 12-25-2004 01:16 AM

Fantastic! :) Tnx.


All times are GMT. The time now is 08:48 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01091 seconds
  • Memory Usage 1,763KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (4)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete