Remove specific HTML tags using PHP

There are times when you want to remove a specific HTML tag from an HTML block of text. This could be an anchor(<a/>>) or an image(<img/>) perhaps. You can use preg_replace to do this quite quickly and efficiently. Remove an anchor: [code lang=”php”] $content = “Sample text Our anchor. Etc Read more…

By Andrew Odendaal, ago

Keep Google Map v3 centered when browser is resized

Using Google Maps V3 Javascript API you can keep the map centered to the browser’s window by using the following trick when resizing the window. var mapOptions = { zoom: 2, center: new google.maps.LatLng(0,0), mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions); // this is our gem google.maps.event.addDomListener(window, "resize", Read more…

By Andrew Odendaal, ago