Formatted Include

This is a modification of the wikka include action adding css formatting. The idea & some of the code came from a gpl wikini action by Eric Feldstein.

You can use it to completely replace the include.php file in the action directory.

Useage is....

{{include page="HomePage" class="gray_background solid_border small_fonts height10em"}}

The class parameter is optional.

An example of it in use here.

<?php
// wikka include action modified by GmBowen so that included page is formatted according to css code
// Idea & code modifications from Wikini include action by Eric Feldstein released under GPL
if ($class) {
    $array_classes = explode(" ", $class);
    foreach ($array_classes as $c) { $classes = $classes . "include_" . $c . " "; }
    }
if (!$page) $page = $wikka_vars;
$page = strtolower($page);
if (!$this->config["includes"]) $this->config["includes"][] = strtolower($this->tag);

if (!in_array($page, $this->config["includes"]) && $page != $this->tag) {
    if ($this->HasAccess("read", $page)) {
        $this->config["includes"][] = $page;
            $page = $this->LoadPage($page);
        $output = $this->Format($page["body"]);
        if ($classes) echo "<div class=\"", $classes,"\">\n", $output, "</div>\n";
        else echo $output;
    }
} else print "<span class='error'>Circular reference detected</span>";

?>


the css file in use has to have the following text added to it....
.include_right { float: right; width: 17%; } /* floating box to the right */
.include_left { float: left; width: 17%; } /* floating box to the left*/
.include_solid_border { border: solid; padding: 2px; } /* solid border*/
.include_gray_background { background-color: #DDDDDD; } /* grey background*/
.include_small_fonts { font-size: 0.8em; } /* small fonts */
.include_big_fonts { font-size: 1.2em; } /* large fonts*/
.include_height10em { height: 10em; overflow: scroll; } /* in a scrollable box 10em high */
.include_height15em { height: 15em; overflow: scroll; } /* in a scrollable box 15em high */
.include_height30em { height: 30em; overflow: scroll; } /* in a scrollable box 30em high */
.include_height60em { height: 60em; overflow: scroll; } /* in a scrollable box 60em high */



CategoryUserContributions
There are 13 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki