Results 1 to 9 of 9

Thread: Huge Favor To Ask John! Plz!!! Vb Color Code?

  1. #1

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527

    Wink Huge Favor To Ask John! Plz!!! Vb Color Code?

    John, I was wondering If i could at all trouble you, for the nifty code that you use, to color code the VB stuff?

    PLEASE?

    I run a little php server with Apache, for my purposes, that basically stores my vb code.

    I was wondering if you would be able to divulge the source to your 'special' code coloring script?

    I know that this probably shouldn't be in this forum but I thought that at least it would grab your attention

    Thanks!

  2. #2
    Fanatic Member
    Join Date
    Jan 1999
    Location
    UK
    Posts
    593
    It's available somewhere on the vBulletin.com forums...go searching!

    John

  3. #3
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    If you're keeping things in that sort of format, once I get my act together if you want we can add them to the VB-World members' code site

    Incidentally, it uses vBCode and all the tags (including the [vbcode] one!)
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  4. #4

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    have any suggestions for the keywords to look for?

  5. #5
    Lively Member
    Join Date
    Jun 2001
    Location
    Banana Republic
    Posts
    115
    Marriage - is not a word, but a sentence.

  6. #6

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    Thanks, that's relating to the PHP code, I was looking for the [Highlight=VB] tags???

  7. #7

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    like this stuff:


    VB Code:
    1. MsgBox "Hello World, this is color coded"

    i search the vBulletin forum and i keep on getting threads related to: vBcode

  8. #8

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    I found one of your posts on vbulletin.org

    http://www.vbulletin.org/forum/showt...ghlight=vbcode

    could you please post that code here?

    as you said the slashes are stuffed up and it will not let me quote it



    Please?!

  9. #9

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    Could you please post the CountChar function here John?


    That's all i need to finish it?

    PHP Code:
    <?php
    error_reporting
    (7);
    $kw=array("#Const","#If","Abs","Add","Alias","And","Any","AppActivate","Array","As","Asc","Atn","Base","Beep",
    "Boolean","Byte","ByVal","CBool","CByte","CCur","CDBl","CDate","CDec","CInt","CLng","CSng","CStr","CVErr","CVar",
    "Call","Case","ChDir","ChDrive","Chr","Clear","Close","Collection","Command","Compare","Const","Cos","CreateObject",
    "CurDir","Currency","DDB","Date","DateAdd","DateDiff","DatePart","DateSerial","DateValue","Day","Debug","Declare",
    "DefBool","DefByte","DefCur","DefDate","DefDbl","DefDec","DefInt","DefLng","DefObj","DefSng","DefStr","DefVar",
    "DeleteSetting","Dim","Dir","Do","DoEvents","Double","EOF","Each","Else","ElseIf","End","Endif","Environ","Eqv",
    "Erase","Err","Error","Exit","Exp","Explicit","FV","FileAttr","FileCopy","FileDateTime","FileLen","Filelen","Fix",
    "For","Format","Function","Get","GetAllSettings","GetAttr","GetObject","GetSetting","Global","GoSub","GoTo","Hex",
    "Hour","IIR","IPmt","If","Imp","In","InStr","Input #","Int","Integer","Is","IsArray","IsDate","IsEmpty","IsError",
    "IsMissing","IsNull","IsNumeric","IsObject","Item","Kill","LBound","LCase","LOF","LSet","LTrim","Left","Len","Let",
    "Lib","Like","Line Input #","Loc","Lock","Log","Long","Loop","MIRR","Me","Mid","Minute","MkDir","Mod","Module",
    "Month","MsgBox","NPV","NPer","Name","New","Next","Not","Now","Object","Oct","On","Open","Option","Or","PPmt","PV",
    "Pmt","Print","Print #","Private","Property","Public","Put","QBColor","RGB","RSet","RTrim","Raise","Randomize",
    "Rate","ReDim","Remove","Reset","Resume","Return","Right","RmDir","Rnd","SLN","SYD","SaveSetting","Second","Seek",
    "Select","SendKeys","Set","SetAttr","Sgn","Shell","Sin","Single","Space","Spc","Sqr","Static","Step","Stop","Str",
    "StrComp","StrConv","String","Sub","Switch","Tab","Tan","Then","Time","TimeSerial","TimeValue","Timer","To","Trim",
    "Type","TypeName","UBound","UCase","Unlock","Until","Val","VarType","Variant","Weekday","Wend","While","Width #",
    "With","Write #","Xor","Year",
    "Optional","InStrRev","Replace","Split","Join");

    function 
    visbasparse($text) {
      global 
    $kw;

      
    $text=str_replace("'""'"$text);

        
    $lines=explode("\n",$text);
        
    $val="";
        while (list(
    $brr,$line)=each($lines)) {

            if (
    substr(trim($line),0,1)=="'" or strtolower(substr(trim($line),0,4))=="rem ") {
                
    $line="<font color=\"#007F00\">$line</font>";
            } else {
                
    $quoteplace=strrpos($line,"'");
                if (
    $quoteplace>0) {
                    
    $beforequote=substr($line,0,$quoteplace);
                    if (
    countchar($beforequote,"\"")%2==0) {
                        
    $afterquote="<font color=\"#007F00\">".substr($line,$quoteplace)."</font>";
                        
    $codebit=$beforequote;
                    } else {
                        
    $afterquote="";
                        
    $codebit=$line;
                    }
                } else {
                    
    $afterquote="";
                    
    $codebit=$line;
                }

                
    reset ($kw);

                
    $codebit=$codebit";
                while (list(
    $key,$keyword)=each($kw)) {

                    
    $codebit=ereg_replace("([\r\n\(\)>, .])$keyword([\r\n <,.$\(\)])","\1<font color=\"#00007F\">$keyword</font>\2",$codebit);

                }
                
    $codebit=substr($codebit,1);

                if (
    $afterquote!="") {
                    
    $line=$codebit.$afterquote;
                } else {
                    
    $line=$codebit;
                }
            }
            
    $val.=$line;
        }

      
    $val=str_replace("'""'"$val);
      
    $val str_replace("\\\"","\"",$val);
      if (
    substr($val,0,1)=="\n" or substr($val,0,1)=="\r") {
        
    $val=substr($val,1);
      }
      return 
    "</normalfont><blockquote><pre><smallfont>visual basic code:</smallfont><hr>" str_replace("<br>"""$val) . "<hr></pre><normalfont></blockquote>";

    }

    ?>
    That's what i have...

Posting Permissions

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



Click Here to Expand Forum to Full Width