Welcome, Guest. Please login or register.
March 20, 2010, 11:27:23 PM

Login with username, password and session length
Search:     Advanced search
WB 2.8.1 released!
Download and additional information are available here .
110559 Posts in 15966 Topics by 9310 Members
Latest Member: stevenris10
* Home Help Search Login Register
+  WebsiteBaker Community Forum
|-+  English
| |-+  Archive (posts up to 2007) (Moderators: Argos, BerndJM)
| | |-+  Module: Display highlighted PHP code
Pages: [1] Go Down Print
Author Topic: Module: Display highlighted PHP code  (Read 2925 times)
snipe

Offline Offline

Posts: 62


WWW
« on: January 19, 2006, 04:33:42 AM »

For those of you running a PHP tutorial site, or a site that needs to display PHP code snippets, this module will let you do just that.  It's *extremely* simple - it is basically just the core "code" module using PHP's highlight_string() function to give you syntax highlighting.  (Syntax highlighting is snazzier in PEAR, and I may make an alternate version of the script to use PEAR's text highlighting capabilities, but I wanted to get this done so I could start putting my own site back together.

You can see a basic example here:
http://www.snipe.net/content/php_stuff/breadcrumbs.php

To format the area where the code is displayed, just add a CSS value for div.highlightcode somewhere in your CSS file.

Works for 2.6.x, and I would assume it should work for 2.5.x, but I haven't tried it.

Anyway, I don't know if any of you will find this useful, but here it is.
Logged

Woudloper
Guest
« Reply #1 on: January 19, 2006, 08:30:35 AM »

Looks like a nice module. The link where you referring to does not have PHP highlighting, but I saw the highlighting on the following page:

http://www.snipe.net/content/php_stuff/filesize.php

Will test it later on. Not that I am going to use it at the moment, but it is always good to see new modules coming...

Must update the module list somewhere in the next week...
Logged
snipe

Offline Offline

Posts: 62


WWW
« Reply #2 on: January 19, 2006, 08:42:35 AM »

LOL yeah, sorry - was trying to do too many things at once, so I pasted the wrong url.  I don't know that it can even be called a nice module - I basically changed one line of code... LOL... But hey, it accomplished what I needed...

I'm working on an Amazon.com module as well (as was requested by someone else in another thread) - that one is a bit slower going, since the Amazon.Com XML is pretty gnarly (stuff like $array_name[ITEMLOOKUPRESPONSE][0][ITEMS][0][ITEM][0][OFFERSUMMARY][0][LOWESTNEWPRICE][0][AMOUNT][0][VALUE]), but it's coming along.  I need to do a little digging in the other modules to see how categories and ordering is handled in the more mature modules.
Logged

kweitzel
Forum administrator
*****
Offline Offline

Posts: 5561


WWW
« Reply #3 on: January 19, 2006, 08:59:32 AM »

it does look nice ...

whith the amazon module, do you by any chance know, if the other amazon sites (co.uk, .de, .fr, ...) use the same setup, so the amazon module could be used for them as well?

cheers

Klaus
Logged

http://www.weitzel.biz
PM has been disabled
snipe

Offline Offline

Posts: 62


WWW
« Reply #4 on: January 19, 2006, 09:11:34 AM »

The one drag with using highlight_string() is that the outputted code isn't XHTML compliant.  I know that's a big issue on the net these days, but I have never run into ANY issues with non-XHTML compliant sites, so if it bothers someone that much, they can write the PEAR version. Smiley

I'm not sure how the alt. tld amazons work, to be honest.  Since I am .us, I don't have much experience with it, but I do think that they should function in the same way.  I haven't gotten there yet, but internationalizing it is a goal.  The tld would likely be part of the mod_amazon_settings table.
Logged

kweitzel
Forum administrator
*****
Offline Offline

Posts: 5561


WWW
« Reply #5 on: January 19, 2006, 09:39:53 AM »

great ... if you give me your languag.php file, I can switch it to german (maybe even other European languages, like french and italian, depends on my staff ...). This offer is for any module.

cheers

Klaus
Logged

http://www.weitzel.biz
PM has been disabled
snipe

Offline Offline

Posts: 62


WWW
« Reply #6 on: January 19, 2006, 11:19:27 AM »

For the amazon module you mean?  Hah - I need to check into how languages are handled in modules before I get that ambitious Smiley  I have written a ton of custom code for WB, especially for www.pet-abuse.com, integrating it into the cruelty database - but I have a whole custom admin application to handle case management, so it was just a matter of calling up existing data from the database - it its something so specific, I wasn't concerned about releasing it to the public.  So I need to download a few more of the mods and see how everything gets handled, and then hopefully abstract the language as I go.  (I still haven't abstracted the languages for my own non-WB image gallery software.. LOL)
Logged

kweitzel
Forum administrator
*****
Offline Offline

Posts: 5561


WWW
« Reply #7 on: January 19, 2006, 12:16:51 PM »

I actually meant any of the modules, you want to release in a multilanguag version ... smiley
Logged

http://www.weitzel.biz
PM has been disabled
Pages: [1] Go Up Print 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!