mIRC Homepage
Posted By: MTec89 .mrc files -- web mime type - 12/03/05 03:07 AM
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.
Posted By: MTec89 Re: .mrc files -- web mime type - 13/03/05 07:37 PM
any one?
Posted By: Danthemandoo Re: .mrc files -- web mime type - 13/03/05 11:40 PM
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
Posted By: MTec89 Re: .mrc files -- web mime type - 14/03/05 12:33 AM
i wasnt really talking about a text editor, i was asking about a web mime type
Posted By: Danthemandoo Re: .mrc files -- web mime type - 14/03/05 12:41 AM
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.
Posted By: MTec89 Re: .mrc files -- web mime type - 14/03/05 01:02 AM
no, im talking about something server side, just like the .phps is server side.
Posted By: tontito Re: .mrc files -- web mime type - 14/03/05 10:35 AM
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
Posted By: Online Re: .mrc files -- web mime type - 14/03/05 10:59 AM
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)
Posted By: MTec89 Re: .mrc files -- web mime type - 14/03/05 08:01 PM
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
Posted By: Online Re: .mrc files -- web mime type - 14/03/05 09:06 PM
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.
Posted By: MTec89 Re: .mrc files -- web mime type - 14/03/05 09:20 PM
thanks. i once asked them for a different peice of code, but they couldnt give it.. figures :P
Posted By: Mentality Re: .mrc files -- web mime type - 14/03/05 09:22 PM
The source code for the mirc.net highlighter can be found at http://www.tye.ca/source/mhighlight.zip smile (example script)

Regards,
Posted By: MTec89 Re: .mrc files -- web mime type - 14/03/05 09:27 PM
cool smile thanks
Posted By: MTec89 Re: .mrc files -- web mime type - 14/03/05 10:26 PM
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
© mIRC Discussion Forums