<?php /* * kirby 2 plugin - kirbytextRaw * parse text as kirbytext but remove the p tags * * copyright: Jannik Beyerstedt | http://jannikbeyerstedt.de | code@jannikbeyerstedt.de * license: http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 License * v1.0.1 (27.11.2014) * * Sample Usage: * <?php echo $page->text()->readingtime() ?> * * changelog: * v1.0.1: fix problem with </br> tags */ function kirbytextRaw($content) { $text = kirbytext($content); return preg_replace('/(.*)<\\/p>/', '$1', preg_replace('/<p>(.*)/', '$1', $text)); } field::$methods['kirbytextRaw'] = function ($field) { return kirbytextRaw($field->value); }; field::$methods['ktRaw'] = function ($field) { return kirbytextRaw($field->value); };
} ?> <table> <thead> <tr> <th></th> <th>Miles.</th> </tr> </thead> <tbody> <?php foreach ($page->distances()->yaml() as $distance) { ?> <tr> <td><?php echo kirbytextRaw($distance['location']); ?> </td> <td><?php echo $distance['miles']; ?> </td> </tr> <?php } ?> </tbody> </table> </details> <?php }