Google maps

Omg, this is so much fun! Google Maps has a complete API to implement a map on your site, customized to your very own needs.

It’s quite simple, all you need to do is create a div-element and add some JavaScript, basically all that’s needed is this:

  1. var map = new GMap2(document.getElementById("map"));

A bit more in depth tutorial can be found at the API docs website (listed below).

Cross Browser HTML Printing

There’s a big difference between making a website look good on screen and for print. With a screen you can be save in using pixels for your fonts and more absolute measures. In print this is not done. First there are different paper-size, a4, letter, a3, etc… Than every printer has it’s own margins too. Next to that a printer most of times works in 300 dpi (dots per inch) while a screen is only 72 dpi.
So when ur marking a page up for print be sure not to use any absolute measures like pixels, but only to use relative ones like em, %, pt, etc…

Another screw up for print is using floats, they display different with every browser. As I just now discovered. FF (FireFox) displayed a div through another div, while IE displayed them below each other, as intended. I guess that’s what you get for using inline styles.
If you’re like me are using 2 stylesheets, one for screen, one for print. You have to take care not to overlook any !important statements in your CSS for screen. This can majorly screw up your print size. I had a width: 1003px !important defined, while FF printed the page just fine, IE(6) would let the page overflow and not print what ran off the page.

A nice article about printing HTML can be found here: http://alistapart.com/articles/boom

Duplicated characters with floats in IE(6)

I am working on a website for a client and all of a sudden I see the last two characters of my last float being repeated on the site when I use Internet Explorer 6. This is a bug in IE6 and can be fixed the best way (imo) by putting a condition in your comment that IE should skip it, like this:

Anchors and CSS

A nice thing to remember are these notes from the w3schools website:

Note: a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective!!

Note: a:active MUST come after a:hover in the CSS definition in order to be effective!!

Note: Pseudo-class names are not case-sensitive.

I wondered too often why my hovers didn’t work while I clearly specified them.

Link: W3schools.com, look under “Anchor Pseudo-classes”

Send data to PHP

In order to have a PHP script executed (and not opened in a window) through ActionScript use loadVars.sendAndLoad(url, your_data, method) instead of loadVars.send(url). In this way the opening of a new window isn’t necessary.

example:

ActionScript

  1. // create a new LoadVars instance
  2. var c_lv:LoadVars = new LoadVars();
  3.  
  4. // populate it with some data
  5. c_lv.bericht = input_bericht.text;
  6. c_lv.email = input_mail.text;
  7.  
  8. // offer the data to the PHP mail handler and execute it!
  9. c_lv.sendAndLoad("sendForm.php", c_lv, "POST");

$_POST empty or not

Use empty($_POST) instead of an if containing $_POST[0] == "". This gave me a lot of trouble to find out why there wasn’t anything sent by my mailer, who can receive variables using both GET and POST. Oops! :S

This is valid obviously for any associative Array. 😉

– the empty() function documentation

Posted in PHP