Last active
August 1, 2016 19:42
-
-
Save gharlan/8df73c3059fc12af8fbbf8f2117292bf to your computer and use it in GitHub Desktop.
Module mit Wrapper
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 | |
if (rex::isBackend()) { | |
// Ausgabe im Backend ohne Wrapper | |
echo 'item'; | |
return; | |
} | |
// Aktueller Slice | |
$slice = '<li>item</li>'; | |
// Wrapper-Präfix und -Suffix | |
$prefix = '<ol>'; | |
$suffix = '</ol>'; | |
// Ab hier nichts verändern | |
if (!function_exists('rex_module_content_REX_MODULE_ID')) { | |
ob_start(); | |
function rex_module_content_REX_MODULE_ID($prefix, $suffix, $slice) | |
{ | |
static $content = ''; | |
static $last = ''; | |
$out = ob_get_clean(); | |
if ($last != $out) { | |
echo $out; | |
$content = ''; | |
} | |
ob_start(); | |
$content .= $slice; | |
$last = $prefix.$content.$suffix; | |
echo $last; | |
} | |
} | |
rex_module_content_REX_MODULE_ID($prefix, $suffix, $slice); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment