From 6178398eaea320eaf803820ad3c57aaf7eb2534c Mon Sep 17 00:00:00 2001 From: Jason Wilson Date: Thu, 4 Aug 2016 13:46:17 -0400 Subject: [PATCH] Modified index.php to search each directory for a .port* file to allow users to set a port for the directory without having to modify config.php. --- README.md | 1 + index.php | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3c719a4..6f04c49 100644 --- a/README.md +++ b/README.md @@ -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) \ No newline at end of file diff --git a/index.php b/index.php index 209751f..afdb4b6 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,5 @@ - + @@ -33,7 +33,9 @@ '; - $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 = ''; @@ -69,7 +79,7 @@ else $displayname = $siteoptions[$project]; } - printf( '%2$s', $siteroot, $displayname ); + printf( '%2$s', $siteroot, $displayname ); // Display an icon with a link to the admin area