mIRC Home    About    Download    Register    News    Help

Print Thread
#114086 12/03/05 03:07 AM
M
MTec89
MTec89
M
i am looking to set up something similar to what .phps files do, except i want to do this for .mrc files.. like colorize the code when viewing the file from my server. im not sure what this would consist of doing but im sure it can be done.

Last edited by MTec89; 12/03/05 03:10 AM.
M
MTec89
MTec89
M
any one?

D
Danthemandoo
Danthemandoo
D
you;d need to find a program which has the ability to do custom syntax highlighting. Then you'd need to customise it yourself, and probably input every single mirc command and identifier into it. I think there is a custom config for a program called "Textpad" which has that but textpad is not free so i havn't tried it.

But frankly, if you can write mirc script you can read it just as easily without bothering with syntax highlighting. However i still wish the inbuilt editor had syntax hightighting, that'd be awesome, but thats been suggested a load of times so shouldn't be discussed in this thread.

[Edit] Found a couple of things on mircscripts.org:
http://www.mircscripts.org/comments.php?cid=2161
http://www.mircscripts.org/comments.php?cid=2252

Last edited by Danthemandoo; 13/03/05 11:43 PM.
M
MTec89
MTec89
M
i wasnt really talking about a text editor, i was asking about a web mime type

D
Danthemandoo
Danthemandoo
D
you mean like viewing a .mrc file via a web browser but syntax highlighted?
I don't see why it couldn't be done in firefox/mozilla, but would involve creating an extension for it and i don't have the 1st clue how.

M
MTec89
MTec89
M
no, im talking about something server side, just like the .phps is server side.

T
tontito
tontito
T
Hello,
i and some other m8s implement a web server that runs server side mircscript pages.
Is that what you are looking for?
If so check this

Joined: Dec 2002
Posts: 1,893
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,893
For Apache servers, this consists of three steps.
  1. Enable mod_rewrite in httpd.conf and restart the server.
  2. Create a new text file in the root directory of your server, call it .htaccess, and put these lines in it:

    Code:
    RewriteEngine on
    RewriteRule \.mrc$ /highlight_mrc.php [E=FILE:%{REQUEST_FILENAME}]

  3. Get a PHP script that highlights mIRC syntax, place it in the root directory of your server and call it highlight_mrc.php. One (silly) example is here.

    As you can learn from the example, the variable $_SERVER['REDIRECT_FILE'] holds the path to the .mrc file.
(Tested on Apache 1.3)

M
MTec89
MTec89
M
thats great Online smile well, im looking for a bit more highlighting though, like the things like == and just things like that, so a mix of what this looks like
http://mirc.net/paste/?203
and what this looks like
http://mtec89net.com/test.mrc

Joined: Dec 2002
Posts: 1,893
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,893
I updated the file (highlight_mrc.txt) to color assignment (=) and comparison (==) operators too. You can add more options yourself by editing the highlight_mirc() function.

Keep in mind that I wrote the file merely as an example—it's by no means supposed to be an efficient and fully-functional syntax highlighter. If you want something better, consider asking the mirc.net staff to share their code with you.

M
MTec89
MTec89
M
thanks. i once asked them for a different peice of code, but they couldnt give it.. figures :P

Joined: Jun 2003
Posts: 4,670
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Jun 2003
Posts: 4,670
The source code for the mirc.net highlighter can be found at http://www.tye.ca/source/mhighlight.zip smile (example script)

Regards,

M
MTec89
MTec89
M
cool smile thanks

M
MTec89
MTec89
M
many thanks to all you people! laugh http://mtec89net.com/test.mrc

ill make this code available inscase people want to use it as i did, it required some recoding of the other code

http://mtec89net.com/highlight_mirc.phps


Link Copied to Clipboard