Skip to content

Instantly share code, notes, and snippets.

@bastianallgeier
Created January 28, 2012 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save bastianallgeier/1694417 to your computer and use it in GitHub Desktop.
Save bastianallgeier/1694417 to your computer and use it in GitHub Desktop.
A template to extend the kirbytext class

Kirbytext Extension Template

Use this template to extend the kirbytext class with your own tags. Put this into site/plugins and name it kirbytext.php or kirbytext.extended.php

<?php
class kirbytextExtended extends kirbytext {
function __construct($text, $markdown=true) {
parent::__construct($text, $markdown);
/*
// define custom tags
$this->addTags('mynewtag', 'anothertag');
// define custom attributes
$this->addAttributes('mynewattribute', 'anotherattribute');
*/
}
/*
// define a function for each new tag you specify
function mynewtag($params) {
// do something with the passed params here.
}
*/
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment