CyberSlug Labs Software Projects

CyberSlug Labs » Software » Loudblog Summary plugin

<lb:belowthefold />

Download belowthefold.php.txt

<?php

/******************************************
belowthefold v1.0 (2007.07.01)
< cyber slug labs at g mail dot com >
http://cyberslug.net

allow a summary in the main blog with
expanded content when viewing a single post

add <lb:belowthefold /> to your template
right before <lb:message />

add tag <fold> on a line by itself
in the text of the post (only once)
******************************************/

function belowthefold () {
    global $postings, $currentid;

    $foldmark = "<fold>";
    $sep = "<a name=\"fold\"></a><hr />";

    $x = $postings[$currentid]['message_html'];
    $folded = ereg($foldmark, $x);

    if($folded) {
        if ((isset($_GET['id'])) && ($postings[$currentid]['comment_on'] == 1)) {
            $x = str_replace($foldmark, $sep, $x);
        } else {
            $x = substr($x,0,strpos($x, $foldmark)) . "</p>\n<p><b>&raquo;</b> <a href=?id=$currentid#fold>Read the rest of this post</a></p>";
        }
        $postings[$currentid]['message_html'] = $x;
    }
    return "";
}

?>

Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.

 
©2007 CyberSlug Labs