Subesh Pokhrel's Blog – Magento Development Tips,PHP,Google Maps
PHP & Magento Tips & Tutorials

Archive for July, 2008

Today, while writing a code for AJAX file uploader, I was trying to do with [wiki]SALAJAX[/wiki]. But, with SALAJAX I could not manage to send the headers for $_FILES. So I thought of an alternative. And the alternative was to load the action page of the form on [wiki]IFrame[/wiki], whose display would be hidden and the work for uploading the file will be done on the background without refreshing the page. Yeha.. Its not [wiki]AJAX[/wiki], but it gives a user the feel of asynchronous working on the page. So, my code is Asynchronous Feel Without Javascript and XML (AFWJAX). What do think about this?
So, Here’s the code.The code below is for the form.

<form action="iframeinc.php" method="post" enctype="multipart/form-data" id="uploadform" target="iframe" name="uploadform">
 File:
  <input name="pic" type="file" id="pic" style="margin-right:50px;" />
  <br />
<input type="submit" name="Submit" value="Upload" /><br />
<iframe name="iframe" src="iframeinc.php" width="200" height="500" style="display:none;"> </iframe>
</form>

Continue reading “Ajaxified File Uploader Using IFrame” »

  • Share/Bookmark

I wanted to show different categories of information on one GMarker. That is I wanted to show different types of information on a Infowindow for a point on Google Maps. For that I used a tabbed info window, which helped me to show different data on each tabs. Here is the code of what I have done. I have shown the latitude and longitude of a placed clicked on the map on the tabbed info window. This is just the script part. The demo and download links are given below.

Continue reading “Tabbed Infowindow in Google Maps” »

  • Share/Bookmark

At last I found hostip.info provides a service for getting the latitude and longitude of a place on the basis of the user’s ip address. Its light weight and free, rather than downloading bulky database and getting paid services, for getting latitude and longitude on the basis of IP.
Here is the simplest way to do it. Requested to http://api.hostip.info/?ip=$ip&position=true it responds XML formatted output. So we need to parse XML code using DOM class of PHP.(#19-#23). Remember, the position=true should be set to get the latitude and longitude otherwise it will not show on default.

Here is the code and I will soon upload the working demo.

< ?php
/*
Subesh Pokhrel
subesh.com.np
Get the code for Real IP of the site from roshanbh.com.np
Mapping The IP Address to Latitude and Longitude.
*/
function IPtoLatLng($ip)
{
$latlngValue=array();
$dom = new DOMDocument();
$ipcheck = ip2long($ip);

Continue reading “Mapping The IP Address to Latitude and Longitude In Google Maps” »

  • Share/Bookmark

For last few days I have been trying to understand wordpress ins and outs, and had an idea of developing simple plugin for [wiki]wordpress[/wiki]. I thought people would want to give the reference of most of the words they use in their post to wikipedia, and placing it manually would be a very difficult task. Like the way I have done for the wordpress word above. So thought “wikilinki” would be a helpful plugin for those people.
And here I have it today the wikilinki plugin developed. This is just the initial version, I would add more functionality later. Because I am so excited to release it, I will add other things later on. Its easy to implement it just use [WIKI]Words[/WIKI] all in small on the post to get the reference URL of the word from wikipedia. I had to encode the usage because I have already installed it and it would parse it too. Place wikilinki.php under wp-content/plugins and activate from the admin.
You can download wikilinki from Get Wikilinki (Updated)

Continue reading “Wikilinki Ver 1.0 Released” »

  • Share/Bookmark

I was just wandering through the themes factories of wordpress I came across this theme BlueUzor by skinpress, had a demo view and I had opened the last theme I installed on the tab of mozilla. Then I compared the two.. I thought what a bad choice I had before! :D

Continue reading “Surprised ! I installed a new theme.. Yeha” »

  • Share/Bookmark

Search engine optimization by SEO Design Solutions