Subject: Inline blocks working in static pages

Posted on: 02/09/04 08:47am
By: Euan

[edit - I put this in the wrong place. Can someone move it please? Cheers, Euan.]

I'm not done quite yet, but it's working in principle: inline blocks in static pages.

[[IB function align]] is searched and replaced with a formatted block. Should perhaps also add a title, or perhaps actually leave building the entire block to the function? I'll post it here when it's done. It works with the version of staticpages in CVS, so you won't be able to use it until 1.3.10 is released anyway.

        } else if ($sp_php == 2) {
            ob_start ();
            eval ($sp_content);
            $retval .= ob_get_contents ();
            ob_end_clean ();
        } else {
            if (preg_match_all("/[[IB ([0-9a-zA-Z-_]+) ([0-9a-zA-Z-_]+)]]/", $sp_content, $matches)) {
                $i = 0;
                while ($i < count($matches)-1) {
                    $block = inline_block($matches[1][$i],$matches[2][$i]);
                    $sp_content = str_replace($matches[0][$i], $block, $sp_content);
            $retval .= $sp_content;

You'll need a function inline_block to handle the formatting too.

See it here.



Geeklog - Forum