require 'sinatra'
require 'erb'
get '/hello/:name' do |name|
@name = name
erb :hello
end
Hello, <?= $name ?>!
<?php
require_once 'slim/Slim.php';
Slim::init();
Slim::get('/hello/:name', function($name) {
Slim::render('hello.php', array('name' => $name));
});
Slim::run();
<?php
require_once 'lib/limonade.php';
dispatch('/hello/:name', function() {
return render(
'hello.php',
array('name' => params('name'))
);
});
<?php
require_once 'lib/fitzgerald.php';
$app = new Application();
$app->get('/hello/:name', function($name) {
return $this->render('hello', array('name' => $name));
});
$app->run();
<?php
require_once 'silex.phar';
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Templating\Engine;
use Symfony\Component\Templating\Loader\FilesystemLoader;
use Silex\Framework;
$framework = new Framework(array(
'GET /hello/:name' => function($name) {
$loader = new FilesystemLoader('views/%name%.php');
$view = new Engine($loader);
return new Response($view->render(
'hello',
array('name' => $name)
));
}
));
$framework->handle()->send();
<?php
use lithium\action\Dispatcher;
use lithium\action\Request;
use lithium\action\Response;
use lithium\core\Libraries;
use lithium\net\http\Router;
use lithium\template\View;
require_once 'libraries/lithium/core/Libraries.php';
Libraries::add('lithium');
Router::connect(
"/hello/{:name}",
array(
"http:method" => "GET",
"name" => null
),
function($request) {
$view = new View(array(
'paths' => array('template' => 'views/{:template}.php')
));
$output = $view->render(
'template',
array('name' => $request->name),
array('template' => 'hello')
);
return new Response(array('body' => $output));
}
);
echo Dispatcher::run(new Request());