Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP
Author Message
nuken
RavenNuke(tm) Development Team



Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina

PostPosted: Mon Feb 22, 2010 6:52 pm Reply with quote

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! 
View user's profile Send private message Send e-mail Visit poster's website
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Mon Feb 22, 2010 7:29 pm Reply with quote

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! 
View user's profile Send private message Visit poster's website
Palbin
Site Admin



Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania

PostPosted: Mon Feb 22, 2010 7:52 pm Reply with quote

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. 
View user's profile Send private message
nuken







PostPosted: Mon Feb 22, 2010 7:54 pm Reply with quote

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

PostPosted: Mon Feb 22, 2010 8:32 pm Reply with quote

Normally jQuery handles the browser differences for their plugins. If you did this already then sorry for the redundancy Wink. Google for jquery star rating.
 
View user's profile Send private message
nuken







PostPosted: Mon Feb 22, 2010 9:29 pm Reply with quote

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
Worker



Joined: Apr 28, 2006
Posts: 152
Location: doncaster england

PostPosted: Tue Feb 23, 2010 8:51 am Reply with quote

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. 
View user's profile Send private message Visit poster's website
nuken







PostPosted: Tue Feb 23, 2010 10:32 am Reply with quote

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







PostPosted: Thu Feb 25, 2010 1:42 am Reply with quote

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

PostPosted: Thu Feb 25, 2010 10:40 am Reply with quote

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.
 
View user's profile Send private message Visit poster's website
montego







PostPosted: Fri Feb 26, 2010 6:49 am Reply with quote

djmaze wrote:
Oh, and just skip IE6. Everyone is abandoning it anyway.


Could not agree more. I just wish those who voted "Yes" in our recent poll would have added their reasons why in the comments like I had asked:

http://www.ravenphpscripts.com/modules.php?name=Surveys&op=results&pollID=47&mode=&order=0&thold=0

However, in my opinion, still enough to conclude that we can stop trying to tweak everything to work on IE6. JMO though and not a reflection of any official RN policy. Laughing
 
spasticdonkey
RavenNuke(tm) Development Team



Joined: Dec 02, 2006
Posts: 1693
Location: Texas, USA

PostPosted: Fri Feb 26, 2010 11:55 am Reply with quote

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
 
View user's profile Send private message Visit poster's website
djmaze







PostPosted: Fri Mar 12, 2010 1:56 pm Reply with quote

@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







PostPosted: Fri Mar 12, 2010 2:13 pm Reply with quote

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
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©