Home
 

Show php pages as html

Below code will convert all your php pages to .html page. This is often required when you want to execute php codes but want page extension as .html.

First write all your php codes and save the file as any-name.php. Then put below codes in .htaccess file and you’ll be able to see the file as file as any-name.html.

1
2
3
4
5
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.html $1.php

Function call with mouse cursor is moved

Whenever mouse cursor is moved over a matched element, the first specified function is fired.
Download jquery-1.3.2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<script type="text/javascript" src="js/jquery-1.3.2.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $("li").hover(
              function () {
                $(this).append($("<span>*</span>"));
              },
              function () {
                $(this).find("span:last").remove();
              }
            );
        });
    </script>
<ul>
	<li>A</li>
	<li>B</li>
	<li>C</li>
	<li>D</li>
 </ul>

Output :
A
B
C
D

Hover to add and remove class

Download jquery-1.3.2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<script type="text/javascript" src="js/jquery-1.3.2.js"></script>
    <script type="text/javascript">

        $(document).ready(function(){
             $("div").hover(
                  function () {
                    $(this).addClass("my");
                  },
                  function () {
                    $(this).removeClass("my");
                  }
             );
        });
    </script>
    <style>
  .my { color:red; }
  </style>

  <div>Hello World</div>

Output :
Hello World

Hover to fade in and out

Download jquery-1.3.2

1
2
3
4
5
6
7
8
9
10
11
12
13
<script type="text/javascript" src="js/jquery-1.3.2.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
              $("div").hover(function(){$(this).fadeOut(100);$(this).fadeIn(500);});
        });
    </script>
    <div><h1>Hello World</h1></div>

Output :
Hello World

Hover action

Download jquery-1.3.2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<script type="text/javascript" src="js/jquery-1.3.2.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
              $("b").hover(function () {
                   $(this).css({'background-color' : 'yellow', 'font-weight' : 'bolder'});
              }, function () {
                   var cssObj = {
                     'background-color' : '#ddd',
                     'font-weight' : '',
                     'color' : 'red'
                   }
                   $(this).css(cssObj);
              });
        });
    </script> 

    <b>Hello World</b>

Output :
Hello World

Using the explode() and implode() Function

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
    $str = "Colonia De Sant Jordi.";

    $pieces = explode(" ", $str);

    echo "Nodes: <BR/>\n";
    foreach($pieces as $name) {
        echo trim($name) . "<BR/>\n";
    }
?>

Output:
Nodes:
Colonia
De
Sant
Jordi.

Using explode() with date()

1
2
3
4
5
6
7
<?php
$ar = explode('|',date("h a|F d, Y"));
echo "It's after $ar[0] on $ar[1]";
?>

Output:
It’s after 03 pm on November 04, 2011

Using implode()

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
$arr[0] = "Colonia";
$arr[1] = "De";
$arr[2] = "Sant";
$arr[3] = "Jordi.";
$str = implode(" ", $arr);
print("$str<BR>");
?>

Output:
Colonia De Sant Jordi.

 
 
 

Categories

Tag