Weather forecast script in php using Google Weather API

A few days back , we published an article about currency conversion using Google calculator API and php. Today we are going to show you how to display current weather information and forecast data using php and Google Weather API.
The API is situated at http://www.google.com/ig/api?weather and the callback URL for a specific place looks like this :

www.google.com/ig/api?weather=PlaceName&hl=en

The returned data in XML form contains information such as current temperature , weather condition , humidity , winds and forecast for the next few days. Continue Reading…

Minima – WordPress theme

Minima WordPress theme

Minima is sleek minimalistic wordpress theme with a blend of white , black and lime green with many features.

Download Minima WordPress theme

Exquisite – WordPress theme

Exquisite - free WordPress theme
Exquisite is a beautiful nature-themed two-column 800px wide WordPress theme with widgetised sidebar , Cufon text-image replacement for headers , jQuery tooltips on links , Custom logos , reply/quote feature on comments , collapsible widgets , built-in social bookmarks on posts and many other features.

Salient Features

  • 800px wide
  • Two-columns with left sidebar
  • Cufon text-image replacement for headings
  • Collapsible widgets
  • jQuery animated tooltips on links ( use the title attribute)
  • Reply/Quote feature on comments
  • Zebra stripped and Admin highlighted comments
  • Custom logo support
  • Search Engine Optimized
  • Smooth scrolling for internal links
  • Custom description in footer for better SEO
  • Builtin social bookmarking for 6 most common sites
  • Ability to add custom CSS from theme options page without having to edit the stylesheet
  • Google Analytics integration
  • Displays a browser warning to IE 6 users
  • CSS 3 curved border and text-shadow effects
  • Easy to customize and clean CSS
  • Some custom CSS classes that you can use in posts :
    • .highlight , .note
    • .warning , .error
    • .download ( use on <a> )
    • .frame ( us on images to give them a silvery frame )

Download Exquisite

Download Exquisite WordPress theme

funPress – A fun WordPress theme

funPress - free WordPress theme
FunPress is a fun WordPress theme with features such as : four different header backgrounds loaded at random, google analytics integration, reply/quote feature for comments, animated jQuery tooltips on links , twitter integration and SEO.

Download funPress WordPress theme

Prismatic – Free WordPress theme

Prismatic - free WordPress theme

Prismatic is a clean and beautiful wordpress theme with features such as Cufon , jQuery tooltips , threaded comments , inbuilt social bookmarking support , horizontal navigation bar , custom header image etc . The theme is compatible with WordPress 2.9.2 and is SEOfied .
Continue Reading…

Currency conversion using php and Google calculator api

Google is a wonderful ! While most of us use it for searching the web for information , few are aware that it has an inbuilt calculator which can also be used for converting a currency into another . Doing so is really simple , you just type ” AMOUNT CURRENCY_CONVERTING_FROM in CURRENCY_CONVERTING_TO ” and search , the inbuilt calculator will give you the result .For example , if one wants to convert 1 U.S Dollar into Euro , he shall type “1 USD in EUR” .

Now lets get to the topic of this post , Google also has a secret calculator API ( http://www.google.com/ig/calculator ) that is usually used for iGoogle gadgets , but since its free and open , anyone can use it .
Continue Reading…

WordPress theme – The Ataraxis


Ataraxis literally means “absence of mental stress or anxiety” . And that is exactly what this beautiful WordPress theme does !The Ataraxis is a nature-themed two-column 800px wide WordPress theme with widgetised sidebar , Cufon text-image replacement for headers ,
jQuery tooltips on links ,Rotating headers , Custom logos , reply/quote feature on comments , collapsible widgets , built-in social bookmarks on posts and many other features.

The Ataraxis Features

  • 800px wide
  • Two-columns with left sidebar
  • Cufon text-image replacement for headings
  • 4 different nature-themed header backgrounds
  • Collapsible widgets
  • Sutured Javascript for faster loading
  • jQuery animated tooltips on links ( use the title attribute)
  • Reply/Quote feature on comments
  • Zebra stripped and Admin highlighted comments
  • Custom logo support
  • Search Engine Optimized
  • Smooth scrolling for internal links
  • Custom description in footer for better SEO
  • Builtin social bookmarking for 6 most common sites
  • Ability to add custom CSS from theme options page without having to edit the stylesheet
  • Google Analytics integration
  • Displays a browser warning to IE 6 users
  • CSS 3 curved border and text-shadow effects
  • Easy to customize and clean CSS
  • Some custom CSS classes that you can use in posts :
    • .highlight , .note
    • .warning , .error
    • .download ( use on <a> )
    • .frame ( us on images to give them a silvery frame )
  • Around a dozen theme options

Download The Ataraxis v1.0

jQuery 1.4 is out !

The latest and greatest version of jQuery , v1.4 is now out. This version comes bundled with many new great features such as per-property easing , new live events ( including submit !) , ability to delay() animations & new focusIn and focusOut events .
Net tuts published an article summarising the new features in jQuery 1.4 .

Download jQuery 1.4 directly from here : http://code.jquery.com/jquery-1.4.js

Code for HTML drop down menu of all countries

During development involving user registeration , you might want to display a drop down list of all countries for the user to chose from , but writing all that code for ( <select><option….. ) for 140+ countries can be a tidious and frustrating task , so here is the code for HTML drop down menu of all countries . The 140+ countries Continue Reading…

Playing Online Slot Games is Fun !

Slot games are one of the most popular online games. Almost every online casino provides online slots. One of the most popular online games, slots can be found in almost every online casino. A huge variety of slot games are available online. Easy to use and offering huge entertainment, they are fun playing.

Considerations that are important while playing the online slot games are the choice of games, bonuses, and jackpots. Wherever the game is played, learning about the rules and regulations offered by the provider of the game would be the prime concern for the player.

Before entering the phase of playing the serious slot games online, it could be good practicing on one of the free online games available in plenty on the web. Practice makes one perfect and playing free games would help refining the player’s gaming skills and could provide a platform for moving on to something more serious.

Strategy making is very important for gaining success while playing online slots. Basic objectives of strategy building would be reduction of the house edge and increasing the winnings, while playing the slot game. Learning about various bonus offers, jackpots, ratings and bankroll management would be important for any newcomer to the game.

Online gaming often requires downloading of software. Dispensing with such requirements makes the game easier. Many sites providing slot games online allow direct playing facilities by simply logging on to their sites even without any registration.

Since slots game is commonly misunderstood, it is necessary to learn about the changes that have taken place in the gaming world during last three decades. All slot games have RNG (Random Number Generators). Key to all slot games, it cannot be altered in any way by the players. Combination of numbers is the factor determining the winner in the game. All combination of numbers however does not provide equal winning chances. Thousands of non-winning combinations are there, but when the player hits a near-miss it will mean that the slot is about to pay.

Patience and endurance pays in this game

Wordpress: Add Homepage-only links

Well, this is my first guest post at DG…let’s start out with something useful in WordPress…

Sometime ago, I had to add a “homepage-only” link on my WP Blog, that would appear only on the Homepage of the blog and no where else. There isn’t any such option in WP so I tried out some googling to get a solution for it :) Continue Reading…

How not to design a site ?

How not to design a website - Pic

P.S : this was one of my very first attempts at web design :d .

Q-Press , A sleek wordpress theme

Q-Press Wordpress theme

As i promised in my last post , here i am , once again with a new free Wordpress theme . Q Press is a two-column maroon and silvery white Wordpress theme bundled with a host of features that is ideal for any type of Blog. Continue Reading…

The New Look! ( Re-design 21 Aug 09)

Re-design of Dynamicguru.com
Just finished a complete re-design of this site, this time i decided to choose light colors. The homepage now features a “featured posts” slider and an ad box. Comments are jazzed up with “Reply” and “Quote” buttons (how i did them? coming soon…!) . Let me know in the comment below what you think about the new design.

Download complete jQuery documentation ( jQuery API browser )

I love the official jquery docs website, and always refer to it whenever i am stuck with a method or cant remember an awesome functions name :p .As i have a slow internet connection , i was recently searching for an offline version of the awesome Official jQuery documentation but couldnt find one. I asked John Resig about it and he was kind enough to point me to the right direction and told me about the jQuery API browser which can also be downloaded to your system for free from here :
http://api.jquery.com/update/jquery-api-browser-2.0.air
The jQuery API browser will only work if you have Adobe AIR installed on your system. It makes a great source for offline reference when you are developing and dont have an internet connection.
http://api.jquery.com/update/jquery-api-browser-2.0.air

30+ Best Practices for PHP Beginners : Nettuts+

Nettuts+ recently published a very nice article summarising “30+ Best Practices for PHP Beginners” . The article is a must read for all PHP beginners. Check out the article here :
http://net.tutsplus.com/tutorials/php/30-php-best-practices-for-beginners/

Wordpress theme – Dark Temptation

Free Wordpress Theme - Dark Temptation

Dark Temptation is a dark wordpress theme with a touch of cyan . Its beautiful, uses Cufon text-image replacement for headers , and is SEO optimized . Boasts a horizontal navigation menu , few theme options and a widgetized left side-bar . Download and enjoy ! :)
Download Dark Temptation Theme

How to know what keywords visitors Googled to reach your site?

Here is a simple php script that will detect if your visitor is coming from Google and then log the keyword used to reach your site to a file. The script logs the visitors ip address along with the keyword and exact date and time to a file in the form x.x.x.x googled for “key word here” on Month Date, Year, at Hours:minutes am/pm. To use the script, just paste the following code into your php pages , and set the variable $log_file appropriately.
Here is the code :

<?php

/* JUST A FEW SETTINGS FIRST
The log file name,
this is where the key words will be stored,
make sure to keep a difficult-to-guess name
for privacy reasons
*/

 
$log_file="google-keywords-log.log";

/*
 Set your timezone (just to make sure you can analyze the data better)
 Some useful time zone values :
 Asia/Karachi
 Asia/Dacca
 Asia/Qatar
 Asia/Muscat
 Asia/Tokyo
 for a complete list, refer to http://www.php.net/manual/en/timezones.php
*/

date_default_timezone_set("Asia/Calcutta");

// THE CODE
if (strpos($_SERVER[‘HTTP_REFERER’],‘http://google’) OR strpos($_SERVER[‘HTTP_REFERER’],‘http://www.google’)) {
$referer=$_SERVER[‘HTTP_REFERER’];
$url=parse_url($referer);
parse_str($url["query"],$query);
$data=$_SERVER[‘REMOTE_ADDR’]." googled for \"".$query["q"]."\" on ".date("F j, Y,")." at ".date("g:i a")."\r\n\r\n";
$fp=fopen($log_file,"a+");
fwrite($fp,$data);
fclose($fp);

}
?>

Code Explained

We first check to see if our visitor has been refered to our site by google by checking the predefined variable $_SERVER["HTTP_REFERER"] for occurences of the string http://www.google or http://google using the strpos() function. Then we parse the referer url using parse_url() function. Then we go on to parse the “query” component of the array returned by parse_url() using the parse_str() function which parses the strings as if it were the query string passed via a URL and sets variables in the current scope. Once the string is parsed into the array $query , we can access our keyword term at $query["q"] .Finally we open our log file (set in $log_file ) in the append mode (a+) and append the visitors IP adress, the keyword and date and time to the file.

Sniffing Googlebot using php

Ever wanted to know when Googlebot (google’s search engine spider) visits your site? . Googlebot can be sniffed (detected) easily using php. It is identifiable by the “Googlebot” string in the HTTP_USER_AGENT field it sends with the headers. Here is a simple function called is_google() which returns TRUE if the visitor is Googlebot, else FALSE.

//The function
function is_google() {
if (strpos($_SERVER[‘HTTP_USER_AGENT’],"Googlebot"))
 return true
else
 return false
}

Usage

To use the function, just call it using an if statement, here is how :

if (is_google())
{
 //do something here if the visitor is Googlebot
//like log the date and time to a file/database
}

Some common uses of this function can be :

  • Analyzing the visit of Googlebot to your sites
  • Spamdexing,Cloaking ( deceiving )
    serving different content (like bulk of links,high ranking keywords etc…) to Googlebot for better rankings
NOTE
Using this function for cloaking and spamdexing is a black hat SEO technique and can cause your site to be blacklisted by Google

Parsing “ini” configuration files using php


Many times during development involving php, one would want to store some variables as settings. The most common way developers do this is by defining those variables at the beginning of the script. For example, while writing a contact form script, I would like to define a few handy variables first, including admin email, contact log file name/path and etc… The most common way to do this would be to write something similar in your php script.

/******* S E T T I N G S *********/
$admin_email="you@yourdomain.com";
$file="logs/contact.log";
$success_msg="Thanks! your submission was recieved, we will get back to you soon!";
/****** E N D ****************/

Read the rest of the article on Devils Workshop

© 2010 Dynamic Guru All rights reserved — About UsContactMujtaba