Skip to content

Instantly share code, notes, and snippets.

@bugsysop
Created December 7, 2013 17:30
Show Gist options
  • Select an option

  • Save bugsysop/7845801 to your computer and use it in GitHub Desktop.

Select an option

Save bugsysop/7845801 to your computer and use it in GitHub Desktop.
Kirby CMS Trimmed & lowercase parser
<?php
/*
Kirby CMS Trimmed & lowercase parser
Install:
Drop this php file in your plugins folder. It's done !
Usage :
<section role="main" class="<?php echo trimmed($page->title())?>">
Output:
<section role="main" class="awesome-projects">
Credit: Roy Lodder
http://getkirby.com/forum/code-snippets/topic:934
*/
// direct access protection
if(!defined('KIRBY')) die('Direct access is not allowed');
// create space trimmed lowercase html
function trimmed($text) {
return str_replace(' ', '-', strtolower(html($text)));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment