Skip to content

Instantly share code, notes, and snippets.

@dustinlakin
Created April 5, 2012 08:50
Show Gist options
  • Save dustinlakin/2309287 to your computer and use it in GitHub Desktop.
Save dustinlakin/2309287 to your computer and use it in GitHub Desktop.
Setting up Settings
<?php
//setup inside index.php
$config = new Settings();
$config->scripts = array("jquery-1.7.1.min.js", "script.js");
$config->styles = array("styles.css");
//inside helpers/Settings.php class
public function __construct(){
$this->siteRoot = str_replace("index.php", "", $_SERVER['PHP_SELF']);
$this->documentRoot = str_replace("index.php", "", $_SERVER['SCRIPT_FILENAME']);
$this->webRoot = $_SERVER['SERVER_NAME'] . $this->siteRoot;
$this->viewsPath = $this->documentRoot . "views/";
$this->jsPath = $this->siteRoot . "js/";
$this->cssPath = $this->siteRoot . "css/";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment