Archive for November, 2010

Refreshing DIV using jquery

Posted: November 24, 2010 in HTML, jQuery, PHP
Tags: , ,

There are very simple steps to achieve this:
Step 1:
Copy the following code and paste it in the head section of your webpage.

<script src="http://ajax.googleapis.com/ajax/
libs/jquery/1.3.0/jquery.min.js"></script>
 <script>
var auto_refresh = setInterval(
function()
{
$('#loaddiv').fadeOut('slow').load('reload.php').fadeIn("slow");
}, 20000);
</script>

Here , above the file “reload.php” will be reloaded in every 20000ms ie 20 second . You can change the file which you have to reload and you can also change the reload time as per your requirement.
and secondly , the #loaddiv is the name of DIV which is going to be refreshed.
(more…)

Advertisements

Easy way to install Drupal

Posted: November 24, 2010 in Drupal
Tags:

Sometimes we think that Drupal installation is too hard,but it is wrong idea.Drupal installation is so easy if we use the open source software named Acquia (this is totally free), so don’t worry.Today I discuss very very easiest way to install Drupal.I brief it step by step is shown below :

Step-1 :

First you download Acquia from this link  http://acquia.com/ for various types of operating systems. Then install it on  your computer.

Stap-2 :

Then you open the application from start button.Then click  Start button to start Apache Web Server and MySQL Database Server like the below screen shot :

(more…)

Learn PHP-21 : if… else… else if Statements

Posted: November 20, 2010 in PHP
Tags:

We use the if… else… else if statements to establish conditional logic and evaluate things when needed in our scripts. Sometimes you have to evaluate values to then give the user the correct output on page once the variable value is checked.

if

<?php $current_temperature = 37; // Current South Pole temperature // Then the if statement will evaluate it for us if ($current_temperature > 32) { // Set things to melt if the temp is exceeding 32(freezing) echo "Doom! The icecaps will melt, sea levels will rise."; } // If the temp is still freezing(32), nothing at all will happen in this script ?>
 

The browser is shown like below

Doom! The icecaps will melt, sea levels will rise.

(more…)

In this tutorial create 3 files
1. guestbook.php
2. addguestbook.php
3. viewguestbook.php

Step
1. Create table name “guestbook” in database “test”.
2. Create file guestbook.php.
3. Create file addguestbook. php.
4. Create file viewguestbook.php

1. Set up database

CREATE TABLE `guestbook` (
`id` int(4) NOT NULL auto_increment,
`name` varchar(65) NOT NULL default '',
`email` varchar(65) NOT NULL default '',
`comment` longtext NOT NULL,
`datetime` varchar(65) NOT NULL default '',
PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

(more…)

Learn PHP-20 : The ?(ternary) Operator

Posted: November 14, 2010 in PHP
Tags:

There is an operator in PHP that is very similar in functionality to the if statement called the ternary (?) conditional operator. It evaluates to check if the first subexpression is true, if it is it will return the value of the second subexpression, if the first subexpression is false it will return the value of the third subexpression.

Here is a code example using flavor variables and checking to see if the shop has our favorite flavor using ?:

<?php
// Let's say our choice is chocolate
$flavor_choice = "chocolate";
// And we do not know it yet but all they have is vanilla
$output = ($flavor_choice == "vanilla") ? "Yes, we have vanilla." : "Sorry we do not have $flavor_choice.";
// output the appropriate subexpression
echo "$output";
?>

The output is shown below :

Sorry we do not have chocolate.