343 MGraphics.ru - SSI - Функция Cmdecho
Уроки photoshopa


SSI

Функция Cmdecho

Условия перепечатки материалов

Рейтинг статьи: 33333
Проголосовало 2 человека.
Оцените статью:

'cmdecho'

The cmdecho variable is used to set the output option of subsequent exec..cmd tokens. The format is 'cmdecho'='"<onoroff>"'where <onoroff> is either 'ON' or 'OFF'. When the SSI+ parsing engine encounters an exec..cmd token it executes the command. If the command returns output then that output may be echoed into the HTML document or it may be ignored. The format of the data echoed is dependent on the presence or absence of config..cmdprefix and config..cmdpostfix tokens in the document. In the absence of config..cmdprefix and config..cmdpostfix tokens the output will be echoed exactly as returned with no formatting and no special character interpretation. In the presence of config..cmdprefix and/or config..cmdpostfix tokens the output will be formatted and interpreted. To activate echoing set cmdecho to 'ON' otherwise set it to 'OFF'. The default is 'OFF'.

'cmdprefix' The cmdprefix variable is used to set the string prefixed to each line out output from subsequent exec..cmd tokens. The format is 'cmdprefix="'<string>"'where <string> is any character string and/or HTML format tags. When the SSI+ parsing engine encounters an exec..cmdtoken it executes the command. If the command returns output then that output may be echoed into the HTML document or it maybe ignored. If the output is echoed (see 'cmdecho' above),then each line output from the executable will be prefixed with the string supplied before being echoed into the HTML document.

'cmdpostfix' The cmdpostfix variable is used to set the string appended to the end of each line out output from subsequent exec..cmd tokens. The format is 'cmdpostfix="'<string>"'where <string> is any character string and/or HTML format tags. When the SSI+ parsing engine encounters an exec..cmdtoken it executes the command. If the command returns output then that output may be echoed into the HTML document or it maybe ignored. If the output is echoed (see 'cmdecho' above),then each line output from the executable will be appended with the string supplied before being echoed into the HTML document.

'onerr' The onerr variable is used to set the action to be taken when the SSI+ engine encounters an error. The format is 'onerr="'<action>"'where <action> is one of the following tags.

'goto' causes a jump to a label token (see below). The format of the goto tag is:

  • 'goto' <label>
  • where <label> is the name of a label defined in a subsequent label tag (see below).
  • 'print' causes text to be printed. The format of the print tag is:
    • 'print "'<text>"'
    • where <text> is any HTML text or tag.
  • 'error' causes the current config..error message to be printed.
  • 'break' causes termination of the HTML document transmission to the client.
  • 'errorbreak' causes the current config..error message to be printed, and then causes termination of the HTML document transmission to the client.
  • 'printbreak' causes text to be printed, and then causes termination of the HTML document transmission to the client. The format of the printbreak tag is the same as the format of the print tag.

Example. The following token on an HTML document sets the SSI+ error action to print a message and terminate the document. From this point on down when an error occurs in the SSI+ parsing engine the message will be inserted into the HTML document at the location of the offending SSI+ statement, and the document will be terminated

  • <!--#config onerr="printbreak "Sorry, we encountered an error while processing your document."" -->

Example. Suppose you wish to create an HTML document that performs a 'PING' operation on address '204.96.64.171' and then echo the results back to the client browser, with each line echoed as an element in an unnumbered list.

  • Insert the following lines into your HTML document:
    • <UL>
    • <!--#config cmdecho="ON" -->
    • <!--#config cmdprefix="<LI>" -->
    • <!--#exec cmd="ping 204.96.64.171 -w 20000" -->
    • </UL>
  • When the document is accessed by a remote browser the output would look something like this:
    • Pinging 204.96.64.171 with 32 bytes of data:
    • Reply from 204.96.64.171: bytes=32 time<10ms TTL=32
    • Reply from 204.96.64.171: bytes=32 time<10ms TTL=32
    • Reply from 204.96.64.171: bytes=32 time<10ms TTL=32
    • Reply from 204.96.64.171: bytes=32 time<10ms TTL=32

Разместил: Vulko
Опубликовано: 21.06.2004
Статья "SSI - Функция Cmdecho" прочтена 8363 раза.





Последние новости