custom Maps in html

Aside

So, to start off, there are many ways to display a map on your website and make it look good, but I still found a way how to make it yours and individual:

  • you can have your own pin icon
  • you can add pictures to your Map
  • you can add html codes to it!

Seems awesome huh? Well let’s get started:

what you need:

  • a google account
  • intelligence

how to:

  1. save the map you want and add it to your places
  2. then click on the red EDIT button
  3. click on the pin and edit it to your needs (note: you can insert pictures, html codes and other things into it!”
  4. when you done click on save and done
  5. click on the “link” button (right image) and then on “customize and preview embedded map”
  6. You’re done! just insert the html code into your Website.
  7. (Tipp…Google has made the maps not scrollable by default, but you can change them in the code at scrolling=”no” to “yes”

here the example of a san francisco map with scrolling enabled:

Force download of .vcf and other files using php on a Website

I’ve got the resources from a 10 years old german post and still find them very useful.

but first of all, why do you need the script?

Well, I made a small contact site (really small) and wanted to add a link for the Vcard (.vcf), but soon I realised that some browsers try to display it and show a looong page with weird characters. The best way (I think) to solve this problem is to generate a php script which forces the browser to download the file.

The setup:

open the index.htm file and edit it to your needs.

It should look something like this:

<b>save only:</b><BR>
<a href="download.php?what=1">test.zip</a><BR>
<a href="download.php?what=2">test.doc</a><BR>
<a href="download.php?what=3">test.xls</a><BR>
<a href="download.php?what=4">test.pdf</a><BR>
<a href="download.php?what=5">test.gif</a>

while the download.php looks like this:

<?
$files = Array("1" => "test.zip",
"2" => "test.doc",
"3" => "test.xls",
"4" => "test.pdf",
"5" => "test.gif");


$filename = "docs/".$files[$_GET[what]];

header("Content-Type: x-type/subtype");
header("Content-Length: ".filesize($filename));
header("Content-Disposition: attachment; filename=".$files[$_GET[what]]);
readfile($filename);
?>

do you get it? So in order to add  some more files to download straight away, you have to put them into the /docs folder and add them to the download.php file. Then you have to point them out with a html code. Let’ssay that our file is called “contact.vcf” and we want to have it downloaded straight away, we would need to set our files like this:

  1. put the file into the /docs folder
  2. make it available in the download.php file: <code>”6″ => “contact.vcf”; (remember to change the “;” of nr. 5 to  a comma and add a “;” to the last file.
  3. point it out in the html file like this: <a href=”download.php?what=6″>YOUR_FILE_NAME</a>

This should look something like this:

html:<a href="download.php?what=6">YOUR_FILE_NAME</a>

and in php:

<?
$files = Array("1" => "test.zip",
"2" => "test.doc",
"3" => "test.xls",
"4" => "test.pdf",
"5" => "test.gif",
"6" => "contact.vcf");



$filename = "docs/".$files[$_GET[what]];

header("Content-Type: x-type/subtype");
header("Content-Length: ".filesize($filename));
header("Content-Disposition: attachment; filename=".$files[$_GET[what]]);
readfile($filename);
?>

oh well i hope you get it…

here you’ve got the files zipped and ready to use… php-script-force-download (please contact me if the link is dead)(note: you are not able to test the script offline, it just won’t work…sorry)

credits go to: Stuck Mojo from this post: http://www.traum-projekt.com/forum/54-traum-scripts/6574-script-download-ohne-ziel-speichern.html

thanks for reading!