Graphic, Advertising and Web Design. 
Symsys Inform Blog HomeAIX Systems and Linux Support Specialists

Nod Antivirus Official NZ Reseller International Association of Web Master and Designers Cisco Certified Engineers Golden Web Award Winners Linux Spacialists Thawte SSL VS Security Partner

Symsys Ltd Text logo in the banner area


Author:  Gremlette
October 25, 2008



 

 

How to hide entire blocks of code from GOOD BEHAVING browsers.

Now that most web coders / designers are putting advanced effort into writing decent compliant code for their sites, there are a variety of ‘fixes’ that have to be employed to cure problems in old bad behaving browsers such as IE6 and below. 

MANY ‘get arounds’ involve miles of Javascript code which is completely useless as well as resource-hogging when many users block javascript completely for security purposes. The reasons that people hold onto old and ancient technology such as IE6 is due to a completely misled belief that it is more stable than the upgrade and more secure. The MAIN problem is IE6 and where I agree that IE7 is not ‘all that’, it is now usable and closer to compliance and good security than IE6 is!
At the end of the day - IE6 insistent users are STUBBORN, so although it pains any decent coder to work with and doubles the billing time on a clients web development sometimes, we have to try to work with it.

SAVE HOURS OF CSS HELL. If your visitor insists on ancient technology and blocking Javascript, then they have to EXPECT not being privvy to some modern compliant effects and functions. Example: users of programs such as ‘NoSCRIPT’ have no idea what ‘Digg’ and ‘Delicious’ are because they never see it and cannot even add RSS feeds to thier Facebook account…. similarly, whateverhover and other Javascript menu hacks designed purely for IE6 and old browsers become completely pointless.

So, you have a nice pure CSS styles functional section such as an active menu that

a) Requires ZERO Javascript Whatsoever
b) Is SUPER fast
c) Super clean and clear
d) Loved by Web crawler robots etc

BUT it won’t behave for stubborn stick in the mud’s like IE6, the likes, and below users.
The benefits of non dependant and compliant code is far too good to not use.
YET you have code that old browsers CAN work with that does the same functions yet still not javascript etc dependant (though may not be as nice)…. yet you don’t want BOTH to show up on the same page.

 Keep two versions and STAY Javascript Free

1)  Hide the GOOD STUFF from old browsers

Your two lumps of code ‘GOODstuff’ and ‘ALTstuff’ will be defined in <div> tags.
eg

<div id=”GOODstuff”> all the HTML in here</div>
<div id=”ALTstuff”>repeat of the HTML in here</div> 

In your relevant style sheet hide GOODstuff from old browsers

#GOODstuff {display:none}
html>body #GOODstuff {display:block}

Anything within the GOODstuff div tags including relevant styling will be hidden from old browsers but shows in Good behaving browsers.

2. Hide ALT STUFF from good browsers

#ALTstuff {display:block}
html>body #ALTstuff {display:none;} 

Basically, Good browsers will follow the html>body to NOT display the ALT code div contents.


Filed under: CSS, Code, XHTML ... Comments (0)

Tags: , , ,
  

 





Author:  Hollow
October 22, 2008



 

 

This tutorial continues on from PHP 101 - How to write a quick PHP script. If you didn’t read it, or don’t want to read it, that’s fine, so long as you understand it. This tutorial will give you all the code you need to continue from here anyway, but it will not re-explain the elements of that tutorial.

This is still a very basic how to, it expects that you (The Reader) has a server of some kind or some shared hosting which supports PHP and is already configured. The script I am about to show you will explain how to use PHP to handle an html form submission and process the output accordingly.

So let’s get going

We’re going to start by creating our html form, now this isn’t an html tutorial so we assume if you’re trying out PHP you already know html to at least a standard of understanding the code.

The code below should print a nice and simple form for us, with two input text boxes and a submit button. Take the code above, save it to a file, call it PHP102.php and upload it to your web server. Then check it out and compare it to ours to see if it looks the same. If it does we can move on to the next stage, if it doesn’t you may have issues with your PHP installation or configuration.

<label>Enter your name here : </label>
<input id="name" name="name" type="text" />
<label>Enter your Age : </label>
<input id="age" name="age" type="text" />
<input id="submit_button" style="visibility: visible" title="Submit" type="submit" value="Submit" />
 
";
?&gt;

We’re going to take PHP101.php now and change it around a little, to handle the input from our PHP102.php form. Take a look at the script below, then paste it into a text document and save it as PHP101-102.php.

The result of the above instruction should result in you getting a PHP generated, HTML form, when you go to PHP102.php, which when submitted, posts similar output to PHP101.php, but with completely different outputs dependent entirely on what information you put into the PHP102.php form.

So in this tutorial we learned how to handle a basic form submission and print the output to a page using PHP. It didn’t do anything spectacular, it isn’t a revolutionary tutorial and there are hundreds if not thousands more like it out there on the web, but hopefully you found it useful. If the first two tutorials get any comments requesting it, I’ll do a third tutorial that’s more in depth and handles the validation of a form submission and if that’s popular I’ll go further into extended validation etc and possibly MySQL usage.

The code in this tutorial is under no license whatsoever and is completely free to be re-used by anyone and for any purpose. No warranty of guarantee is provided with this code and it is used, re-used, re-distributed or sold at the persons own risk. In no way is Symsys Ltd, or the author of the tutorial, responsible in any way, for the way this code is used by a third party or how it may be developed by that third party. Please use any and all code here responsibly.


Filed under: Code, PHP ... Comments (1)

Tags: , , , , , , , , , , , , , ,
  

 





Enter your email address:

Delivered by FeedBurner