docs.roxen.com
main | demo | docs
download | community | pike
© 2000 Roxen Internet Software
Suggestions, Comments or Complaints
manuals@roxen.com

DocsRoxen2.0Web Site Creator ManualScopes & Entities
   

  • client
  • page
  • roxen
  • Scopes & Entities

    Entities are variables that has been given an all accessible name, which mean they are available everywhere whenever the module defining them is loaded. An entity mostly contains information fetched from within the Roxen WebServer, but it can also be declared by a tag, making it a carrier of website specific information.

    An entity always belongs to a scope, i.e. a group of entities providing information about something specific, e.g. a user or a page. A list of the entities belonging to a scope can be made available with <pre><insert variables="full" scope="the scope"/></pre>

    The syntax of an entity is always "&scope.entity;", e.g. &page.filename;. The scope "_" is always the present scope, e.g. in <emit source="sql"> &sql.x; = &_.x; </emit>. There is no default scope on the page top level, i.e. outside of all tags the creates scopes, unless you are running in compatibility mode. Then the form scope will be your default scope.

    The most common scopes that handles variables are the "var" and "form" scopes. The "var" scope is always empty when the page parsing begins and should be used for temporary variables. The "form" scope contains all returned results from forms.

    Entities in RXML 2.0 is handled like any variable in RXML 1.3. Examples:
    RXML Result 
    <set variable="var.foo" value="bar"/>  &var.foo; = bar  
    <set variable="var" scope="foo" value="bar"/>  &foo.var; = bar  
    <if variable="var.foo = bar">gazonk</if>  Returns gazonk if &var.foo; = bar.  

    Splice

    The splice attribute-operand '::', has a similar function in RXML as in most programming languages. Splice in RXML is used for expanding what is inside a variable, i.e. put what is stored in the variable into for instance a tag before parsing it. It might for instance be a list of attributes stored in the variable or an URL, etc. The splice operand is necessary as the RXML-parser (RXML 2.0) only will make one pass when parsing a page while the old parser (RXML 1.3) sometimes made several passes while parsing a tag.


    
    <define variable='var.foo'>quant='20' gamma='0.5'</define>
    <cimg src='../img/robodog.jpg' ::='&var.foo;'/>
    

    The really useful thing with :: is that it is possible to give attributes, which are unknown, to a tag in advance, which makes it is possible to store an entire list of attributes in a variable.


    Encoding

    An entity can be placed anywhere in a page and will have its content inserted during the parsing. The content is encoded per default so that "<" will be outputed as "&lt;" in HTML pages. You can choose another scheme by using the &scope.entity:scheme; syntax, e.g. &form.html:none;. [More about encoding]

    The scopes are:

    Name Description  
    client   This scope contains information specific to the client/browser that is accessing the page.  
    page  This scope contains information specific to this page.  
    roxen  This scope contains information specific to this Roxen WebServer.  
    user  This scope contains information specific to the user.