Esempio n. 1
0
File: app.php Progetto: nebiros/yasc
/**
 * Function to configure some yasc options. This function is optional you don't
 * need to write it in your app script if you don't want.
 */
function configure()
{
    // * You can add a layout, a layout is just a .phtml file that represents
    // the site template.
    Yasc_App::config()->setLayoutScript(dirname(__FILE__) . "/layouts/default.phtml");
    // * If you want to use a stream wrapper to convert markup of mostly-PHP
    // templates into PHP prior to include(), seems like is a little bit slow,
    // so by default is off.
    // ->setViewStream(true);
    //
    // * You can add more than one folder to store views, each view script
    // is a .phtml file.
    // ->addViewsPath(dirname(__FILE__) . "/extra_views");
    //
    // * You can add more than one path of view helpers and set a
    // class prefix for the path added.
    // ->addViewHelpersPath(dirname(__FILE__) . "/../library/My/View/Helper", "My_View_Helper");
    //
    // or if you don't want a class prefix just leave it blank.
    // ->addViewHelpersPath(dirname(__FILE__) . "/extra_views/helpers");
    //
    // * Function helpers, second argument is a prefix class.
    // ->addFunctionHelpersPath(dirname(__FILE__) . "/extra_function_helpers");
    //
    // * Add models folder, second argument is a prefix class.
    // ->addModelsPath(dirname(__FILE__) . "/models");
    // ->addModelsPath(dirname(__FILE__) . "/extra_models/My/Model", "My_Model");
    //
    // * Add extra options to the configuration object, like some $mysql connection
    // resource or a global flag, etc.
    // ->addOption("db", $mysql);
}
Esempio n. 2
0
File: Url.php Progetto: nebiros/yasc
 /**
  *
  * @param string $path
  * @return string
  */
 protected function urlFor($path)
 {
     $appConfig = \Yasc_App::config()->getOption("appConfig");
     $options = array();
     if (isset($appConfig["url_force_https"])) {
         $options["url_force_https"] = (bool) $appConfig["url_force_https"];
     }
     return Yasc_App::getInstance()->getRouter()->urlFor($path, $options);
 }
Esempio n. 3
0
/**
 * @GET("/")
 */
function index()
{
    $translator = Yasc_App::config()->getOption("translator");
    echo "Hello world!" . "\n\n";
    echo $translator->trans("Hello World!") . "\n\n";
}