SitePoint Sponsor

User Tag List

Results 1 to 14 of 14
  1. #1
    ********* Articles ArticleBot's Avatar
    Join Date
    Apr 2001
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Article Discussion

    This is an article discussion thread for discussing the SitePoint article, "Highlight Source Code in Your PHP Application"

  2. #2
    One website at a time mmj's Avatar
    Join Date
    Feb 2001
    Location
    Melbourne Australia
    Posts
    6,282
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    The resulting HTML code, after the highlighting is performed, is not XHTML-compliant. This issue is corrected in PHP5, but in PHP4, the highlighter uses the <font> tag,
    The <font> element is valid in HTML 4.01 Transitional and XHTML 1.0 Transitional. Therefore the <font> element is not an XHTML specific problem and is as much a problem in HTML 4.01.

    Output is provided in XHTML format, using <span> tags for semantics and CSS styles for formatting
    <span> elements provide no semantic meaning. If a <span> has a descriptive "class" attribute, then it will help humans who speak the same language to understand its purpose. However, this does not make code 'semantic'. Using <span> with some CSS is the exact equivalent of using <font>, and does not give any semantic information to the document.

  3. #3
    joern_h@gmx.net
    SitePoint Community Guest
    See http://planetxml.de/highlighter/ for another highlighting script. Its a new Driver for PEARs highlighter that uses the syntax descriptions of the KDE editor. The first two files in the list show the source code and the usage.

  4. #4
    devon
    SitePoint Community Guest
    Regarding the posting by mmj...

    Use of the <span> tag as opposed to <font> is not intended to provide semantics, it is to describe the code as device independent. Consequently, there is in fact a large difference between <span> and <font>. <font> is exclusively related visual presentation, whereas <span> is a delineation that can be rendered by any form of user agent, including a screen reader, based on the associated css. While this is not necessarily an important consideration to a script that is intended to display based on color-coding, by using <span>, one could apply an aural css with different vocal emphasis representing the different tokens, and thus make reading a php script accessible to a visually impaired programmer. Similarly, any future technologies relating to Web access will be able to apply relevant CSS information to the classes, and render the code appropriately.

    One other note: while you stated that <font> is valid in HTML 4.01 and XHTML 1.0, in both of these specifications, it is flagged as deprecated, meaning that its existence will not be guaranteed in future versions of either spec. Preparing for the future is an important tool of any responsible Web professional!

  5. #5
    SitePoint Zealot johno's Avatar
    Join Date
    Sep 2003
    Location
    Bratislava, Slovakia
    Posts
    184
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check out this one http://hvge.sk/scripts/fshl/
    Supports multiple and mixed languages and compared to GeSHi it's really fast. I mean REALLY FAST.

    Online example is at http://hvge.sk/scripts/fshl/online/
    Annotations support for PHP5
    TC/OPT™ Group Leader

  6. #6
    SitePoint Addict
    Join Date
    Nov 2004
    Location
    New Jersey
    Posts
    317
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is just what I've been looking for. Thanks.

  7. #7
    Nigel McNie
    SitePoint Community Guest
    It's worth noting that future versions of GeSHi will support multiple languages in the same source - e.g. HTML, PHP, Javascript and CSS all in one - see the demo at http://geshi.org/.

    Although it's slower than other solutions, good highlighting will always be an intensive process and you'd be advised to use some form of caching for highlighted text if you are not already -- Pear::Cache_Lite is just one example of a good caching solution.

  8. #8
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,479
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Cool

    Quote Originally Posted by mmj
    The <font> element is valid in HTML 4.01 Transitional and XHTML 1.0 Transitional. Therefore the <font> element is not an XHTML specific problem and is as much a problem in HTML 4.01.


    <span> elements provide no semantic meaning. If a <span> has a descriptive "class" attribute, then it will help humans who speak the same language to understand its purpose. However, this does not make code 'semantic'. Using <span> with some CSS is the exact equivalent of using <font>, and does not give any semantic information to the document.

    Looks like in his haste to write this article, Mr.Stoyan Stefanov overlooked a point or two as well a standard or two.

    Anyway, its a good starter for someone starting out on syntax highlighting & doesn't know where to begin.

    Also I'd like to highlight a point that Mr.Stoyan Stefanov overlooked. The Enscript utility mentioned at the end of the article is a *NIX only, that is, it runs only on UNIX & LINUX. so unless you are not on one of those platforms, ... Also, I don't think its extendable, the plugin I mean, you are restricted with the languages that are supported by Enscript & unless you have root permissions to your server, you can't mod it.

    This thing is what bugged me when I wanted syntax highlighting for a bit or two of code that I post on my blog. B'coz I needed to test it locally as well. Then GeSHi crossed my path & I based my syntax-hiliting plugin for WordPress on it. If anyone is interested, its link is in my signature.
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  9. #9
    SitePoint Member
    Join Date
    Jul 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks !very beautifully!

  10. #10
    SitePoint Member
    Join Date
    Jul 2004
    Location
    Rehovot
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    helps - thanks

  11. #11
    SitePoint Evangelist dscriptor's Avatar
    Join Date
    Oct 2005
    Location
    in front of my computer
    Posts
    571
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this is great!

  12. #12
    object_freedom
    SitePoint Community Guest
    thanks 4 helps,
    very great!!

  13. #13
    Anonymous
    SitePoint Community Guest
    good introduction, help me much

  14. #14
    softexp23
    SitePoint Community Guest
    Great article !
    What if you want to hilight a file where php and html coexist ?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •