예제 #1
0
<?php

/**
 * This is a Anax pagecontroller.
 *
 */
// Get environment & autoloader and the $app-object.
require __DIR__ . '/config.php';
// Create services and inject into the app.
$di = new \Anax\DI\CDIFactory();
//Load required services
$di->set('FormController', function () use($di) {
    $controller = new \Anax\Users\FormController();
    $controller->setDI($di);
    return $controller;
});
$app = new \Anax\MVC\CApplicationBasic($di);
$app->theme->configure(ANAX_APP_PATH . 'config/theme_me.php');
// On production server, set pretty urls and use rewrite in .htaccess
$app->url->setUrlType($_SERVER['SERVER_NAME'] == 'localhost' ? \Anax\Url\CUrl::URL_APPEND : \Anax\Url\CUrl::URL_CLEAN);
// Load Contact Form Controller
$di->set('ContactformController', function () use($di) {
    $controller = new \Fnlive\Contactform\ContactFormController();
    $controller->setDI($di);
    return $controller;
});
$app->router->add('', function () use($app) {
    $app->theme->setTitle("Contact form");
    $app->views->add('default/page', ['title' => "Testing contact form", 'content' => "Page for testing contact form. Click below link to administrate and view messages.", 'links' => [['href' => $app->url->create('contactformadmin/setup'), 'text' => "Setup user table with test data (first time setup)"], ['href' => $app->url->create('admin'), 'text' => "Contact form administration"]]]);
    $app->dispatcher->forward(['controller' => 'contactform', 'action' => 'display']);
});
예제 #2
0
<?php

/**
 * Config file for pagecontrollers, creating an instance of $app.
 *
 */
mb_internal_encoding();
mb_http_output();
// Get environment & autoloader.
require __DIR__ . '/config.php';
// Create services and inject into the app.
$di = new \Anax\DI\CDIFactory();
// Load webbshop Controller
$di->set('WebshopController', function () use($di) {
    $controller = new \Anax\Webshop\WebshopController();
    $controller->setDI($di);
    return $controller;
});
$di->set('UsersController', function () use($di) {
    $controller = new \Anax\Users\UsersController();
    $controller->setDI($di);
    return $controller;
});
$di->set('FormController', function () use($di) {
    $controller = new \Anax\Users\FormController();
    $controller->setDI($di);
    return $controller;
});
$di->set('CommentController', function () use($di) {
    $controller = new \Anax\CommentDb\CommentController();
    $controller->setDI($di);