MSP FAQ
Frequently Asked Questions:
- What the heck is MSP?
- How does it compare with other systems?
- Can I try it out on the MOO Canada server?
- Can I download it for my use?
- What are the tags?
- What's behind the compile?
Be sure to check out the demo pages.
If you have any questions which aren't answered here, please let us know.
1. What the heck is MSP?
Moo Server Pages are a simple mixture of HTML and the Moo programming language. This allows one to create programmable web pages very quickly. Start by coding your HTML page, then use the MSP tags to insert Moo code that will run as the page is served. MSP works with all browsers since the Moo code runs on our server, and the browser just receives resultant HTML so the receiving browser needs no special capabilities.
Sample code:
The current time is <%=ctime()%>.<P>
<% if (ctime()[1..3] == "Sat" || ctime()[1..3] == "Sun") %>
Our store is currently closed.
<% else %>
Please call our store at 555-1234.
<% endif %>
|
Result:
The current time is Sat Jan 25 09:16:06 2025 UTC.
Our store is currently closed.
|
2. How does it compare with other systems?
There are three systems similar to MSP. Microsoft developed Active Server Pages (ASP) which combines HTML and any of their programming languages (VBScript, JScript, etc). Sun developed Java Server Pages (JSP) which combines HTML and Java. PHP is another variant on the theme. All of these systems use the same simple concepts and the same code tags.
3. Can I try it out on the MOO Canada server?
Certainly. If you are already a programmer on Moo Canada just @create some $msp objects. When you look at them it will tell you what to do. If you aren't on Moo Canada, join us.
4. Can I download it for my use?
Forget it. It isn't that we won't give out the source code (poke around a bit and you'll find it), it's just that the installation would be pure hell. Some day we'll get around to extracting the core and writing an installer, but don't hold your breath.
5. What are the tags?
All Moo code goes inside of <% ... %> tags. Once one of these tags is opened, one can put as many lines of Moo code as one wishes. The code will be executed as the page is served.
By itself this code won't print out or return anything. In order to display a value, use the <%= ... %> tags. Any simple expression in these tags will be evaluated, and then printed. These eval tags may not span multiple lines.
6. What's behind the compile?
Understanding how the back end works is not required, but it is interesting.
The MSP code is saved to disk in a file called "description". This file may be viewed from the web. Go to http://files.moo.ca:8081/8/1/8/6/description (replace the four digits with the digits of your object's number). Some browsers may attempt to render these files as HTML even though they are being served as text files. If this happens, just view the source code.
After the file is saved, the content is parsed for simple errors in the formatting of the <% ... %> and <%= ... %> codes. Then the code parts of the file are compiled. This is where most errors are detected (don't you just hate that 'STOP' sign?). The source code for the MSP parser/compiler can be viewed at /msp:compile.
When someone views your web page, the MOO completely ignores your original MSP code which is sitting on disk. Instead it executes a verb called _render_page which was created on your object during the compile. You can view this file at /8186:_render_page (replace the number with your object's number). While it is possible to edit this verb, it would be inadvisable since all changes would be lost next time the description file is changed and the code is recompiled.
Powered by
You are not logged in.
[home |
help |
who |
search |
setup |
code]