SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)

    Textareas (htmlArea) questions

    Hey all,

    I'm looking at writing an extension for htmlArea to add syntax highlighting to PHP code dynamically as it's typed or more specifically on every new line. I was wondering if there was a way I could rn a function on every new line, whether they hit enter or it goes to a new line because of overflow. This function would go on and do some work but I won't get into that here.

    Any idea on how I can do this?

    Thanks

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, the php-colorization is a built-in procedure for PHP, so you'd first need to duplicate that with JS. That means keeping a LARGE list of keywords and how they should be colored. Then, you'd have to run a function at each newline to check for keyword or symbol matches and color them appropriately.

    This will not be easy.

    There may be a more creative solution, but I need more coffee first
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  3. #3
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    I've already got my solution figured out, it's implementing it that's the problem. I'm going to pass the contents to a PHP file in a hidden DIV which will colourise it and put it back in the editable region.


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
  •