Welcome, Guest. Please login or register.
Did you miss your activation email?
May 23, 2012, 07:48:04 PM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155440 Posts in 21702 Topics by 7732 Members
Latest Member: Smacki
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: FrontEnd CodeHighlighting (incl. x_find_class 0.1.6)  (Read 1267 times)
aldus

Offline Offline

Posts: 1238


« on: August 31, 2008, 01:49:24 PM »

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:
Code:
<?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.

Update
Version 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.php

Regards
Aldus
« Last Edit: September 20, 2008, 10:28:35 AM by aldus » Logged
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4884



« Reply #1 on: August 31, 2008, 03:48:54 PM »

Hello Aldus!

Thank you very much for taking the time in order to put the stuff together.

This module is also a good demonstration of HOW the "Find my Class" Module/Snippet can be applied practically.

The funny part is, that I don't need this for my self.
(Maybe someday I will run a WB based tutorial homepage... than yes.)
But I haven't seen a good functioning syntax highlighter for WB and I think that some of you will have interest in it.

The Snippet is working x-browser.

Inside the zip file you'll find a info.html


Have Fun!
Best Regards,
Stefek

Download the module from the first post above.
« Last Edit: August 31, 2008, 03:52:52 PM by Stefek » Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
aldus

Offline Offline

Posts: 1238


« Reply #2 on: September 20, 2008, 10:29:52 AM »

Update 0.1.7.4 - more stabil version,
see first entry for details.

Regards
Aldus
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!