forked from bastos/nicedog
-
Notifications
You must be signed in to change notification settings - Fork 1
Home
johnbintz edited this page Sep 13, 2010
·
20 revisions
require 'nimble.php'; R('')->controller('test')->action('index')->on('GET'); class Test extends C{ public function index(){ echo 'Hello'; } } run();
see Plugins Documentation
Just drop the files into a folder in your Apache server!
- Get the file
- Put them in you Document root
- Create an index.php
- Just:
require(‘nimble.php’);
h3. Nice urls
R('')->controller('test')->action('index')->on('GET');5. Make urls like this, define the url, class, method and HTTP method:
More on Routing
R(‘tag/(?P[-\w]+)’)→controller(‘Test’)→action(‘p_tag’)→on(‘GET’);
Ruby on Rails-style route patterns work too, with a default pattern of [a-zA-Z0-9_-]+:
R(‘tag/:tag’)→controller(‘Test’)→action(‘p_tag’)→on(‘GET’);
5a. for helpers to use in your application to call these routes see UrlBuilders and Helpers
6. Write a class that extends C or Controller
More on Controller
class Test extends C{}
class Test extends Controller{}
7. Write a method p_tag
public function p_tag($tag){ echo $tag; }
8. And
run();
9. Open in your browser: http://localhost/tag/dog