The Arcive of vBulletin Modifications Site. |
|
Details »»
|
|||||||||||||||||||||||||
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);
}
}
}
}
Can you please advise me what I am doing wrong, and what I should do to get it right? Thanks, Bira Show Your Support
|
|||||||||||||||||||||||||
| Comments |
|
#2
|
|||
|
|||
|
With that code you also take away smilies from Opera, Mozilla (probably has the same netscape problems), and etc users.
|
|
#3
|
|||
|
|||
|
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
|
|
#4
|
|||
|
|||
|
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. |
|
#5
|
|||
|
|||
|
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.
|
|
#6
|
|||
|
|||
|
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
|
|
#7
|
|||
|
|||
|
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.
|
|
#8
|
|||
|
|||
|
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";
}
?>
|
|
#9
|
|||
|
|||
|
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; |
|
#10
|
|||
|
|||
|
THANK YOU!!!!!!!
It works beautifully
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|