NetAdminTools.com
 
SignalQ Sites:
NetAdminTools - Coprolite - NoNIC - SpotBridge - NAW
RoboCoop - AreWeDown - SolarPower - SysAdminTools
Xfig - Gold Loaf - GeekPapa - FixGMC - MCJ - FixRambler
Categories:
GNU/Linux | Homebrew designs | Perl | Administration | Backup/Recovery | Bugs/Fixes | Certification | Database | Email | File/Print | Hardware | Information Grab Bag | Interoperability | GNU/Linux ABCs | Monitoring | Name Resolution | Network Services | Networking | Remote Control | Security | Desktop | Web | BSD | Solaris | GIAGD | REALbasic

Last 30 Days | Last 60 Days | Last 90 Days | All Articles | RSS | Hail Support


Categories:
·GNU/Linux
·Homebrew designs
·Perl
·Administration
·Backup/Recovery
·Bugs/Fixes
·Certification
·Database
·Email
·File/Print
·Hardware
·Information Grab Bag
·Interoperability
·GNU/Linux ABCs
·Monitoring
·Name Resolution
·Network Services
·Networking
·Remote Control
·Security
·Desktop
·Web
·BSD
·Solaris
·GIAGD
·REALbasic
·All Categories


Inserting program listings in PHP-Nuke
Topic: Web   Posted:2002-08-24
Printer Friendly: Print

spacerspacer
NetAdminTools used to use PHP-Nuke. For those of you who don't know, PHP-Nuke is a fabulous Open Source project that gives you everything you need to bring up your own website with a database backend and other features. Now, one annoying thing with PHP-Nuke, and most web based interfaces is that it is quite difficult to embed program listings. We do that a lot at NetAdminTools. Greater than signs, slashes, etc. get all munged up. Well, there is a cool program called txt2html that converts a lot of these special characters. With this program and the following perl script (cm.pl) we can just run a text file into the scripts and out comes html ready to stick in Story Text right before posting. Here is the program:

#!/usr/bin/perl
print '<TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD>';
while(<>){
s|\\|\\\\\\\\|g;
print;
}
#The above is used to render \b (slash b) and \\ (slash slash) 
print '</TD ></TR ></TABLE>';
This was generated using the very same program. :) Use the --extract option:

./txt2html.pl --extract --prebegin 0 --preend 0 < cm.pl | ./cm.pl
Here is the perl script in text form.
Note that the rendering of the printer view is different, and that this only works for the the article on non-printer view pages.




Please read our Terms of Use
Microsoft, Windows, Windows XP, Windows 2003, Windows 2000, and NT are either trademarks or registered trademarks of Microsoft Corporation. NetAdminTools.com is not affiliated with Microsoft Corporation. Linux is a registered trademark of Linus Torvalds, and refers to the Linux kernel. The operating system of most distributions that contain the Linux kernel is GNU/Linux. All logos and trademarks in this site are property of their respective owner. Copyright 1997-2008 NetAdminTools.com

Created by:
MCJ
MCJ CMS