示例#1
0
 /**
  * Default action
  * @param $args array
  */
 public function index(array $args = array())
 {
     \App::setVariable('pageTitle', 'Hello, World.');
     \App::setVariable('helloWorld', 'This does work.<br>');
     \App::setConfig('hello', 'Hello World');
     echo \App::getConfig('hello');
 }
示例#2
0
/**
 * Get / set the specified configuration value.
 *
 * If an array is passed as the key, we will assume you want to set an array of values.
 *
 * @param  array|string  $key
 * @param  mixed  $default
 * @return mixed
 */
function config($key, $default = null)
{
    if (is_array($key)) {
        return App::setConfig($key, $default);
    }
    return App::getConfig($key, $default);
}
	public function dispatchLoopStartup($request)
	{
		$view = Zend_Controller_Action_HelperBroker::getExistingHelper('viewRenderer')->view;
		$device = $view->getHelper('userAgent')->getUserAgent()->getDevice();
		if($device instanceof Zend_Http_UserAgent_Mobile){
			//reset view script base path
			$config = App::getConfig();
			$config['template']['defaulttheme'] = $config['template']['defaultmobiletheme'];
			$config['template']['defaultskin'] = $config['template']['defaultmobileskin'];
			App::setConfig($config);
			
			//reset layout script base path
			$layout = Zend_Layout::getMvcInstance();
            $layout->setViewScriptPath(APPLICATION_PATH.'/design/frontend/'.$config['template']['defaultmobilelayout'].'/layout/');
		}
	}
示例#4
0
文件: index.php 项目: bluematt/korpus
// Set up composer autoloading.
require 'vendor/autoload.php';
$whoops = new \Whoops\Run();
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler());
$whoops->register();
try {
    // Create the app.
    $app = new App();
    // Set up app internals.
    $app->enableDebugging(true);
    // Load the configuration.
    $config = [];
    if (\file_exists('./config.php')) {
        $config = (include './config.php');
    }
    $app->setConfig($config);
    // Set up app directories.
    $app->setDirectories(__DIR__);
} catch (\Exception $e) {
    ldd($e->getMessage());
}
// Set up app templates.
$app->setConfig(['app.templates.default.file' => TemplateDefaults::DEFAULT_NAME, 'app.templates.default.content' => TemplateDefaults::DEFAULT_CONTENT, 'app.templates.error404.file' => TemplateDefaults::ERROR404_NAME, 'app.templates.error404.content' => TemplateDefaults::ERROR404_CONTENT, 'app.templates.error500.file' => TemplateDefaults::ERROR500_NAME, 'app.templates.error500.content' => TemplateDefaults::ERROR500_CONTENT]);
// Set up the Twig environment.
$loaderFS = new \Twig_Loader_Filesystem($app->get('app.dir.templates'));
$loaderArray = new \Twig_Loader_Array([$app->get('app.templates.default.file') => $app->get('app.templates.default.content'), $app->get('app.templates.error404.file') => $app->get('app.templates.error404.content'), $app->get('app.templates.error500.file') => $app->get('app.templates.error500.content')]);
$loader = new \Twig_Loader_Chain([$loaderFS, $loaderArray]);
$config = ['cache' => $app->get('app.dir.cache.templates'), 'debug' => $app->get('app.settings.debug')];
// Register Twig as the view library.
$app->register('view', '\\Twig_Environment', [$loader, $config]);
$app->view()->addGlobal('insert', new \Bluematt\Korpus\DocumentInserter($app->get('app.dir.pages')));
	protected function _setAppConfig()
	{
		$config = $this->getBootstrap()->getApplication()->getOptions();
		App::setConfig($config);
	}