SMX

SMX

:"For the airport in Santa Maria, California coded SMX, see Santa Maria Public Airport:"SMX is also the abbreviation for the drug SulfamethoxazoleSMX is a macro processing language originally shipped with the Internet Factory's Commerce Builder software. This was a relatively popular web server in the early days of the internet, due to the ease with which a developer could produce an e-commerce website.

Rather than re-implement websites in more popular languages, like Perl or PHP, a small group of SMX fans decided to re-implement the language itself as an Apache module.

SMX was designed to embed macros in HTML/XML pages.

A good example of a macro is %counter(). This embeds a simple incremental counter on an HTML page. To include the results of a SQL query on a page, you can simply type %sql(<dsn>,<query>,%col(1)<br />) in the middle of an XHTML page.

Owing to the high-level nature of the language, SMX can greatly reduce the programming effort required to build dynamic or database-driven web sites.

yntax

Unlike many programming languages, SMX syntax is simple and consistent. All functions begin with a % sign, followed by the name of the function, followed either a single % sign or a parenthetical list of arguments.

Arguments can be quoted using double-quotes. Backslashes can be used to escape commas and double-quotes. A single quote at the beginning of an argument turns off interpretation of code in that argument (similar to LISP).

Everything that isn't code, is, by default, output. To change this behavior, use the %nil or %null macros.

ample code

Hello World

Here is a Hello World code example:

%expand%Hello World!

Using variables to create output

%expand%%set(name,World)Hello %name%!

Forms Processing

%expand%%if(%form(expr) ,

Result is: %expr(%form(expr))

)
Simple math expression:

Page counter

%expand%%counter(hits) hits

Database guestbook

%expand%%if(%not(%exists(/tmp/gbook.sq3)) ,%sql(sqlite:/tmp/gbook.sq3,create table guests (name text, comment text)))%if(%and(%form(name),%form(comment)) ,%sql(sqlite:/tmp/gbook.sq3,"insert into guests (name, comment) values (%sqlq(%form(name)),%sqlq(%form(comment)))"))%sql(sqlite:/tmp/gbook.sq3,select * from guests ,

%html-quote

External links

* http://www.smxlang.org/ (open source implementation of SMX in C++)
* http://www.gjt.org/javadoc/org/opensmx/opensmx/ (open source implementation of SMX in Java)
* http://www.strom.com/pubwork/iwcb.html (review of the original commerce builder)


Wikimedia Foundation. 2010.

Игры ⚽ Поможем решить контрольную работу

Look at other dictionaries:

  • Smx — Saltar a navegación, búsqueda La SMX, ingenio para descender por la nieve, evolución de la snow bike. La SMX es un vehículo para descender por la nieve similar a una bicicleta, una evolución de la snow bike que cuenta con tres esquies,… …   Wikipedia Español

  • SMX — Este artículo o sección necesita referencias que aparezcan en una publicación acreditada, como revistas especializadas, monografías, prensa diaria o páginas de Internet fidedignas. Puedes añadirlas así o avisar al …   Wikipedia Español

  • SMX-23 — Classe Andrasta Pour les articles homonymes, voir Andrasta (homonymie). Classe Andrasta Noms : SMX 23 …   Wikipédia en Français

  • Smx-23 — Classe Andrasta Pour les articles homonymes, voir Andrasta (homonymie). Classe Andrasta Noms : SMX 23 …   Wikipédia en Français

  • SMX-25 — Эту страницу предлагается переименовать. Пояснение причин и обсуждение  на странице Википедия:К переименованию/26 ноября 2012. Возможно, её текущее название не соответствует нормам современного русского языка и/или правилам именования статей …   Википедия

  • SMX — Server Macro eXpansion (Computing » Security) * Smithway Motor Xpress (Business » Firms) * Solaris MINIX (Computing » Software) * Spatialmetrix Corporation (Business » Firms) * Stockholm Money Market Exchange (Business » Stock Exchange) * Captain …   Abbreviations dictionary

  • SMX — sulfamethoxazole …   Medical dictionary

  • SMX — Santa Maria, CA, USA internationale Flughafen Kennung …   Acronyms

  • SMX — Sulfametoxazol …   Diccionario de siglas médicas y otras abreviaturas

  • smx — ISO 639 3 Code of Language ISO 639 2/B Code : ISO 639 2/T Code : ISO 639 1 Code : Scope : Individual Language Type : Living Language Name : Samba …   Names of Languages ISO 639-3

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”