Show DevBest [REL][PHP] Add Style to your HTDOCS!

Status
Not open for further replies.

Tronscript

Member
Aug 18, 2012
93
8
Tired of seeing that old, bland HTDOCS directory? Well, it's about time you cleaned it up! The script below will style your HTDOCS, using buttons! It's a simple release, but I take little-to-no credit, as I've used open-source code to construct/learn this.

PHP:
<?php
$sitename = 'Site Projects';
?>
 
<html>
<head>
<title><?php echo $sitename; ?></title>
 
<style type="text/css">
 
a{
text-decoration: none;
color: white;
}
 
body{
margin: 300 auto;
font-size: 12px;
color: white;
font-family: Sans-serif;
background: #DDDDDD;
}
 
.content{
margin: 0 auto;
text-align: center;
}
 
.button {
    display: inline-block;
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffc930), color-stop(100%,#ffa403));
    background: -moz-linear-gradient(center top, #ffc930 0%, #ffa403 100%);
    -webkit-box-shadow: 1px 1px 2px #e6e6e6, 0.5px 1px #ffd96f inset;
    -moz-box-shadow: 1px 1px 2px #e6e6e6, 0.5px 1px #ffd96f inset;
    box-shadow: 1px 1px 2px #e6e6e6, 0.5px 1px #ffd96f inset;
    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    border-radius: 3px;
    text-shadow: 1px 1px 0px #b27b0d;
    padding: 11px 15px;
    border-color: #e39304;
    border-width: 1px;
    border-style: solid;
    font-family: Helvetica;
    font-size: 14px;
    color: #ffffff;
    font-weight: bold;
}
.button:hover {
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffd766), color-stop(100%,#ffa403));
    background: -moz-linear-gradient(center top, #ffd766 0%, #ffa403 100%);
    -webkit-transition: all 0.5s ease-in-out;
    -moz-transition: all 0.5s ease-in-out;
    -o-transition: all 0.5s ease-in-out;
    transition: all 0.5s ease-in-out;
}
.button:active {
    -webkit-box-shadow: 1px 1px 1px 1px #ffa403 inset;
    -moz-box-shadow: 1px 1px 1px 1px #ffa403 inset;
    box-shadow: 1px 1px 1px 1px #ffa403 inset;
}
 
</style>
 
</head>
 
<body>
 
<?php
//$fileList = '<div class="button"><a target="_new" href="'.$file.'">'.$file.'</a></div>';
 if ($handle = opendir('.')) {
   while (false !== ($file = readdir($handle)))
      {
          if ($file != "." && $file != ".." && is_dir($file))
 {
         @$fileList .= '<a target="_new" href="'.$file.'">
 <div style="margin-right: 2px;" class="button">'.$file.'</div>
 </a>';
          }
       }
  closedir($handle);
  }
?>
 
<div class="content">
<?php echo $fileList; ?>
</div>
 
</body>
 
</html>

How it works?
Make a new file called index.php, and paste this script into it. Then, on line 2, edit that one variable, and set it to whatever page title you want.
 

Macemore

Circumcised pineapples
Aug 26, 2011
1,681
819
Looks nice, no point in creating an array for only one variable to shorten up the code just make it $sitename.

Nice release.
 

Macemore

Circumcised pineapples
Aug 26, 2011
1,681
819
He said edit he var on line 3, there isn't one.

close_enough.png

Anyone that can edit it would be able to fix what he said mentally.
 

Sean

‫‫‫‫‫‫  ‫  Don't Worry, Be Happy
Dec 12, 2011
1,121
405
why is there a $supa thing in their? if this is for any site
 

Tronscript

Member
Aug 18, 2012
93
8
It's quite obvious that I meant line 2

because I'm starting a developing group (not forum) called Supa Dev, so everything we code would revolve around "supa".
 

Sean

‫‫‫‫‫‫  ‫  Don't Worry, Be Happy
Dec 12, 2011
1,121
405
It's quite obvious that I meant line 2

because I'm starting a developing group (not forum) called Supa Dev, so everything we code would revolve around "supa".
Yes but it would not work if someone used that on their site, And i just noticed you changed it ;)
 

Macemore

Circumcised pineapples
Aug 26, 2011
1,681
819
It's quite obvious that I meant line 2

because I'm starting a developing group (not forum) called Supa Dev, so everything we code would revolve around "supa".
Not like Chris did this or anything >_>
 

Tronscript

Member
Aug 18, 2012
93
8

HTML:
<?php
$sitename = 'Site Projects';
?>
 
<html>
<head>
<title><?php echo $sitename; ?></title>
 
<style type="text/css">
 
    a{
        text-decoration: none;
        color: white;
    }
   
    body{
        margin: 300 auto;
        font-size: 12px;
        color: white;
        font-family: Sans-serif;
        background: #DDDDDD;
    }
   
    .content{
        margin: 0 auto;
        text-align: center;
    }
   
.button {
    display: inline-block;
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffc930), color-stop(100%,#ffa403));
    background: -moz-linear-gradient(center top, #ffc930 0%, #ffa403 100%);
    -webkit-box-shadow: 1px 1px 2px #e6e6e6, 0.5px 1px #ffd96f inset;
    -moz-box-shadow: 1px 1px 2px #e6e6e6, 0.5px 1px #ffd96f inset;
    box-shadow: 1px 1px 2px #e6e6e6, 0.5px 1px #ffd96f inset;
    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    border-radius: 3px;
    text-shadow: 1px 1px 0px #b27b0d;
    padding: 11px 15px;
    border-color: #e39304;
    border-width: 1px;
    border-style: solid;
    font-family: Helvetica;
    font-size: 14px;
    color: #ffffff;
    font-weight: bold;
}
.button:hover {
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffd766), color-stop(100%,#ffa403));
    background: -moz-linear-gradient(center top, #ffd766 0%, #ffa403 100%);
    -webkit-transition: all 0.5s ease-in-out;
    -moz-transition: all 0.5s ease-in-out;
    -o-transition: all 0.5s ease-in-out;
    transition: all 0.5s ease-in-out;
}
.button:active {
    -webkit-box-shadow: 1px 1px 1px 1px #ffa403 inset;
    -moz-box-shadow: 1px 1px 1px 1px #ffa403 inset;
    box-shadow: 1px 1px 1px 1px #ffa403 inset;
}
 
</style>
 
</head>
 
<body>
 
<?php
//$fileList = '<div class="button"><a target="_new" href="'.$file.'">'.$file.'</a></div>';
if ($handle = opendir('.')) {
  while (false !== ($file = readdir($handle)))
      {
          if ($file != "." && $file != ".." && is_dir($file))
      {
              @$fileList .= '<a target="_new" href="'.$file.'">
                              <div style="margin-right: 2px;" class="button">'.$file.'</div>
                          </a>';
          }
      }
  closedir($handle);
  }
?>
 
<div class="content">
    <?php echo $fileList; ?>
</div>
 
</body>
 
</html>
 
Status
Not open for further replies.

Users who are viewing this thread

Top