Hello
Based on an idea from Stefek for a simple modul for
implantating the google-code-prettyfy (
http://code.google.com/p/google-code-prettify/)
this modul came up with a simple and easy way to do it.
Once you have installed the modul you only have to place this snipp of code inside
your template:
<?php if (function_exists("find_my_class") )
{
$path_to_js = WB_URL."/modules/fe-codehighlight/prettify.js";
$path_to_css = WB_URL."/modules/fe-codehighlight/prettify.css";
ob_start();
page_content();
$content = ob_get_contents();
ob_end_clean();
find_my_class($content, "pre", "prettyprint", $path_to_css, $path_to_js);
}
?>
If you have to display code (php, js, c/++) on your page you only have to take
care about to place it inside at "<pre class="prettyprint"> ... </pre>" tag.
Known issures:
- If you have already installed the "x_find_class"-modul you will have to deinstalled
it before installing this one to avoid any conflicts.
If you have already a page that makes use of the "find_my_class" function it will not
hurt anything; you can just keep it as it is.
UpdateVersion 0.1.7.4
- Warnings are now display inside html-comments
- Massiv recodings in "__file_exists" incl. testing the php-ini for "allow_url_fopen"
- Minor cosmetic changes inside the code
AMASP-Page:
http://www.wbmod.bplaced.net/pages/modules/various/frontend-codehighlighting.phpRegards
Aldus