Debug mobileweb in device

Posted: September 15, 2015 in HTML

1) Install nodeJs using msi installer:
2) Go to command line and check if its installed or not using: npm -v
3) Install weinre using below command: npm install –g weinre
4) Run ipconfig command and note your IPv4 address.
5) Run the debugging server using your dev machine: weinre –boundHost
6) Once you run above command it will give you weinre URL like, run that url in browser
7) Under “Target Script” you will find <script>.., copy that line in your mobileweb code.
8) Under “Access Points”, click on “debug client user interface” i.e.
9) Now, once you run your mobileweb



Below is one simple function that saves my required json in localstorage using JavaScript array.

function saveMyJson(key,value)

// initialise array
var myObj = {};

// get existing json from local storage
if(localStorage.getItem('my_json') != null)
myObj = JSON.parse(localStorage.getItem('my_json'));

// add element in json by key-value pair
eval("myObj['" + key + "'] = \""+ value + "\"; ");

// set updated json in local storage
localStorage.setItem('my_json', JSON.stringify(myObj));



How to add line break in body for mailto

Posted: August 13, 2015 in HTML, PHP

// PHP code

$email = '';
$subject = addslashes("This is Subject: Let's check it...!!!");
$body = addslashes("This is message area. \r\n My Second line...Let's check it...!!!"); // body comes from text area so will have \r and \n
$body = str_replace(array("\r\n","\r","\n"),'%0D%0A',trim($body));

// HTML Code

<a onclick="mailto:<?=$email;?>?subject=<?=$subject;?>&body=<?=$body;?>" >Click here to email me</a>

Pass smarty variable to php code

Posted: July 22, 2014 in PHP

If you want to do some complex php operation in smarty tempelate file then you can pass your smarty variable to {php} tags by following manner and then can add your login between {php} tags.

{assign var="currentName" value=`$`}


echo $currentName = $this->get_template_vars('currentName');


WAMP curl not working in local pc

Posted: July 16, 2014 in PHP
Tags: , ,

1) Enable curl extension in both php.ini ( file location shown below)




2) Download php_curl.dll from below link and replace it in D:\wamp\bin\php\php5.3.13\ext.

If your PHP version is 5.3.14 then download “” from under  ‘Fixed curl extensions‘ .


Wamp disable orange xdebug errors

Posted: June 30, 2014 in PHP

Find following line in php.ini and comment that line and restart wamp.

;zend_extension = “d:/wamp/bin/php/php5.3.13/zend_ext/php_xdebug-2.2.0-5.3-vc9-x86_64.dll”

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps JavaScript API Example</title>
<script src=";v=2&amp;key=KEY&sensor=true"
<script type="text/javascript">

function initialize()
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(23.005, 72.5959), 15);
map.setUIToDefault(); // will add top menu,left menu etc

var marker = new GMarker(new GLatLng(23.005, 72.5959));
<body onload="initialize()" onunload="GUnload()">
<div id="map_canvas" style="width: 700px; height: 500px"></div>