Author |
Message |
nuken
RavenNuke(tm) Development Team
Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina
|
Posted:
Mon Feb 22, 2010 6:52 pm |
|
When you use the php if statement, does the code that does not apply slow down load time?
Example: you have a an if statement for IE6 browser and an else for all other browsers, will that if statement have an impact on non IE6 browsers load times or is it ignored? |
_________________ Only registered users can see links on this board! Get registered or login! |
|
|
|
montego
Site Admin
Joined: Aug 29, 2004
Posts: 9457
Location: Arizona
|
Posted:
Mon Feb 22, 2010 7:29 pm |
|
nuken, not 100% sure where you are going with this. When you say "load time", that could mean different things to different people. I suspect you mean the overall performance of the server producing the page. Others could think it means "parsing time". Essentially no different in terms of code parsing. When it comes to code execution, what is the alternative? If you want to perform one thing for IE6 and other code if not IE6, you have no choice. HOWEVER, since IE6 users are FAR LESS likely than the others, I would put that in the else, but it may also be important as to what kind of test you are making. Your most likely conditional should be up front and as best it can be to be on the "positive" side and not complicated, the better.
If you have specifics that you would like to share - some alternatives that you are considering - go ahead of post them and let us see what seems the better choice. |
_________________ Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! |
|
|
|
Palbin
Site Admin
Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania
|
Posted:
Mon Feb 22, 2010 7:52 pm |
|
If I had to guess, and I am, I would say that what you are referring to would be to minuscule to measure. |
_________________ "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. |
|
|
|
nuken
|
Posted:
Mon Feb 22, 2010 7:54 pm |
|
Specifically, I added a jquery star rating system to the Tricked Out News. The css for the rating system does not work well with IE6. Today I have been testing using the original rating system with IE6 and the new with all other browsers. It seems to work fine. I was then considering what impact the extra code would have on the over all performance of the articles.php verses removing the IE6 specific code and using a css based work around for IE6. |
|
|
|
|
Raven
Site Admin/Owner
Joined: Aug 27, 2002
Posts: 17088
|
Posted:
Mon Feb 22, 2010 8:32 pm |
|
Normally jQuery handles the browser differences for their plugins. If you did this already then sorry for the redundancy . Google for jquery star rating. |
|
|
|
|
nuken
|
Posted:
Mon Feb 22, 2010 9:29 pm |
|
The jquery star rating works fine in IE6, the issue is with consistent location in IE6 with the css. I think I will tinker with the css some more to work the bugs out. All other browsers it seems to work as expected. |
|
|
|
|
gazj
Worker
Joined: Apr 28, 2006
Posts: 152
Location: doncaster england
|
Posted:
Tue Feb 23, 2010 8:51 am |
|
nuken im no wizzkid with css but i seem to have a good track record with working with it and learn more n more as i work with ie specific css and other css hit me up on my site sometime via chat and i may be able to work it out with you as i dont fully understand what your getting at |
_________________ as i stare into the abyss and battle with my demons i yell timeout and have a coffee break. |
|
|
|
nuken
|
Posted:
Tue Feb 23, 2010 10:32 am |
|
Thank you gazj. My issue is that in IE6 the placement of the stars changes depending on the theme used. Every other browser works fine no matter what theme is used. I just about have it worked out though. |
|
|
|
|
Raven
|
Posted:
Thu Feb 25, 2010 1:42 am |
|
Maybe this would help: Only registered users can see links on this board! Get registered or login! |
|
|
|
|
djmaze
Subject Matter Expert
Joined: May 15, 2004
Posts: 727
Location: http://tinyurl.com/5z8dmv
|
Posted:
Thu Feb 25, 2010 10:40 am |
|
Every IE has issues and the trouble really starts with IE8
You can detect the mode using document.documentMode
The values can be:
5 = IE5 mode
7 = IE7 mode
8 = IE8 mode
Each mode handles javascript, html and css differently.
Declare a DOCTYPE and IE5 mode is gone (only IE7 and IE8 modes remain)
Then try this:
Code:
some text
<span style="float:right">more text</span>
|
Now view the code in IE7, IE8, IE8+Compatibility mode, Firefox, Safari and Opera
Oh, and just skip IE6. Everyone is abandoning it anyway. |
|
|
|
|
montego
|
Posted:
Fri Feb 26, 2010 6:49 am |
|
|
|
|
spasticdonkey
RavenNuke(tm) Development Team
Joined: Dec 02, 2006
Posts: 1693
Location: Texas, USA
|
Posted:
Fri Feb 26, 2010 11:55 am |
|
I thought these snippets of jquery were interesting, It requires JS so I wouldn't use for major restyles... but if you are just selectively tweaking the appearance for a feature that requires JS anyway, you can target any browser you want.
Code: <script type="text/javascript">$.browser.camino = /camino/.test(navigator.userAgent.toLowerCase()); if ($.browser.camino) {
document.write('<link rel="stylesheet" href="http://yoursite.com/css/camino.css" type="text/css" media="screen">'); }</script>
<script type="text/javascript">$.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase()); if ($.browser.chrome) {
document.write('<link rel="stylesheet" href="http://yoursite.com/css/chrome.css" type="text/css" media="screen">'); }</script>
<script type="text/javascript">$.browser.opera = /opera/.test(navigator.userAgent.toLowerCase()); if ($.browser.opera) {
document.write('<link rel="stylesheet" href="http://yoursite.com/css/opera.css" type="text/css" media="screen">'); }</script>
<script type="text/javascript">$.browser.safari = /safari/.test(navigator.userAgent.toLowerCase()); if ($.browser.safari) {
document.write('<link rel="stylesheet" href="http://yoursite.com/css/safari.css" type="text/css" media="screen">'); }</script>
|
You can target other browsers by emulating of the pattern of the user-agent/name |
|
|
|
|
djmaze
|
Posted:
Fri Mar 12, 2010 1:56 pm |
|
@spasticdonkey
Your code fails miserably on XHTML documents. document.write() doesn't exist in XHTML
Don't say: it works in IE. yes... IE is NOT a xhtml parser it thinks it is HTML. |
|
|
|
|
spasticdonkey
|
Posted:
Fri Mar 12, 2010 2:13 pm |
|
good point, I've never actually used it... and would probably shy away from any JS style corrections unless there was no other easy method... it was more for concept than anything... also in jQuery 1.4 the $.browser variable is changed to $.support |
|
|
|
|
|