PHP code example of jg / kirby-props

1. Go to this page and download the library: Download jg/kirby-props library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jg / kirby-props example snippets


snippet('some-snippet', kprops([
  'text' => 'Here *is* some **text**',
  'image' => 'filename.jpg',
  'page' => 'some/page'
]));

<?= $props->text()->kirbytext() 

$data = [ 'image' => 'filename.jpg' ]; // <- let’s say this file belongs to `some/page`
$page = page('some/page');

snippet('some-snippet', kprops($data, $page));

$output = kprops([]); // => [ 'props' => Kirby\Cms\Content ]

$output = kprops([], page(), true); // => Kirby\Cms\Content

snippet('some-snippet', [
  'key' => 'value',
  'props' => kprops([], page(), true)
]);

[
  'jg.kprops.key' => 'props' // default
]