PHP code example of arnoson / kirby-template-sugar

1. Go to this page and download the library: Download arnoson/kirby-template-sugar 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/ */

    

arnoson / kirby-template-sugar example snippets


 snippet('card', [
  'rounded' => true,
  'attr' => ['class' => 'bg-yellow', 'id' => 'my-card']
], slots: true); 

 snippet('my-snippet', slots: true); 

 snippet('menu', [
  'open' => true,
  'items' => $site->children()->listed(),
  'attr' => [
    'class' => 'bg-red',
    'aria-label' => 'Main Menu'
  ]
]); 

 snippet('menu', __snippetData([
  '$open' => true,
  '$items' => $site->children(),
  'class' => 'bg-red',
  'aria-label' => 'Main Menu'
])); 

// snippets/menu.php
<nav <?= attr($attr) 

// snippets/menu.php
<nav <?= classes('menu', ['menu--open' => $open])->merge($attr) 

 foreach ($projects as $project): 

 foreach ($projects as $project): 

 snippet('point', __snippetData([
  'style' => '--x: 10px;
  --y: var(--some-variable)'
])); 

 layout('default'); 

 layout('gallery', __snippetData([
  '$showMenu' => false,
  '$layout' => 'portrait'
])); 
html
<snippet:card $rounded="<? true 
html
<snippet:menu
  $open="<? true 
html
<snippet:menu
  $open="<? true 
html
<layout:gallery
  $showMenu="<? false