Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

This is a small and simple local home page that automatically lists, and provide links to, your local sites. It's a companion project for a [blog post](http://mallinson.ca/post/osx-web-development) I wrote about setting up your Mac for web development.

**Update**: You can now set a custom port for a directory. Simply add a file to the root of your site with the name '.port8080', for example and the homepage link will automatically append ':8080' to your site.

* img/icon-gear.png from [Icons DB](http://www.iconsdb.com/black-icons/gear-2-icon.html)
18 changes: 14 additions & 4 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>

<?php ini_set('display_errors', 'On');?>
<?php require('config.php'); ?>

<html>
Expand Down Expand Up @@ -33,21 +33,31 @@

<content class="cf">
<?php

foreach ( $dir as $d ) {

$dirsplit = explode('/', $d);
$dirname = $dirsplit[count($dirsplit)-2];

printf( '<ul class="sites %1$s">', $dirname );

foreach( glob( $d ) as $file ) {

$project = basename($file);
$project = basename($file);

//Search for .port* flag flies
$portflag = glob( $file . '/.port*');
if( $portflag[0] ) {
$port = ':' . substr(basename($portflag[0]), 5);
} else {
$port = '';
}

if ( in_array( $project, $hiddensites ) ) continue;

echo '<li>';

$siteroot = sprintf( 'http://%1$s.%2$s.%3$s', $project, $dirname, $tld );
$siteroot = sprintf( 'http://%1$s.%2$s.%3$s%4$s', $project, $dirname, $tld, $port );

// Display an icon for the site
$icon_output = '<span class="no-img"></span>';
Expand All @@ -69,7 +79,7 @@
else
$displayname = $siteoptions[$project];
}
printf( '<a class="site" href="%1$s">%2$s</a>', $siteroot, $displayname );
printf( '<a class="site" href="%1$s">%2$s</span></a>', $siteroot, $displayname );


// Display an icon with a link to the admin area
Expand Down