Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Details »»

Version: , by (Guest)
Developer Last Online: Jan 1970 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 06-22-2000 Last Update: Never Installs: 0
 
No support by the author.

Hi Ed and congrats for the new appointment

I need your help please.

My BB members love smilies, it seems, and we have a nifty and useful collection of nice ones. However, I've discovered that the animated ones create problems aplenty for Netscape users.

So, I created a sub dir in the smilies dir, called netscape, and put there a copy of all the smilies, only not animated (same name though).

Then, I added a field to the smilie table in the database, called smiliepath2, and placed there the paths to the smilie/netscape/ images.

Then, I put the following in global.php, at around like 202 (where it says // smilies):

Code:
  if (strstr($HTTP_USER_AGENT,"MSIE")) {
     if ($allowsmilie==1 and $dosmilies==1) {
     $smilies=$DB_site->query("SELECT smilietext,smiliepath FROM smilie");
        while ($smilie=$DB_site->fetch_array($smilies)) {
         if ($smilie[smilietext]!="") {
         $bbcode=str_replace($smilie[smilietext],"<img src=\"$smilie[smiliepath]\" border=0>",$bbcode);
      }
    }
  }
} else {
    if ($allowsmilie==1 and $dosmilies==1) {
    $smilies=$DB_site->query("SELECT smilietext,smiliepath2 FROM smilie");
       while ($smilie=$DB_site->fetch_array($smilies)) {
         if ($smilie[smilietext]!="") {
         $bbcode=str_replace($smilie[smilietext],"<img src=\"$smilie[smiliepath2]\" border=0>",$bbcode);
      }
    }
  }
}
But it doesn't work. Now all the smilies are coming from the smilies/netscape/ dir -- which means my "if (strstr($HTTP_USER_AGENT,"MSIE"))" is not working.

Can you please advise me what I am doing wrong, and what I should do to get it right?

Thanks,

Bira

Show Your Support

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

Comments
  #2  
Old 06-22-2000, 10:49 AM
Guest
 
Posts: n/a
Default

With that code you also take away smilies from Opera, Mozilla (probably has the same netscape problems), and etc users.
Reply With Quote
  #3  
Old 06-22-2000, 10:52 AM
Guest
 
Posts: n/a
Default

rangersfan,

1) I am not taking it away - they will simply see a static smilie rather than an animated one.

2) I would love to know how I can determine someone is using Netscape, and do "if browser==netscape then use smiliepath2" (in which case only the Netscape users will be affected).

But right now, only the "else" works, regardless what browser you have, including MSIE
Reply With Quote
  #4  
Old 06-22-2000, 10:54 AM
Guest
 
Posts: n/a
Default

bira - check out my smilies

http://www.hedgehogwheels.com/forums...on=showsmilies

I haven't had any complaints yet from any users about threads not loading though.
Reply With Quote
  #5  
Old 06-22-2000, 10:57 AM
Guest
 
Posts: n/a
Default

I haven't picked up a PHP book but is the 'strstr' function a string match or a sub-string match function? I would think it would work if it is just searching for the ocurrence of "MSIE" in the string, otherwise you need to use a function that does that.
Reply With Quote
  #6  
Old 06-22-2000, 10:58 AM
Guest
 
Posts: n/a
Default

rangersfan, well good for you I guess

The procedure I set to check if a user has Internet Explorer is the correct one. The why isn't it working? Could it be that global.php doesn't communicate with the user's browser or something like that? Maybe I should do something else?

Someone please help me
Reply With Quote
  #7  
Old 06-22-2000, 11:03 AM
Guest
 
Posts: n/a
Default

As a test .... all you have to do is echo the string back to the screen to see if it has anything in it to see if it is being read.
Reply With Quote
  #8  
Old 06-22-2000, 11:07 AM
Guest
 
Posts: n/a
Default

rangersfan, copy the bellow code to a text file, save it as browser.php and test it in IE and in Netscape:

Code:
<?php
  if(strstr($HTTP_USER_AGENT,"MSIE")) {
  echo "good";
  } else {
  echo "crap";
  }
?>
You will see that it works just fine.
Reply With Quote
  #9  
Old 06-22-2000, 12:12 PM
Guest
 
Posts: n/a
Default

I started playing around with your code in a separate file, and it works fine. It even works fine when I require global.php above it.

So what's the problem?

Well, we forgot to account for the fact that that smilies stuff is in a function. Functions have a local scope.

bira - just above your code, add:
Code:
global $HTTP_USER_AGENT;
That will give you access to the variable.
Reply With Quote
  #10  
Old 06-22-2000, 12:22 PM
Guest
 
Posts: n/a
Default

THANK YOU!!!!!!!

It works beautifully
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 04:17 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.05045 seconds
  • Memory Usage 2,264KB
  • 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
  • (3)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (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_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
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete