Embedding Snippets

In fact, embedding a snippet is as easy as this:

New Kirbytag “snippet” (to be saved as snippet.php in /site/tags):

<?php
kirbytext::$tags['snippet'] = array(
  'attr' => array(
  ),
  'html' => function($tag) {
  	$file =  $tag->attr('snippet');
  	return snippet($file, array(), true);
  }
);

To invoke the snippet in your text file, type:

(snippet: my-snippet)
1 Like