My blog has moved!

You will be automatically redirected to the new address. If that does not occur, visit
http://ashokbasnet.com.np
and update your bookmarks.

Sunday, January 16, 2011

Customize your localhost Display

Have u ever thinked of getting your localhost display customized with the local projects being displayed with lots of other stuffs than simply “It Works” text. Here is a simple HTML, CSS and JQuery based localhost index page so that u can get urself dynamic…
1. First of all listing your local projects stored in htdocs folder or www(for wampp) is a great idea to get a look at your projects.
$dir = "../webroot";  //give ur directory  where project is located
if($handle = opendir($dir)){
     while($file = readdir($handle)){
         clearstatcache();
          if(!is_file($dir.'/'.$file) && $file[0] != '.' && $file != '..' && $file!='localhost')    //which directory not to show
              print "<font face=\"Verdana, Arial, Helvetica, sans-serif\"> <li><a href=$file target='_blank'>$file</li></font></a>";
       }
      closedir($handle);
  }
2. The index.php file is created that loads automatically when http://localhost is hit in the address bar. The localhost folder is created to store the javascript, css and images files.
3. Finally the localhost is customized according to your need.
Here is screenshot of how I came up with my localhost….
localhost

Download the localhost source codes.

0 comments :

Post a Comment