Saturday 15 December 2012

Css fix for IE

CSS Specific for Internet Explorer

IE conditional comment is probably the most commonly used to fix the IE bugs for specific versions (IE6, IE7, IE8, IE9). Below are some sample code to target different versions of Internet Explorer:

<!--[if lt IE 8]> = IE7 or below

<!--[if IE 8]> = IE8

<!--[if gte IE 8]> = greater than or equal to IE8

<!--[if IE 9 ]> = IE9

<!--[if gt IE 9]> = greater than or equal to IE9


Here is the an example of including the styles for each version of IE

<!--[if lt IE 8]> 
<link href="ie7.css" rel="stylesheet" type="text/css" /> /* css for IE7 */
<![endif]-->

<!--[if gte IE 8]>
<link href="ie8.css" rel="stylesheet" type="text/css" /> /* css for IE8 & greater*/
<![endif]-->

<!--[if IE 9 ]>
<link href="ie9.css" rel="stylesheet" type="text/css" /> /* css for IE9 */
<![endif]-->

<!--[if gt IE 9]>
<link href="ie9.css" rel="stylesheet" type="text/css" /> /* css for IE9 & greater */
<![endif]-->


Hope this helps!

Friday 14 December 2012

Convert string to date in PHP


Sometimes it will need to convert the date in string format to convert it in to the original DATETIME format. In PHP we can do this like the following.

<?PHP
 
$date = "29/11/2012 23:26"; 
 
$newDate = preg_replace("/(\d+)\D+(\d+)\D+(\d+)/","$3-$2-$1",$date); 
 
echo date('Y-m-d H:i:s',strtotime($newDate)); 
 
?>

Hope this helps!

Tuesday 11 December 2012

Jquery HTML image rotator


Creating list of images that are rotating/sliding smoothly is not so much complex. You can achieve this in a few steps.

Here is an example. You can customize the style and script to make it suit for your applications. The present example will look like :



Hope you enjoy the script !

Check if an image is loaded or not in javascript

You can use javascript functions to check if an image is loaded. Here we are discussion two methods.

1) Using onload function

<script>
// Check using onload function 
 
objImg = new Image();
 
objImg.src = 'photo.gif';
 
objImg.onload = function() {   
 
// do some work   
 
}  
2) Using Complete property
<script>
// Check using complete  property 
 
objImg.src = 'photo.gif';
 
objImg = new Image();
 
 if(!objImg.complete) {  
 
// do some work   
 
} 
</script>

Hope this helps !

Monday 10 December 2012

Import csv file in PHP


Import data from csv/xls file is a main requirement in most of the web applications. We can do this simply by using the fgetcsv function in PHP. Here is the code for it.

<?PHP
 
// Import csv - PHP 
 
$row = 1;  
 
if (($handle = fopen("test.csv", "r")) !== FALSE) {  
 
    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {  
     
        $num = count($data);
         
        echo "<p> $num fields in line $row: <br /></p>\n";
         
        $row++;
         
        for ($c=0; $c < $num; $c++) {
         
            echo $data[$c] . "<br />\n";
             
        }
         
    }
     
    fclose($handle);
     
}
 
?>
Its easy and so we can complete in a few steps.

Try it !


Jquery swf multiple image upload

Here is a plugin to upload multiple images simultaneously. It’s completely open source, so that you can download and customize to meet your requirements.

Upload


Browse Images



Save images


You can modify the upload-file.php in root folder to add the database connection/save code. Also the details regarding the file upload path also available with this file.


Try it, Its easy !




Friday 7 December 2012

Post XML data using CURL - PHP


A couple of methods are available to post an xml data to the server. Here we are showing how to post the xml data in HTTP post method by using CURL and PHP.

Here is the code.

<?PHP
 
// xml data 
 
$xml_data ='<RequestData> 
 
 <userID>'.uniqid().'</userID> 
 
 <lName>'.$lastname.'</lName> 
 
 <fName>'.$firstname.'</fName>
 
 <pass>'.$password.'</pass>
 
 <uGroupID>1</uGroupID>
 
 <rightID>1</rightID>
 
 <userNum>1</userNum>
 
 <emailID>'.$email.'</emailID>
 
 <isConsultant>1</isConsultant>
 
 <passChange>1</passChange>
 
 <passNoExchange>1</passNoExchange>
 
 <disabled>0</disabled>
 
 <saFailAttempt>1</saFailAttempt>
 
</RequestData>
 
';
 
// assigning url and posting with curl 
 
$URL = "http://172.16.0.44/RespackService/RespackService.svc/AddUser";
 
$ch = curl_init($URL);
 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
 
curl_setopt($ch, CURLOPT_POST, 1);
 
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
 
curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml_data");
 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 
$output = curl_exec($ch);
 
curl_close($ch);
 
// prints the output 
 
print_r($output);exit;
 

?>

Access asmx webservice from PHP using CURL


Consuming .asmx webservices is not so much complex nowadays.We can use CURL for posting variables to an asmx webservice. You can get the output in a few steps. Here are the details:

1)      Assign URL and variables
2)      Post using curl
3)      Prints the Output

Here is the code.

<?PHP
 
//web service URL and variables
 
$url = 'http://172.16.0.35/SoleTraderTaxiLocal/SoleTraderServices.asmx/SearchUsers'; 
 
$fields = array('AuthenKey'=>'172839',
    
'Criteria'=>'userfirstname',

'SearchText'=>'j',

'UserTypeiCode'=>'2',

); 
 
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } 
 
rtrim($fields_string,'&');
 
// Posting with CURL 
 
$ch = curl_init();
 
curl_setopt($ch,CURLOPT_URL,$url);
 
curl_setopt($ch,CURLOPT_POST,count($fields));
 
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 
$result = curl_exec($ch);
 
// Output to an xml file 
 
file_put_contents('content123.xml',$result);
 
curl_close($ch);
 
?>


Hope this helps!



Wednesday 5 December 2012

Get video details from youtube using PHP


This is a simple PHP class for fetching the complete video details from youtube.

The output is available as xml file and we can parse this to show in our application.


Try it for your applications.

If you have any queries, please send an email to support@innovativewebz.com




Force Download a file in PHP


PHP allows you to change the HTTP headers of files you're writing. This way you can force a file to be downloaded that normally the browser would load in the same window.  You can use this for files like PDFs, document files, images, or videos that you want your customers to download rather than read online.

<?PHP
 
// Force download in PHP 
 
$file="http://yourdomain/fileurl";  
 
header("Content-Description: File Transfer");   
 
header("Content-Type: application/octet-stream");   
 
header("Content-Disposition: attachment; filename=\"$file\""); 
 
readfile($file);
 
?>
There should be no spaces or carriage returns anywhere in the file. Blank lines will cause PHP to default to text/html and your file won't download.

Hope this helps !



Unset all cookies in PHP

Delete / Unset all cookies in PHP

If you want to delete all cookies on your domain, you may want to use the value of:
<?php   $_SERVER['HTTP_COOKIE']   ? >
rather than:
<?php  $_COOKIE  ? >
to dertermine the cookie names. 

If cookie names are in Array notation, eg: user[username] 

Then PHP will automatically create a corresponding array in $_COOKIE. Instead use  $_SERVER['HTTP_COOKIE']  as it mirrors the actual HTTP Request header. 

So you can unset all cookies by the following way.

<?PHP
 
// Unset all cookies in PHP 
 
if (isset($_SERVER['HTTP_COOKIE'])) {  
 
        $cookies = explode(';', $_SERVER['HTTP_COOKIE']);  
         
        foreach($cookies as $cookie) {  
         
                $parts = explode('=', $cookie);
                 
                $name = trim($parts[0]);
                 
                setcookie($name, '', time()-1000);
                 
                setcookie($name, '', time()-1000, '/');
         
        }
 
}
 
?>
Reference : http://php.net/manual/en/function.setcookie.php
Hope this helps!


Tuesday 4 December 2012

Jquery DatePicker - A simple datepicker plugin


It is a jquery plugin that attaches an inline calendar for selecting individual dates.

This will look like as below.

 

No complex coding or, integration required. Just include two files and jquery.

Then you can directly call the datepicker from your textfield id.


Check it and try for your applications.


Monday 3 December 2012

jScrollPane - A Jquery Scroll pane for web applications


jScrollPane 

jScrollPane is a cross-browser jQuery plugin by Kelvin Luck which converts a browser's default scrollbars (on elements with a relevant overflow property) into an HTML structure which can be easily skinned with CSS.

jScrollPane is designed to be flexible but very easy to use. After you have downloaded and included the relevant files in the head of your document all you need to to is call one javascript function to initialise the scrollpane. You can style the resultant scrollbars easily with CSS or choose from the existing themes. There are a number of different examples showcasing different features of jScrollPane and a number of ways for you to get support.

Here you can find the complete documentation and demos and downloads for the scroll pane implementation.


Check it and try this awesome jquery plugin for your web applications.


Friday 30 November 2012

Create xls in PHP – Export to xls

Create xls file in PHP

Here is the code for creating xls files in PHP. If you are not looking for a lot of operations (like column coloring etc) you can use this method. It is very easy and simple for implementation.

You can fetch dynamic data instead of the content variable.

<?PHP
 
// Creating xls files in PHP 
 
$filename  ="excelreport.xls"; 
 
$contents  ="testdata1 \t testdata2 \t testdata3 \t \n"; 
 
$contents  .="testdata1 \t testdata2 \t testdata3 \t \n"; 
 
header('Content-type: application/ms-excel');
 
header('Content-Disposition: attachment; filename='.$filename);
 
echo $contents;
 
?>

You can email us at support@innovativewebz.com for any questions.

Convert-12-to-24-hour-time-and-vice-versa

Here is the method to convert 12 hour to 24 hour format and vice versa.

<?PHP
 
// 24-hour time to 12-hour time 
$time_in_12_hour_format  = DATE("g:i a", STRTOTIME("13:30"));
 
// 12-hour time to 24-hour time 
$time_in_24_hour_format  = DATE("H:i", STRTOTIME("1:30 pm"));
 
?>

Get back to us at support@innovativewebz.com if you need any assistance

Thursday 29 November 2012

Update your website - Keep it fresh and interested for search engines.


Regular updates to your website are very much important to keep it fresh for the search engines. If your website is not having regular updates, you will lose the ranking in optimization.

Updates may be of different types:

1)      Website content updates:

This is very much important in the case of SEO. Every search engines will notice regularly updating websites. So always try to update your website with fresh and valid contents

2)      Platform upgrades:

This is also required if your website is using an old platform, or if it is running on features that are already outdated. Always make sure that your website is upgraded with latest technologies. Also this will attract more users to your website and thus you will be able to get more traffic to your website.

3)      UI upgrades:

This is important in the case if clients/ customers. If you are looking to make your website revenue generating continuously, a well designed user interface is very much needed. No users / end clients will think about what all are happening inside your website but they will always check for the look and feel and performance of your website.


You can hire our developers to support your website. By this you don’t need to worry about the updates and technical modifications in your website.

For any assistance, Email us at: sales@innovativewebz.com

Wednesday 28 November 2012

Marking locations dynamically on GoogleMap


Marking locations dynamically on GoogleMap.
We can plot locations dynamically on a GoogleMap with different methods.
Here you can download the complete source code showing how to plot dynamic locations based on latitude and longitude. Also this is explaining how to change the marker color based on locations.
It is very simple and is using client side script only. You can just download and run without installing any webservers. Also you can pass the location variables from your server side scripting language.
Check it and and let us know if you have any queries. You can email us at support@innovativewebz.com

Auto Expand Textarea


Auto expand textarea is a normal requirement for web forms in community based web applications.A number of solutions are available for this with jquery and javascript. But here is a solution that can perfectly work in any html page, no jquery needed. Just a few lines of code is enough. Try this out !
1) Add the following javascript function before closing your </head> tag in html page
<script>
function textAreaAdjust(o) {
o.style.height = "1px";
o.style.height = (25+o.scrollHeight)+"px";
}
</script>
2) Call the above function in onkeyup for your text area.
<textarea onkeyup="textAreaAdjust(this)" style="overflow:hidden"></textarea>
3) Now execute your file from browser URL. You can see that the text area expanding with content.
If you have any questions, please feel free to email us at support@innovativewebz.com

Fatal error: Uncaught CurlException: 60: SSL certificate problem, verify that the CA cert is OK. - Solved


Sometimes you will get an error when you work with facebook apis. This will be like
Fatal error: Uncaught CurlException: 60: SSL certificate problem, verify that the CA cert is OK.
This can be fixed by adding the following two lines of code before just before you go for the api call.
Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYPEER] = false;
Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYHOST] = 2;

Codeigniter facebook API


Login/Signup with facebook is an essential part of a website in these days.Here is the step by step description of integrating Codeigniter facebook api for your web application.
2) Extract the files inside the zip.
3) Move facebook.php, base_facebook.php and fb_ca_chain_bundle.crt to your application/libraries folder.
4) frm_login.php is the view page and you can move it to your application/views folder
5) Now open the home.php and copy the function login() and paste in your controller. You can change the function name and view page name if required.
6) Once you are completed with the above, please create a new app for your website/script from facebook and insert the app id and secret key in your code.
That’s it. Now enjoy facebook login!
If you are developing from your local server, you will need to set a virtual server for your development environment. That is, instead of http://localhost/ you need to load it as http://example.com/ or http://myserver.com/ because facebook will accept the http protocols with domain extensions only and not localhost. (You can set the virtual server from windows/system32/drivers/etc/hosts/).
Hope you are clear about the integration procedure.
If you need any clarifications, please send us an email us at support@innovativewebz.com.

Sign in with Google api PHP


Sign in with Google API is a common requirement for most of the web applications in these days. The implementation of this api is very easy as compared to others. OAuth and Open id methods are available for this. Here we are discussing about the Open ID method for Sign up/Sign in with Google.
You can Download the Google Open ID library from here. For integration, please follow the steps below.
1) Once downloaded, extract the zip and move the files to your desired location.
2) Run http://yourdomain.com/google-openid/example-google.php from your browser URL.
3) This will redirect you to the Google API, once you entered the login credentials the API will ask for your permission to use the basic details for the application. Up on giving permission, the file will show you basic information from your google account. That’s it..
No API keys/setting up required, no coding required, simple and easy way for Google login integration.
For more information about the OpenID you can visit Google development documents at https://developers.google.com/accounts/docs/OpenID
We hope that the documentation was helpful to you. If you have any questions, please feel free to contact us at support@innovativewebz.com

IP2Location – Tracking Geo locations based on IP address



Tracking of locations based on IP is a common requirement for most of the web application. A lot of APIs are providing these facilities. A good option is http://ipinfodb.com
Here we are explaining how to integrate this API with normal PHP website. We have converted the code to a codeigniter library, so that you can use this for you codeigniter application also.
Signing up for API keys
1) An API key is required for setting up this. So first you must register with http://ipinfodb.com/register.php to get an API key. An email will send to your address. Up on activation, you will get an API key displayed in the activation window.
2) Please note down the key once you got this, otherwise the this will not be available again with the same Email address.
Integration with PHP
1) http://ipinfodb.com providing a php class library to connect with their APIs. You can download it from the parent website. It is also available here.
2) Extract the zip and move files to your desired location. After that, you can set the API key in ip2location/index.php. For this please refer to the line:
$ipLite->setKey(your_api_key);
3) Now the API is ready to work. You can execute the script and use it for your application
Integration with Codeigniter
2) Move the file ‘ip2location.php’ to your application/libraries folder.
3) Now you can load the library from your controller as:
$this->load->library(‘ip2location’);
4) Then you need to set the API key as below.
$this->ip2location->setKey(your_api_key);
5) Once it is set, you can call the API for tracking the IP. This will be like:
$locations = $this->ip2location->getCity();
6) $locations is an array with all the details about the location. Printing the array will show all available details.
That’s it.
The above one is free using IP2Location Lite version. But they have a commercial version which provides more accuracy.
For more details about the API and ip address database please visit http://ipinfodb.com
If you have any questions, please feel free to email us at support@innovativewebz.com

PHP Facebook api get all friends


PHP Facebook api get all friends details

You can retrieve the friends details from facebook api by using FQL(facebook query language)

Use the following api call to list all friends and their details.


$data['friends'] = $this->facebook->api(array('method'=>'fql.query',
                                              'query'=>"SELECT uid,name,first_name,middle_name,
                                                        last_name,pic_big,pic_square,
                                                        pic_small,pic_small_with_logo,
                                                        pic_square_with_logo,pic_with_logo,
                                                        wall_count,username,third_party_id,
                                                        subscriber_count,sex,profile_update_time,
                                                        pic,mutual_friend_count,locale,can_post,
                                                        can_message,profile_url,email,website,
                                                        friend_count FROM user WHERE uid IN
                                                        (SELECT uid2 FROM friend
                                                        WHERE uid1 = '".$user."')"));


Please Get back to us at support@innovativewebz.com if you have any questions.

Monday 26 November 2012

Hosting - Partnership with Hostgator


Affiliation with Hostgator

We signed up for affiliate partnership with the most popular web hosting provider Hostgator. This is to offer the hosting for our clients with a discounted price on hosting and subscription charges.




Main features.

1)      UNLIMITED Disk Space
2)      UNLIMITED Bandwidth
3)      99.9% Uptime Guarantee
4)      45 Day Money Back Guarantee
5)      24/7/365 Technical Support
6)      EASY Control Panel 
7)      Reseller, VPS and Dedicated servers


Discount Coupons

We can offer discounts up to $9.94 on hosting charges if you are hosting with hostgator. You will be able to redeem this discount by using the following coupon code.

SRHMAFFCP10

Not only you but your friends/colleagues also will be able to get this discount by using the coupon code.  This is a special offer from Hostgator.com and innovativewebz.com affiliate partnership.

Please get back to us at sales@innovativewebz.com if you have any questions.


Innovativewebz - The Blog


Introduction

Innovativewebz is a web application development and outsourcing company, bringing together an elite group of world class IT professionals and management experts.
Our vision is to provide quality web services at affordable rates to help maximize the customers’ business success and return on investment through teamwork and creativity. We specialize in web design & development, search engine optimization and web marketing, eCommerce, multimedia solutions, graphic and logo design. We build web solutions, which evolve with the changing needs of your business.

Who we are

Innovativewebz is a group of leading professionals having considerable expertise in web application development and implementation. We are genuinely passionate about our goals and the areas that we serve.

Our core values are focused on helping businesses to bring out their full potential. We believe that we have a responsibility to use our resources to make a positive impact on our customers.

Services

Template Design

We will integrate the best quality templates as well as themes for your website/CMS products . You can send your web design or web template files to us, we will integrate this with your website.

Website Development

We can develop the portals/applications/CMS websites from the scracth for you. Using well defined standards and frameworks, our team deliver flexible and secure web solutions.

WebSite Hosting

 You can host the application with our partner webhosts. By this you will be able to get a discount on the hosting and maintenance charges. 

Search Engine Optimization

Getting your company ranked on the natural side of search engines like Google, Yahoo! and Bing is the most cost effective item a company can do today to generate business online. We can do this for you.

Social Media marketing

Social media has become a platform that is easily accessible to anyone with internet access.It serves as a relatively inexpensive platform for organizations to implement marketing campaigns.

Setting your application

If you do not have a server or web hosting account, we will host the your website with one of our partner companies. By this we can continue to serve and maintain your website and keep this up to date.

Support

We offers post development support for your application. This encompass such activities as Error tracking and debugging, enhancements, Comprehensive user support, Technical troubleshooting etc.


Contact Us

You can contact us at any time for any assistance regarding web design,development or website support. Our team will get back to you on the same business day itself.

Sales Team :  sales@innovativewebz.com

Support Team :  support@innovativewebz.com