Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
server:web [2010/02/21 19:58] – created digitalman | server:web [2020/11/11 15:13] – [Introduction] webv4 mention mlong | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Web Server ====== | ====== Web Server ====== | ||
- | TODO | + | The Synchronet Web Server serves static (e.g. files) and dynamic content to HTTP clients (e.g. web browsers). |
+ | |||
+ | ===== Introduction ===== | ||
+ | |||
+ | The Synchronet Web Server is a mostly HTTP 1.1 compliant web server capable of | ||
+ | handing basic web servicing tasks. | ||
+ | general-purpose web server one would come to expect (including CGI). | ||
+ | |||
+ | It also, through Server-Side JavaScript (SSJS), allows dynamic pages to be | ||
+ | created which can access BBS data directly. | ||
+ | |||
+ | For more information on the webv4 implementation, | ||
+ | |||
+ | |||
+ | ===== Configuration ===== | ||
+ | |||
+ | ==== Startup INI [Web] Section Keys ==== | ||
+ | |||
+ | The '' | ||
+ | |||
+ | === RootDirectory === | ||
+ | |||
+ | Default value: '' | ||
+ | |||
+ | This is the root directory of your web server... a request to | ||
+ | '' | ||
+ | |||
+ | **NOTE**: Older versions of Synchronet had this value default to '' | ||
+ | |||
+ | === ErrorDirectory === | ||
+ | Default value: '' | ||
+ | |||
+ | The directory relative to [[# | ||
+ | message files are located. | ||
+ | numeric HTTP error code they will represent and may be either '' | ||
+ | or '' | ||
+ | same error). | ||
+ | |||
+ | === IndexFileNames === | ||
+ | |||
+ | Default value: '' | ||
+ | |||
+ | A comma-separated list of filenames in order of preference to serve as | ||
+ | the default document in a directory. | ||
+ | '' | ||
+ | Do not remove the '' | ||
+ | web pages at all. | ||
+ | |||
+ | === Authorization === | ||
+ | |||
+ | Default value: '' | ||
+ | |||
+ | A comma-separated list of authentication mechanisms in order of preference. | ||
+ | The standards say that Basic must come first, but no browser currently | ||
+ | appears to use Digest if Basic is listed first. | ||
+ | and Digest. | ||
+ | clear over the wire. | ||
+ | |||
+ | === CGIDirectory === | ||
+ | Default value: '' | ||
+ | |||
+ | A directory relative to [[# | ||
+ | considered CGI-executable. Be careful what files you put in this | ||
+ | directory. | ||
+ | |||
+ | === CGIExtensions === | ||
+ | Default value: '' | ||
+ | |||
+ | A comma-separated list of file extensions/ | ||
+ | extensions will be considered CGI-executable and the web server will | ||
+ | attempt to execute them as such. | ||
+ | |||
+ | Other probably values include: '' | ||
+ | |||
+ | === DefaultCGIContent === | ||
+ | |||
+ | Default value: '' | ||
+ | |||
+ | If the CGI program does not generate a content-type header, this value | ||
+ | will be used for the MIME content-type specified in the HTTP response. | ||
+ | |||
+ | === JavaScriptExtension === | ||
+ | |||
+ | Default value: '' | ||
+ | |||
+ | Files with this extension will be considered SSJS files. | ||
+ | systems, this will be attempted to run with the JavaScript interpreter. | ||
+ | |||
+ | === MaxInactivity === | ||
+ | |||
+ | Default value: '' | ||
+ | |||
+ | If a client holds a connection open for this many seconds without a | ||
+ | request, the web server will shut down the connection. | ||
+ | |||
+ | === MaxCgiInactivity === | ||
+ | |||
+ | Defalut value: '' | ||
+ | |||
+ | If a CGI script runs for more than this many seconds without any | ||
+ | output, it will be terminated and the connection will be shut down. | ||
+ | |||
+ | === HttpLogFile === | ||
+ | |||
+ | Default value: '' | ||
+ | |||
+ | The prefix of log files if HTTP_LOGGING is enabled (See next item) to | ||
+ | store Common Logfile Format logs in. The current virtual host | ||
+ | (if enabled, see next item), date, and '' | ||
+ | |||
+ | === Options === | ||
+ | |||
+ | Default value: '' | ||
+ | |||
+ | The '' | ||
+ | |||
+ | '' | ||
+ | |||
+ | Log all received data to the console log, as well as various | ||
+ | extra bits related to receiving data. | ||
+ | |||
+ | '' | ||
+ | |||
+ | Log all transmitted data except the reply body itself, as well | ||
+ | as various extra bits of information related to transmitted | ||
+ | data. | ||
+ | |||
+ | '' | ||
+ | |||
+ | Supports name-based virtual hosts. | ||
+ | host names, you can have each host name return unique content | ||
+ | depending on which hostname is used. ie: if | ||
+ | '' | ||
+ | system, you could have FreeBSD-specific pages on one, and | ||
+ | general *nix stuff on the other. | ||
+ | |||
+ | A virtual host is added by simply putting the desired content | ||
+ | into a sub-directory of [[# | ||
+ | ie: '' | ||
+ | the request host name (very old browsers, or some automated | ||
+ | tools) they will be served out of document root. | ||
+ | It is therefore a good idea to put links to your various | ||
+ | virtual hosts in an '' | ||
+ | like this: | ||
+ | <code html> | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | Your browser is either too old to support | ||
+ | name-based virtual hosts, or you have visited a | ||
+ | virtual hosts that is not yet configured. | ||
+ | following are hosted here:< | ||
+ | <a href=" | ||
+ | <a href=" | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | '' | ||
+ | |||
+ | Disable CGI script execution. | ||
+ | |||
+ | '' | ||
+ | |||
+ | Enable logging to a Common Logfile Format log as described in | ||
+ | the HttpLogFile section. | ||
+ | programs (like Webalizer: http:// | ||
+ | |||
+ | '' | ||
+ | |||
+ | Disable SSJS execution. | ||
+ | |||
+ | '' | ||
+ | |||
+ | Enable TLS support. | ||
+ | |||
+ | '' | ||
+ | |||
+ | Indicates that all URLs availabe via http are also available via https and redirects clients who want a TLS session to the https location. | ||
+ | |||
+ | ==== Other configuration files ==== | ||
+ | |||
+ | In addition to the '' | ||
+ | also uses some other configuration files: | ||
+ | |||
+ | === ctrl/ | ||
+ | Contains the file extension to mime-type mapping. | ||
+ | is in the format " | ||
+ | The extensions are case-insensitive and do not include the ' | ||
+ | |||
+ | === ctrl/ | ||
+ | Contains the URLs to the icons used by the default 404.ssjs | ||
+ | script for each file type/ | ||
+ | Example: " | ||
+ | DIRECTORY which is used for directories and DefaultIcon which | ||
+ | is used for extensions which don't exist in the list. | ||
+ | |||
+ | === ctrl/ | ||
+ | |||
+ | This file contains 2 sections where a list of file | ||
+ | extensions and their associated content-creation handlers are | ||
+ | specified: | ||
+ | |||
+ | == [CGI] == | ||
+ | |||
+ | The [CGI] section is for natively-executed CGI handlers | ||
+ | (e.g. "pl = perl" indicates " | ||
+ | |||
+ | == [JavaScript] == | ||
+ | |||
+ | The [JavaScript] section is used for JS-executed content | ||
+ | handlers (e.g. "xjs = xjs_handler.js" | ||
+ | |||
+ | === ctrl/ | ||
+ | Contains a list of system environment variables to pass to CGI | ||
+ | processes. | ||
+ | value, over-ridden value, and prepended or appended text. | ||
+ | |||
+ | |||
+ | ==== webctrl.ini per-directory configuration file ==== | ||
+ | Each directory under the [[# | ||
+ | the directory it's in and all child directories. | ||
+ | either globally, in a per-filename group, or, in version 3.17 or greater, a per-directory-name group. | ||
+ | Using the * and ? wildcards as the group name such as '' | ||
+ | |||
+ | === AccessRequirements === | ||
+ | Specifices an ARS string which all users must match to be able to access | ||
+ | files in this directory. | ||
+ | |||
+ | For example, to require a login, but allow **any** user to access files in a | ||
+ | directory, but only a sysop to access '' | ||
+ | <file webctrl.ini> | ||
+ | AccessRequirements=level 0 | ||
+ | [*.log] | ||
+ | AccessRequirements=level 90 | ||
+ | [*.git] | ||
+ | AccessRequirements=level 90 | ||
+ | </ | ||
+ | |||
+ | === Realm === | ||
+ | Sets the realm that is displayed to the user for the HTTP login. | ||
+ | Default is the BBS name. | ||
+ | |||
+ | === DigestRealm === | ||
+ | Sets the realm that is displayed to the user for the HTTP login when | ||
+ | Digest authentication is being used. Default is the [[#Realm]] value. | ||
+ | |||
+ | === Authorization === | ||
+ | A comma-separated list of authentication mechanisms in order of | ||
+ | preference. | ||
+ | browser currently appears to use Digest if Basic is listed first. | ||
+ | Supported values are '' | ||
+ | users password is never sent over the wire. | ||
+ | |||
+ | === ErrorDirectory === | ||
+ | Specifies a different directory to check for error pages. | ||
+ | page is not found, will still check the global error directory. | ||
+ | |||
+ | === CGIDirectory === | ||
+ | Specify an alternate CGI directory to check for CGI files. | ||
+ | |||
+ | === PathInfoIndex === | ||
+ | Specifies that the index files can be ran for unlocated pages in the | ||
+ | current directory. | ||
+ | |||
+ | === FastCGISocket === | ||
+ | Specifies the socket and port of a FastCGI listener in the < | ||
+ | <file webctrl.ini> | ||
+ | [*.php] | ||
+ | FastCGISocket=127.0.0.1: | ||
+ | </ | ||
+ | |||
+ | Added on November 1st, 2015 to CVS (in 3.17a). | ||
+ | |||
+ | See [[howto: | ||
+ | |||
+ | === Rewrite* === | ||
+ | Specifies a Javascript snippet which can modify the http_request.request_string. | ||
+ | |||
+ | Added on November 3rd, 2015 to CVS (in 3.17a). | ||
+ | |||
+ | === JSPreExec === | ||
+ | A JavaScript snippet which is executed in the same context as Rewrite* lines, but before any Rewrites are executed. | ||
+ | |||
+ | Added on November 3rd, 2015 to CVS (in 3.17a). | ||
+ | |||
+ | ===== JavaScript Objects ===== | ||
+ | In addition to the standard JavaScript objects, the web server provides the | ||
+ | following: | ||
+ | |||
+ | ==== http_request object ==== | ||
+ | |||
+ | The http_request object contains information from the client that was included | ||
+ | during this request. | ||
+ | |||
+ | === path_info === | ||
+ | Contains extra path information that was included with the | ||
+ | request AFTER the URI which identified this script. | ||
+ | example, if the request was for | ||
+ | '' | ||
+ | would contain the string "/ | ||
+ | |||
+ | === method === | ||
+ | Contains the HTTP method used to run the script. | ||
+ | writing, the available methods are " | ||
+ | " | ||
+ | |||
+ | === virtual_path === | ||
+ | The virtual path that this URI was reached by. This is the | ||
+ | portion of the URI from the end of the host to the end of the | ||
+ | filename. | ||
+ | |||
+ | === query === | ||
+ | This object contains the values of any form data which was | ||
+ | submitted with the request. | ||
+ | name/value pairs. | ||
+ | for this is that it is legal and often useful to have multiple | ||
+ | form fields with the same name. | ||
+ | |||
+ | === query_string === | ||
+ | If a query string was included, this is the raw, unparsed query | ||
+ | string. | ||
+ | |||
+ | === post_data === | ||
+ | As with query_string but for data which was POSTed. | ||
+ | |||
+ | === header === | ||
+ | An associative array of header name/value pairs. | ||
+ | |||
+ | === cookie === | ||
+ | Much like the query object, this object contains key/value pairs | ||
+ | of set cookies. | ||
+ | multiple values for the same key can be set for cookies. | ||
+ | |||
+ | === real_path === | ||
+ | The real OS's complete path to this script. | ||
+ | |||
+ | === ars === | ||
+ | The ARS string which applies to this request. | ||
+ | |||
+ | === request_string === | ||
+ | |||
+ | The raw request string sent by the client. | ||
+ | |||
+ | === host === | ||
+ | The value of the host header for this request. | ||
+ | === vhost === | ||
+ | The virtual host serving this request. | ||
+ | === http_ver === | ||
+ | The HTTP version used for this request as a string. | ||
+ | |||
+ | === remote_ip === | ||
+ | The IP address of the client. | ||
+ | |||
+ | === remote_host === | ||
+ | |||
+ | If the web server does host lookups (disabled by default), this | ||
+ | is the remote hostname. | ||
+ | |||
+ | |||
+ | ==== http_reply object ==== | ||
+ | |||
+ | |||
+ | The http_reply object is used to pass information about the reply back to the | ||
+ | Synchronet web server. | ||
+ | |||
+ | === status === | ||
+ | |||
+ | HTTP status string. | ||
+ | |||
+ | === header === | ||
+ | An associative array of headers to include with the reply. | ||
+ | only pre-defined one is " | ||
+ | |||
+ | === fast === | ||
+ | This optional property can be set to " | ||
+ | directly to the client for HTTP/1.0 connections. | ||
+ | keep-alives from working but generally appears faster to the | ||
+ | client. | ||
+ | required for HTTP/1.1. | ||
+ | |||
+ | |||
+ | ==== Extra global methods ==== | ||
+ | |||
+ | The web server also adds a new global JavaScript method that requests that the specified cookie be set: | ||
+ | |||
+ | set_cookie(string key, | ||
+ | | ||
+ | [, time_t expires | ||
+ | [, string domain | ||
+ | [, string path | ||
+ | [, bool secure ]]]]) | ||
+ | |||
+ | ===== The SSJS Template System ===== | ||
+ | The default web pages use a SSJS Template engine which also allows for Theme | ||
+ | support. | ||
+ | |||
+ | [Note: | ||
+ | |||
+ | |||
+ | ==== The SSJS Template Scheme ==== | ||
+ | |||
+ | Each page consists of four parts: | ||
+ | |||
+ | === The Header | ||
+ | ../ | ||
+ | |||
+ | This file contains the basic requirements for the HTML page. | ||
+ | The opening HTML, doctype, title, CSS file link, etc. The | ||
+ | header file includes the open body, System Name, and User | ||
+ | greeting plus the initial page layout table start. | ||
+ | of the layout is continued in the next files. | ||
+ | |||
+ | === Top Navigation === | ||
+ | |||
+ | ../ | ||
+ | ../ | ||
+ | |||
+ | The '' | ||
+ | The links are dynamically generated by '' | ||
+ | files need to be addressed when modifying or creating themes. | ||
+ | In the case of the default layout, '' | ||
+ | graphic and a middle section that the dynamic content goes. The | ||
+ | background image is handled by CSS. You can change this to anything | ||
+ | you like. | ||
+ | |||
+ | The '' | ||
+ | pretty straight forward. | ||
+ | check the current page location and sets up the breadcrumbs based | ||
+ | on what you want it to say. | ||
+ | |||
+ | For example: | ||
+ | You want to add a Links page called links.html in the main | ||
+ | directory. | ||
+ | as: | ||
+ | |||
+ | <code javascript> | ||
+ | if(http_request.virtual_path=="/ | ||
+ | template.topnav.push({html: | ||
+ | </ | ||
+ | |||
+ | === Left Side Navigation === | ||
+ | |||
+ | ../ | ||
+ | ../ | ||
+ | ../ | ||
+ | |||
+ | This starts the main table layout in the default layout and also | ||
+ | provides two other things -- the main navigation links and a brief | ||
+ | nodelisting that displays when users are online via telnet. | ||
+ | The links are dynamically created as in the Top Navigation example | ||
+ | above with the exception of the two static links. | ||
+ | |||
+ | === Main Content (various files) === | ||
+ | |||
+ | This is where the layout of the main content is created. | ||
+ | to look at the various files in '' | ||
+ | '' | ||
+ | various functions of the Web side of Synchronet. | ||
+ | each of the special codes contained in those files do will follow. | ||
+ | |||
+ | === Footer === | ||
+ | |||
+ | ../ | ||
+ | |||
+ | This file contains the closing HTML and whatever bottom information | ||
+ | you would like. In the case of the default layout, the | ||
+ | Web Server/ | ||
+ | privacy statements or anything else can be placed here and they will | ||
+ | be displayed at the bottom of each page. | ||
+ | |||
+ | |||
+ | ==== SSJS Theme Support ==== | ||
+ | |||
+ | Theme Layouts can be added to Synchronet by creating them and placing the | ||
+ | *.inc files in their own directory under ../ | ||
+ | |||
+ | Themes are activated by editing the ../ | ||
+ | This file contains: | ||
+ | <code javascript> | ||
+ | /* Set default theme name */ | ||
+ | var DefaultTheme=" | ||
+ | |||
+ | /* Edit this bit to add/ | ||
+ | Themes[" | ||
+ | Themes[" | ||
+ | Themes[" | ||
+ | Themes[" | ||
+ | </ | ||
+ | |||
+ | Themes are added by editing below the Default Theme such as: | ||
+ | <code javascript> | ||
+ | Themes[" | ||
+ | Themes[" | ||
+ | Themes[" | ||
+ | Themes[" | ||
+ | </ | ||
+ | To change the Default Theme, change: | ||
+ | |||
+ | <code javascript> | ||
+ | var DefaultTheme=" | ||
+ | </ | ||
+ | to: | ||
+ | <code javascript> | ||
+ | var DefaultTheme=" | ||
+ | </ | ||
+ | |||
+ | ==== Special Codes Used in the SSJS Template System ==== | ||
+ | |||
+ | By looking at at the message related files located in templates/ | ||
+ | it can be seen that some special codes are used to display dynamically created | ||
+ | content. It is very important to maintain the information EXACTLY as seen in | ||
+ | each file or else the messaging system will fail. While how it is displayed | ||
+ | can be changed, the correct information will only be dispayed by following the | ||
+ | format in the *.inc files. | ||
+ | |||
+ | For example the groups.inc: | ||
+ | <code html> | ||
+ | <!-- Main Content --> | ||
+ | |||
+ | <td class=" | ||
+ | |||
+ | <table class=" | ||
+ | < | ||
+ | <th class=" | ||
+ | </ | ||
+ | << | ||
+ | < | ||
+ | <td class=" | ||
+ | <a class=" | ||
+ | %%groups: | ||
+ | <td class=" | ||
+ | @@JS: | ||
+ | </ | ||
+ | <<END REPEAT groups>> | ||
+ | </ | ||
+ | <br /> | ||
+ | |||
+ | <!-- end Main Content --> | ||
+ | </ | ||
+ | |||
+ | While the table layout can be changed or even eliminated, the information | ||
+ | within the << | ||
+ | To remove the table yet keep the correct infomation, the resulting groups.inc | ||
+ | would be changed to (while maintaining the main table layout in this case) to: | ||
+ | <code html> | ||
+ | <!-- Main Content --> | ||
+ | |||
+ | <td class=" | ||
+ | |||
+ | << | ||
+ | <a class=" | ||
+ | %%groups: | ||
+ | @@JS: | ||
+ | <<END REPEAT groups>> | ||
+ | |||
+ | <br /> | ||
+ | |||
+ | <!-- end Main Content --> | ||
+ | </ | ||
+ | |||
+ | This principle applies to all the .inc files in msgs respectively. | ||
+ | |||
+ | ==== The SSJS Template Library ==== | ||
+ | |||
+ | '' | ||
+ | |||
+ | i.e.; Spaces are replaced with: '' | ||
+ | |||
+ | '' | ||
+ | |||
+ | i.e.; Spaces are replaced with: '' | ||
+ | |||
+ | '' | ||
+ | |||
+ | No changes or encoding is performed. | ||
+ | |||
+ | '' | ||
+ | (^^ and %% are also supported) | ||
+ | |||
+ | '' | ||
+ | (^^ and %% are also supported) | ||
+ | |||
+ | <code javascript> | ||
+ | << | ||
+ | @@name: | ||
+ | <<END REPEAT name>> | ||
+ | </ | ||
+ | |||
+ | Iterates over the array/ | ||
+ | the value of '' | ||
+ | (^^ and %% are also supported) | ||
+ | |||
+ | |||
+ | ==== SSJS Message Configuration ==== | ||
+ | |||
+ | Configuration settings for the SSJS Messaging system is located in the | ||
+ | '' | ||
+ | <code javascript> | ||
+ | max_messages=20; | ||
+ | max_pages=30; | ||
+ | next_msg_html=" | ||
+ | prev_msg_html=" | ||
+ | next_page_html=" | ||
+ | prev_page_html=" | ||
+ | showall_subs_enable_html=" | ||
+ | showall_subs_disable_html=" | ||
+ | show_messages_all_html=" | ||
+ | show_messages_yours_html=" | ||
+ | show_messages_your_unread_html=" | ||
+ | show_messages_spacer_html="& | ||
+ | anon_only_message=" | ||
+ | anon_allowed_message='< | ||
+ | anon_reply_message='< | ||
+ | private_only_message=" | ||
+ | private_allowed_message='< | ||
+ | private_reply_message='< | ||
+ | </ | ||
+ | |||
+ | Each of these are configurable. | ||
+ | |||
+ | See the actual file for the defaults currently in use. | ||
+ | |||
+ | ==== Embedded Javascript ==== | ||
+ | |||
+ | The '' | ||
+ | which is parsed by the JavaScript engine. | ||
+ | number of embedded JavaScript in the *.inc files slow down overall processing | ||
+ | of pages. | ||
+ | |||
+ | Anything contained within '' | ||
+ | engine. | ||
+ | |||
+ | For example, it can check if the user is Guest or an actual user with this line: | ||
+ | |||
+ | <code javascript> | ||
+ | @@JS: | ||
+ | else '< | ||
+ | </ | ||
+ | |||
+ | What this does is display links specific for Registered Users only to them | ||
+ | and not Guest. | ||
+ | Note, it also can be used to display HTML based on location as in the | ||
+ | node listing stuff. In this case, it checks for whether or not a user is | ||
+ | online, or if the user is anywhere but the Who's Online page before displaying | ||
+ | the Left side node listing. | ||
+ | |||
+ | IMPORTANT! | ||
+ | will be errors in parsing. | ||
+ | |||
+ | ==== global_defs.ssjs ==== | ||
+ | |||
+ | This version of the Web Layout now includes a new file called | ||
+ | '' | ||
+ | be used for creating global definitions that span all pages of a site. | ||
+ | For example: | ||
+ | |||
+ | <code javascript> | ||
+ | template.user_alias=user.alias; | ||
+ | </ | ||
+ | |||
+ | Now '' | ||
+ | user's alias. | ||
+ | |||
+ | Care should be exercised when using this file as loading it up with hundreds | ||
+ | of predefined definitions may slow down overall page rendering as the file is | ||
+ | loaded on every page. It would be better to just put a few popular | ||
+ | definitions that are truly global rather many definitions. | ||
+ | inefficient to have thirty of forty message definitions being loaded when a | ||
+ | user is looking at the statistics page. | ||
+ | |||
+ | |||
+ | ===== XJS files ===== | ||
+ | |||
+ | XJS files, handled by '' | ||
+ | an easier method of generating SSJS files. | ||
+ | commands embedded in them using special tags much like PHP. XJS files are | ||
+ | translated on-the-fly to .ssjs files using the same name with '' | ||
+ | For example, a file named test.xjs will, when ran, generate a '' | ||
+ | file. | ||
+ | |||
+ | |||
+ | ==== XJS syntax ==== | ||
+ | |||
+ | In an XJS file, everything not within a special xjs tag is send to the remote | ||
+ | host unmodified, and everything inside the xjs tag is interpreted as JS | ||
+ | statements to be executed at that point in the file. The xjs tag begins with | ||
+ | either "<? | ||
+ | |||
+ | <code html> | ||
+ | < | ||
+ | < | ||
+ | Your SysOp "<? | ||
+ | <?xjs write(system.name) ?> | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | This would send the following web page to the remote system: | ||
+ | <code html> | ||
+ | < | ||
+ | < | ||
+ | Your SysOp " | ||
+ | My Brand New BBS | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | Looping constructs are permitted, however, not using brackets can result in | ||
+ | unexpected effects. | ||
+ | brackets with looping and flow control items. | ||
+ | |||
+ | The following example displays the numbers from one to 10. | ||
+ | <code html> | ||
+ | < | ||
+ | < | ||
+ | <?xjs | ||
+ | var i; | ||
+ | for(i=1; i<=10; i++) { | ||
+ | ?> | ||
+ | <?xjs write(i) ?>< | ||
+ | <?xjs } ?> | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ==== XJS-specific global methods and properties ==== | ||
+ | |||
+ | The following JavaScript methods and properties are available to XJS files only. | ||
+ | |||
+ | === xjs_load(filename) === | ||
+ | Runs the specified xjs file at the current position. | ||
+ | are NOT visible to '' | ||
+ | relative to the including file (or absolute.) | ||
+ | |||
+ | === cwd === | ||
+ | Contains the path that the current xjs script was loaded from and which | ||
+ | parameters to '' | ||
+ | the value of '' | ||
+ | check for files. | ||
+ | |||
+ | {{indexmenu_n> | ||