Skip to content

Instantly share code, notes, and snippets.

@derekblank
Created November 8, 2013 15:16
Show Gist options
  • Save derekblank/7372431 to your computer and use it in GitHub Desktop.
Save derekblank/7372431 to your computer and use it in GitHub Desktop.
app/public/config.php
<?php
/**
* Config Variables
*
* This file consist primarily of path variables to simplify
* the inclusion of assets and partials.
*/
/**
* If your deployment is in a directory update this variable
* to include the path to the subdirectory.
*/
$directory = '/public/';
/**
* Build site URL
*/
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) {
$protocol = 'https://'; // with SSL
} else {
$protocol = 'http://'; // w/o SSL
}
$port = $_SERVER['SERVER_PORT']; // Server port
$site_url = $protocol . $_SERVER['SERVER_NAME']; // Build base
$site_url = (!empty($port)) ? $site_url . ':' . $port : $site_url; // Append port
$site_url = $site_url . $directory; // Append installation path
/**
* Define ABSPATH as this file's directory
*/
define( 'ABSPATH', dirname(__FILE__) );
/**
* Asset paths
*/
define( 'SITE_URL', $site_url );
define( 'CSS_PATH', SITE_URL . '/assets/stylesheets' );
define( 'JS_PATH', SITE_URL . '/assets/javascripts' );
define( 'IMG_PATH', SITE_URL . '/assets/images' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment