Browser Detection Script
Ttech
Status: Curious
Joined: 22 Sep 2006
Posts: 5
Reply Quote
Hi,
I am in the prossess of making a user information script. Using the Browser Detection Script, but I would like the script to display the browser instead of moz or ie, something like Internet Explorer 5 or Firefox 1.5.0.4 (Firefox instead of just Mozilla) I have tryed to edit the code but have been unseccsessfull. What do I edit to do what I want? Thanks...
Back to top
jeffd
Status: Assistant
Joined: 04 Oct 2003
Posts: 594
Reply Quote
don't change the core script output in any way, that's pointless.

Just get the script output, then format it the way you want when you generate the stuff for your page.

That's fairly trivial to do, just make something that tests and replaces:

:: Code ::
switch $browser
{
    case 'msie':
      $browser_full_name = 'Microsoft Internet Explorer';
      break;
    case 'firefox':
      $browser_full_name = 'Mozilla Firefox';
    ..... and so on

}

that's one easy way, or you could loop through arrays, that's another easy way, lots of methods.

The script already has full mozilla version output, which if you actually read it you will discover.

If you check out this sample we included for a computer information box you can get some ideas.
Back to top
Ttech
Status: Curious
Joined: 22 Sep 2006
Posts: 5
Reply Quote
Thanks... But instead of even firefox or ff it just displays moz.
Back to top
jeffd
Status: Assistant
Joined: 04 Oct 2003
Posts: 594
Reply Quote
You will need to learn how to read several things if you want to succeed with programming:

1. The comments that begin the script, that tell you exactly how to do what you want done.

2. The sample script, which also gives a specific example of the script outputting specific mozilla version names.

Firefox is not the only browser that uses the gecko rendering engine, so the script has different types of tests, some test for the gecko engine alone, which is all that matters for display issues, and others test for the specific mozilla version.

If you're not willing to read the scripts at all to solve your problem I'm not going to spend any time trying to help you, sorry.

Please don't post further questions until you have actually looked at the script output options.
Back to top
Ttech
Status: Curious
Joined: 22 Sep 2006
Posts: 5
Reply Quote
I did go an look through the source code, and I did what it said to do. But it would only display Array...

Sorry I started the topic...
Back to top
jeffd
Status: Assistant
Joined: 04 Oct 2003
Posts: 594
Reply Quote
You think you did, but you didn't look very closely. Had you looked at it, you'd see that all the features you are asking how to do except for the specific long version name of the browser are already contained as script options in the script, depending on the data you request the script to give you.

And the sample computer information box script even gives examples of how to use that, it's basically the same that runs on the browser detection pages on the site.

So you need to read this more carefully, and study the code provided to answer exactly the question you are asking.

I could walk you through it step by step, but that's not a very good way for me to spend my time, since you could also spend the time and energy to just learn how to read code and how to actually do programming. Which is in this case what I recommend you do. Learning programming takes work, and if you are williing to do that work you will probably learn it, but if you aren't, you should probably give up now.

And, by the way, if you just implement the my computer information script with the browser detection script, you'll be pretty much all the way to where you want to be, which is why it's provided, as an example for this very purpose.

:: Quote ::
But it would only display Array...

You have to learn how to program before you can do programming. The script is outputting what you told it to output, so you have to learn how to handle arrays.

Anyway, good luck, work on your programming skills and you'll find that these issues become easier and easier to deal with over time, but if you don't learn how to read code you'll never learn programming.
Back to top
Ttech
Status: Curious
Joined: 22 Sep 2006
Posts: 5
Reply Quote
I may have missed a couple of lines, but my browser did not show me the link with the computer information script. If it did it did not look any different from text. I now see it though. Thanks...
Back to top
Ttech
Status: Curious
Joined: 22 Sep 2006
Posts: 5
Reply Quote
I thought I'd take the time to thank you... I have spent about a month working on a user info script for my site. I took a look at my old array problem and found that a quick look around the php manual could easily solve my problem. ;-) I haven't added in the CSS yet so it is just a basic page but anyway if any one wants to take a look it can be found over at blog.fileville.net/temp/user_info/info.php. I'm still adding more features but I'm really happy with the script so far. Thanks...
Back to top
Display posts from previous:   

All times are GMT - 8 Hours