Your Kirby installation now comes with an on-demand image resizer API:
http://yourdomain.com/projects/project-a/forrest.jpg?w=300&h=200&crop=true&bw=true
| title: Some title | |
| date: 2018-03-12 | |
| Text: Lorem ipsum … |
| <?php | |
| // no | |
| return [ | |
| 'aVeryLongOptionKey' => 'some value', | |
| 'foo' => 'another value' | |
| ]; | |
| // yes | |
| return [ |
| <?php | |
| require 'kirby/bootstrap.php'; | |
| $kirby = kirby(); | |
| $site = site(); | |
| foreach (page('posts')->children() as $post) { | |
| // do something with the post here. | |
| } |
| <?php | |
| // create a main page | |
| try { | |
| $newPage = site()->children()->create($uid = 'test', $template = 'test', [ | |
| 'title' => 'A page title', | |
| 'date' => '2016-02-21', | |
| 'text' => 'Lorem ipsum dolor set amet ...' | |
| ]); | |
| } catch(Exception $e) { |
| <?php | |
| return [ | |
| 'props' => [ | |
| 'title' => [ | |
| 'type' => 'field', | |
| 'required' => true, | |
| ], | |
| 'links' => [ | |
| 'type' => 'structure', |
| // Client | |
| const query = (query, data, headers) => { | |
| return fetch('/api', { | |
| method: 'POST', | |
| headers: headers || {}, | |
| body: JSON.stringify({ | |
| query: query, | |
| variables: data | |
| }) | |
| }).then((response) => { |
| <?php | |
| /* if this script is located in your document root… */ | |
| require(__DIR__ . '/kirby/bootstrap.php'); | |
| if(get('params')) { | |
| $articles = page('blog')->children(); | |
| $sort = ($articles->count() + 1); | |
| $date = date('Y-m-d'); |
| <?php | |
| return [ | |
| 'title' => [ | |
| 'text' => 'Widget title', | |
| 'link' => 'some/url' | |
| ], | |
| 'options' => [ | |
| 'text' => 'Edit', | |
| 'icon' => 'pencil', |
| /* Grid */ | |
| .grid { | |
| font-size: 0; | |
| } | |
| .grid > .column { | |
| position: relative; | |
| display: inline-block; | |
| width: 100%; | |
| font-size: 1rem; | |
| vertical-align: top; |