Created
December 7, 2013 17:30
-
-
Save bugsysop/7845801 to your computer and use it in GitHub Desktop.
Kirby CMS Trimmed & lowercase parser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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