Skip to content

Instantly share code, notes, and snippets.

@NoxArt
Created February 22, 2012 09:02
Show Gist options
  • Save NoxArt/1883493 to your computer and use it in GitHub Desktop.
Save NoxArt/1883493 to your computer and use it in GitHub Desktop.
Nette - expose more parameters to config
<?php
namespace Tacnayn\Config;
use Nette;
class Configurator extends Nette\Config\Configurator {
protected function getDefaultParameters()
{
$parameters = parent::getDefaultParameters();
$baseUrl = rtrim($this->container->httpRequest->getUrl()->getBaseUrl(), '/');
$parameters['baseUrl'] = $baseUrl;
$parameters['basePath'] = preg_replace('#https?://[^/]+#A', '', $baseUrl);
return $parameters;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment