Friday, April 25, 2008

Change the colour of scrollbars using css

This code will change the color or scroll bar of the window:

body {
scrollbar-3dlight-color:#ffd700;
scrollbar-arrow-color:#ff0;
scrollbar-base-color:#ff6347;
scrollbar-darkshadow-color:#ffa500;
scrollbar-face-color:#008080;
scrollbar-highlight-color:#ff69b4;
scrollbar-shadow-color:#f0f
}



Will work in IE, but not in FF.

From:
http://websitetips.com/articles/css/scrollbars/

Tuesday, April 22, 2008

Use of === and !== operators in PHP

=== (identical)
$a === $b : TRUE if $a is equal to $b, and they are of the same type. (introduced in PHP 4)

!== (Not identical)
$a !== $b : TRUE if $a is not equal to $b, or they are not of the same type.

Example:
<?php
$a = "1"; //String
$b = 1; //Integer
if($a == $b)
echo "Equal<br />";
else
echo "Not Equal<br />";

if($a === $b)
echo "Identical<br />";
else
echo "Not Identical<br />";
?>

Output:
Equal
Not Identical


From: http://in.php.net/manual/en/language.operators.comparison.php

Wednesday, April 16, 2008

Changing / Setting Server Timezone in PHP

<?
session_start();
ob_start();
echo '1 '.date("d-m-Y H:i:s"); // Default server time zone

putenv("TZ=Asia/Calcutta"); //change your server time zone - this one is for India - works in PHP 4
// also you can try: date_default_timezone_set('Asia/Shanghai'); - since PHP 5.1.0

echo '2 '.date("d-m-Y H:i:s");

//Reference:
// http://in.php.net/manual/en/function.date.php
// http://in.php.net/manual/en/timezones.php
// http://in.php.net/manual/en/function.date-default-timezone-set.php
?>

Getting Checkbox Values in PHP

<?php
if(isset($_REQUEST['lang']))
{
$lang=$_REQUEST['lang'];
foreach ($lang as $language)
{
echo "$language is checked <br />";
}
echo "Selected Array: ";
print_r($lang);
}
?>
<html>
<head>
<title>TEST</title>
</head>
<body>
<form method="post" action="#">
Please choose language:<br />
<input type="checkbox" name="lang[]" value="JAVA">JAVA<br />
<input type="checkbox" name="lang[]" value="VB">VB<br />
<input type="checkbox" name="lang[]" value="PHP">PHP<br />
<input type="submit" value="submit" name="submit">
</form>
</body>
</html>

Tuesday, April 15, 2008

HTML - CSS - Round corner table - Curve corners

<html>
<head>
<title>Test</title>
<style>
b.rtop, b.rbottom{display:block;}
b.rtop b, b.rbottom b{display:block;height: 1px;overflow: hidden; background: #9BD1FA}
b.r1{margin: 0 5px}
b.r2{margin: 0 3px}
b.r3{margin: 0 2px}
b.rtop b.r4, b.rbottom b.r4{margin: 0 1px;height: 2px}
</style>
</head>
<body>
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="table1">
<tr>
<td><b class="rtop"><b class="r1"></b><b class="r2"></b><b class="r3"></b><b class="r4"></b></b></td>
</tr>
<tr>
<td bgcolor="#9BD1FA"> </td>
</tr>
<tr>
<td><b class="rbottom"><b class="r4"></b><b class="r3"></b><b class="r2"></b><b class="r1"></b></b></td>
</tr>
</table>
</div>
</body>
</html>

Difference between echo and print in PHP

1. Speed.  There is a difference between the two, but speed-wise it
should be irrelevant which one you use. echo is marginally faster
since
it doesn't set a return value if you really want to get down to the
nitty gritty.

2. Expression. print() behaves like a function in that you can do:
$ret = print "Hello World"; And $ret will be 1. That means that print
can be used as part of a more complex expression where echo cannot. An
example from the PHP Manual:

$b ? print "true" : print "false";

print is also part of the precedence table which it needs to be if it
is
to be used within a complex expression. It is just about at the bottom
of the precedence list though. Only "," AND, OR and XOR are lower.

3. Parameter(s). The grammar is: echo expression [, expression[,
expression] ... ] But echo ( expression, expression ) is not valid.
This would be valid: echo ("howdy"),("partner"); the same as: echo
"howdy","partner"; (Putting the brackets in that simple example
serves
no purpose since there is no operator precedence issue with a single
term like that.)

So, echo without parentheses can take multiple parameters, which get
concatenated:

echo "and a ", 1, 2, 3; // comma-separated without parentheses
echo ("and a 123"); // just one parameter with parentheses

print() can only take one parameter:

print ("and a 123");
print "and a 123";

From:
http://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/40