MMBase taglib documentation

 

This is the MMBase taglib reference documentation. There is also a taglib tutorial.

In this reference documentation mmbase tags are divided intro groups. Every tag can be a member of several of these groups. There are two kind of groups, which are listed in this reference. The first set of groups define the `areas' or `types' of the tags. There are for example 'security related' tags and 'tree related' tags. The second kind of grouping of tags specifies the way they work. E.g. a tag which is in the group `Writer' always produces some content which could be written to the page, such group of tags often also share common attributes. E.g. all `WriterReferrer' tags need to have a `writer' attribute. This also means that the documentation for such attributes can be found at the documentation for these groups. So the `writer' attribute is documented in the documentation for the `WriterReferrer' group of tags. The `writer' attribute is also mentioned in the documentation of every WriterReferrer, but there is only a link to the WriterReferrer documentation.

This is the group containing all mmbase tags.

 
cloudprovider | cloudreferrer | clusternodeprovider | condition | container | containerreferrer | contextreader | contextreferrer | contextwriter | fieldprovider | fieldreferrer | functiontag | listprovider | listreferrer | nodeprovider | nodereferrer | querycontainer | querycontainerreferrer | writer | writerreferrer
ageconstraint | aliasconstraint | aliaslist | attachment | booleanfunction | cancel | changed | cloud | cloudinfo (new) | commit | compare | composite | constraint | content | context | countrelations | createalias | createnode | createrelation | deletealias | deletenode | depth | distinct | edit | escaper (new) | even | field | fieldinfo | fieldlist | first | form (new) | formatter | function | functioncontainer | grow | hasfield (new) | hasfunction (new) | hasnode (new) | hasnodemanager (new) | haspage (new) | hasrank (new) | hasrelationmanager (new) | hasrelations | image | import | include | index | info | isempty | isgreaterthan | islessthan | isnotempty | last | leafconstraints | leaffile | leafinclude | link (new) | list | listcondition | listcontainer | listfunction | listnodes | listnodescontainer | listrelations | listrelationscontainer | locale | log | maxnumber | maychangecontext | maycreate | maycreaterelation | maydelete | maywrite | nextbatches | node | nodefunction | nodeinfo | nodelistfunction | notpresent | odd | offset | onshrink | param | present | previousbatches | redirect | related | relatedcontainer | relatednode | relatednodes | relatednodescontainer | remove | removeitem | setcontext | setfield | shrink | size | sortorder | stringlist | time | timer | transaction | tree | treecontainer | treefile | treeinclude | typeconstraint (new) | unrelatednodes | url | valid (new) | voidfunction | write | xslt
info about the syntax of this document
toc
`cloudprovider' tags Cloud provider tags provide a cloud to their body. Also a `transaction' is a kind of cloud.
see alsocloudreferrer
tags of this typecloud | form | transaction
toc
`cloudreferrer' tags A cloud referrer tag is a tag that needs to live in the body of a cloud or transaction tag. This means that it can use MMBase data.
see alsocloud | cloudprovider
attributes
  • cloud
    Which cloud to use. This is an optional argument, and if it is omitted then the tag will refer to the direct parent. Only if there is more than one cloud (for instance within a nested transaction tag) you might want to use this attribute to refer to the main cloud.
tags of this typecloudinfo | createnode | createrelation | hasnode | hasnodemanager | hasrank | hasrelationmanager | link | list | unrelatednodes | listnodes | maycreate | maycreaterelation | deletenode | node | form | transaction | link | treeinclude | leafinclude | include | treefile | leaffile | url
toc
`clusternodeprovider' tags A clusternode provider makes an MMBase Cluster Node available to its body. A cluster node is in fact a combination of nodes. You can get a real node with a sub node tag with the `element' attribute.
see alsoelement attribute of node
nodeprovider attributes
tags of this typelist | related
toc
`condition' tags Condition tags evaluate their body only if a certain condition is met. This condition can be specified sometimes by attributes on the condition tag, or sometimes on the surrounding parent tags.
attributes
  • inverse
    Inverts the condition: the body of the tag will only be executed if the condition does not evaluate to true. This is an optional attribute with its default value set to 'false'.
    true
    false
tags of this typebooleanfunction | changed | isgreaterthan | islessthan | compare | even | first | hasfield | hasfunction | hasnode | hasnodemanager | haspage | hasrank | hasrelationmanager | hasrelations | isempty | isnotempty | last | listcondition | maychangecontext | maycreate | maycreaterelation | maydelete | maywrite | odd | notpresent | present | valid
toc
`container' tags Container tags can be referred to by container-referrers. (since: MMBase-1.7)
tags of this typefunctioncontainer | listrelationscontainer | listnodescontainer | relatednodescontainer | listcontainer | relatedcontainer |
toc
`containerreferrer' tags A container referrer is a tag that can use information provided by some container tag, or can push information to a container tag. (since: MMBase-1.7)
attributes
  • container
    Refer to the container with this id. If you want to explicitily not refer to any container (e.g. function-tags on node), then you can specify an non-existing id.
tags of this typebooleanfunction | function | hasfunction | listfunction | nodefunction | nodelistfunction | list | unrelatednodes | listnodes | relatednodes | size | constraint | composite | ageconstraint | aliasconstraint | typeconstraint | maxnumber | offset | distinct | sortorder | nextbatches | previousbatches | related | voidfunction
toc
`contextreader' tags Contextreader tags are tags that can read previous instances from the context using the 'referid' attribute. It also extends from contextwriter, because it can also put information back into the context. This makes it possible to reuse (settings of) certain tags.
see alsocontext
attributes
  • referid
    Reuses a previously defined tag of the same type.
contextwriter attributes
contextreferrer attributes
tags of this typealiaslist | booleanfunction | cloud | countrelations | depth | field | fieldlist | function | grow | hasfield | hasfunction | hasnode | hasnodemanager | hasrelationmanager | hasrelations | leafconstraints | list | listfunction | unrelatednodes | listnodes | listnodescontainer | listrelations | nextbatches | deletenode | node | nodefunction | nodelistfunction | onshrink | previousbatches | related | relatednodes | relatednodescontainer | removeitem | shrink | stringlist | time | tree | treecontainer | voidfunction | xslt
toc
`contextreferrer' tags

Contextreferrer tags refer to the context. This means that (most of) their attributes can contain `context' variables (referred to by `$'). All tags are contextreferrers or specializations of it.

Note that if you use JSP 2, variables can be accessed by ${}. So this also works in MMBase tags. In MMBase 1.7 the JSP2 variables did not coincide with MMBase variables. In MMBase 1.8 they can coincide.

An example is for instance the use: <mm:listnodes type="$nodetype">, here the 'nodetype' variable from the context is referred to.

see alsocontext
attributes
  • context
    If you want to use variables from another context than the direct parent, then you can specify the id of the parent context tag with this attribute, to indicate it.
tags of this typelist | related | unrelatednodes | listnodes | relatednodes | cloud | deletenode | node | field | function | hasfunction | hasnodemanager | hasrelationmanager | hasnode | hasfield | voidfunction | booleanfunction | listfunction | nodelistfunction | nodefunction | fieldlist | aliaslist | countrelations | hasrelations | listrelations | xslt | time | listnodescontainer | relatednodescontainer | stringlist | nextbatches | previousbatches | removeitem | tree | treecontainer | leafconstraints | grow | onshrink | shrink | depth | info | context | createrelation | createnode | setfield | form | transaction | fieldinfo | nodeinfo | write | link | treeinclude | leafinclude | include | treefile | leaffile | url | link | redirect | image | attachment | relatednode | size | index | formatter | cloudinfo | formatter | import | notpresent | present | redirect | timer | valid
toc
`contextwriter' tags A contextwriter is a contextreferrer, but it can also write itself to the context (using the id attribute). Tags that extend 'contextreader' can then read the information back using the 'referid' attribute.
see alsocontext
attributes
  • id
    With the `id' attribute you define an unique identifier for this context referrer. Nested tags can refer to this directly and other tags by means of a context.
contextreferrer attributes
tags of this typeattachment | cloudinfo | context | list | related | unrelatednodes | listnodes | relatednodes | cloud | deletenode | node | field | function | hasfunction | hasnodemanager | hasrelationmanager | hasnode | hasfield | voidfunction | booleanfunction | listfunction | nodelistfunction | nodefunction | fieldlist | aliaslist | countrelations | hasrelations | listrelations | xslt | time | listnodescontainer | relatednodescontainer | stringlist | nextbatches | previousbatches | removeitem | tree | treecontainer | leafconstraints | grow | onshrink | shrink | depth | createnode | createrelation | fieldinfo | formatter | image | index | info | link | nodeinfo | redirect | relatednode | setfield | size | form | transaction | link | treeinclude | leafinclude | include | treefile | leaffile | url | write
toc
`fieldprovider' tags Field provider tags provide a field to their body. The `value' of the field is not necessary filled, but a field provider can for example be used to get the `guiname' of a field (based on the current locale). The locale for which the gui information is shown, can be set using the 'locale' tag, or it can be set on the 'content' tag.
see alsofieldreferrer | locale | content
tags of this typefield | fieldlist
toc
`fieldreferrer' tags A tag that can live in the body of a field provider tag, it refers to the parent fieldprovider.
see alsofieldprovider
attributes
  • field
    If the tag is living in more than one field provider, and you don't want the direct parent, then you use this attribute to refer to it.
tags of this typefield | fieldinfo | fieldlist | setfield
toc
`functiontag' tags

A function tag (of which there are many different types) evaluate a function. Functions can be defined in three locations:

  • The nodemanager (for functions located in builder code)
  • A functionset
  • A specific classname
Using the 'nodemanager', 'set', and 'module' attributes, you can specify from which location the function should be retrieved. If none of these are given, the function will be a 'node' function and the tag will act as a 'node referrer'.

Parameters to the function can be specified in two ways:

  • By using the 'referids' attribute: these are named variables which are passed on to the function
  • By putting the function call in a 'function container', and by using <mm:param> tags within the function container

The several tags of this type differ only in the way they deal with the function value. E.g. a 'booleanfunction' works as a `condition' tag (evaluating the body if the function value is `true' and not evaluating the body if it is false). A 'nodelistfunction' tag will execute the function and then iterate the body of the tag for all the nodes in the nodelist.

(since: MMBase-1.7)
see alsofunctioncontainer | param
attributes
  • name

    The name of the function to evaluate.


  • nodemanager
    The name of the nodemanager on which the function must be evaluated.
  • set
    The `functionset' from which the function must be taken. These are a kind of static functions (no object is associated with them). These `sets' of functions are a bit like namespaces.
  • classname

    The java class name from which the function must be taken. The function will be interpreted as a `bean' function, meaning that you can set parameters with `set' function, and get function values with any function with no further arguments.

    There are two exceptions to this:

    • If the value of the attribute is 'THISPAGE', a method of the current JSP will be called (a 'method function').
    • If the value of the attribute starts with 'THISPAGE.', an inner class of the current JSP will be used as a bean (the name of the inner class is that what follows the dot).


  • module
    The name of the module on which the function must be evaluated.
  • referids
    Similar to `referids' attribute of mm:url, a simple way to provide (named) arguments to the function.
    see: referids attribute of url
nodereferrer attributes
tags of this typebooleanfunction | function | functioncontainer | hasfunction | listfunction | nodefunction | nodelistfunction | voidfunction
toc
`listprovider' tags

A list provider has a body which is evaluated repeatedly, it is mainly just an iterator tag.

When the list is acting as a contextwriter (if the 'id' parameter is specified), then the body is still evaluated but within the body of the tag the variable refers to the current element. Then after evaluation of the tag, the entire list of elements is available in the context with the type 'java.util.List'.

The attributes to tags of this type (comparator, retain, etc.) all have more or less the same behaviour as the methods of the java.util.Collection interface.

see alsolistreferrer
attributes
  • comparator (since: MMBase-1.7)

    Give the class name of a class that implements the java.util.Comparator interface. Give either a fully qualified name, or a single name. When it is a single name the class must be defined as a static inner class in the jsp (see example)


    SHUFFLE For shuffling you don't need to implement a comparator (which is principally possible). This will use Collections.shuffle in stead.
    REVERSE This pseudo-comparator simply reverses the order of the list (using Collections.reverse).
    NATURAL Sorts the objects by their natural ordering.
    CASE_INSENSITIVE Sorts Strings case-insentitively.
    MyCollator If you use a value like this, then it will be supposed that this Comparator is implemented in this jsp. E.g.:
    <%!
    /**
     * Comparator to order mmbase nodes on their field named "title".
     */
     static private final Collator DUTCH_COLLATOR = Collator.getInstance(new Locale("nl", "NL"));
     static {
        // PRIMARY strength ignores differences between &eacute; and e, and between e and E
        DUTCH_COLLATOR.setStrength(Collator.PRIMARY);
     }
    
     static public class DutchCaseInsensitiveCollator implements Comparator {
        public int compare(Object o1, Object o2) {
            String title1 = ((org.mmbase.bridge.Node) o1).getStringValue("title");
            String title2 = ((org.mmbase.bridge.Node) o2).getStringValue("title");
            return DUTCH_COLLATOR.compare(title1, title2);
        }
     }
    %>;
    <mm:listnodescontainer>
      <!-- make sure the list is not gigantic, when sorting with
           comparator it happens in memory, not by database! -->
      <mm:ageconstraint maxage="7" />
      <mm:listnodes comparator="DutchCaseInsensitiveCollator">
         ...
      </mm:listnodes>
    </mm:listnodescontainer>
    
    
    nl.myorg.OurComparator You can also use a fully qualified class name.
  • add (since: MMBase-1.8)

    Adds to this list all elements represented by the value of this attribute. The value refers to some taglib variable, like the id of another list, or the id of a node (which is only one element then).

    This method is similar to the behavior of the 'add()' and 'addAll()' methods from the java.util.Collection interface.


  • retain (since: MMBase-1.8)

    Removes al the elements from the list, except the ones that are also present in the list which is specified by this attribute.

    This method is similar to the behavior of the 'retainAll()' method from the java.util.Collection interface.


  • remove (since: MMBase-1.8)
tags of this typealiaslist | fieldlist | list | listfunction | unrelatednodes | listnodes | nextbatches | nodelistfunction | previousbatches | related | relatednodes | stringlist
example 1
      
<mm:import id="list1" vartype="list">a,b,c,d,e</mm:import>
<mm:import id="list2" vartype="list">c,d,e,f</mm:import>

<mm:stringlist id="list3" referid="list1" add="list2" />
<mm:stringlist id="list4" referid="list1" retain="list2" />
<mm:stringlist id="list5" referid="list1" remove="list2" />

<mm:write referid="list3" /> / <mm:write referid="list4" /> / <mm:write referid="list5" />

      
      This will print the following:
      
a,b,c,d,e,c,d,e,f / c,d,e / a,b
      
    
toc
`listreferrer' tags A listreferrer tag has to live in the body of a list tag (`list providers').
attributes
  • list
    Which list to use, if the tag is in the body of more than one list, and you don't want the direct parent.
tags of this typechanged | even | first | index | last | listcondition | odd | removeitem | size
toc
`nodeprovider' tags A node provider makes an MMBase Node available to its body.
attributes
  • jspvar
    A jspvar of type Node can be created.
  • commitonclose (since: MMBase-1.8)
    Whether the node must be committed after evaluation of the body. The default is true.
    true If 'commit on close' is true for a NodeProvider, and the current tag (perhaps using 'referid') made changes to it, then on the close of the tag, the 'commit' method of the Node is called. That means that if there are invalid values, an exception may occur.
    false If 'commit on close' is false for a NodeProvider, and the current tag (perhaps using 'referid') made changes to it, then on the close of the tag, the 'commit' method of the Node is called. That means that if there are invalid values, an exception may occur.
tags of this typelist | related | createnode | createrelation | unrelatednodes | listnodes | listrelations | deletenode | node | nodefunction | nodelistfunction | relatednode | relatednodes | tree
toc
`nodereferrer' tags A node referrer tag is a tag that lives within the body of a node provider tag, and uses the node provided by the node provider tag.
attributes
  • node
    Which node to use. You can use this attribute if your Node referrer is living in more than one node provider, and you don't want the direct parent.
tags of this typealiaslist | attachment | countrelations | createalias | deletealias | field | fieldlist | function | hasfunction | voidfunction | booleanfunction | listfunction | nodelistfunction | nodefunction | functioncontainer | hasfield | hasrelations | image | listrelations | listrelationscontainer | maychangecontext | maydelete | maywrite | nextbatches | deletenode | node | nodeinfo | previousbatches | related | relatedcontainer | relatednodes | setcontext | setfield | stringlist | tree | treecontainer
toc
`querycontainer' tags

A `Query' container is a container for one of the `node list' tags (list providers that are node providers too). A query container is actually a wrapper for a `Query' on the database, to which constraints can be added using the <mm:constraint> tag, sortorder can be specified, etc. If a 'node list tag' is inside a corresponding `nodelist container', it will use the query specified by the container.

For examples, have a look at one of the tags of this type.

(since: MMBase-1.7)
see alsolistprovider | nodeprovider | list | listnodes | querycontainerreferrer
attributes
  • cachepolicy (since: MMBase-1.8)
    Determines how results of the query generated by this container are cached.
    neverNever cache the result
    alwaysAlways cache the result (default)
container attributes
tags of this typelistcontainer | listnodescontainer | listrelationscontainer | relatedcontainer | relatednodescontainer
toc
`querycontainerreferrer' tags Refers to a query container. Normally these kind of tags are `query modifiers'. (since: MMBase-1.7)
see alsoquerycontainer
containerreferrer attributes
tags of this typeageconstraint | aliasconstraint | composite | constraint | distinct | list | unrelatednodes | listnodes | maxnumber | nextbatches | offset | previousbatches | relatednodes | size | sortorder | typeconstraint
toc
`writer' tags A writer is a tag that can produce output. Normally the default will be to write to the page, unless the tag has a body. All tags which produce output themselves are `writers'. This is contrary to tags which don't produce output, but only produce contextual information (e.g. mm:cloud, mm:node), or programmatic tools (e.g. mm:present, mm:import, mm:list)
see alsowrite | writerreferrer
attributes
  • jspvar
    The name of the variable to be created. Normally, but not always, the scope of this variable is the body of the tag. This attribute can never contain context variables.
  • vartype

    The type of the variable to be created. Usually there is a reasonable default for this attribute. This attribute can never contain context variables.

    The value of this is used for the `jspvar' if you create it, but it is also used for the 'context' variables. It is less often essential then, but it is essential to set it right e.g. when you want to use the `isgreaterthan' tag, because strings compare differently than numbers.


    see: isgreaterthan
    Objectjava.lang.Object
    Stringjava.lang.String
    Nodeorg.mmbase.bridge.Node
    Cloudorg.mmbase.bridge.Cloud
    Transactionorg.mmbase.bridge.Transaction
    decimaljava.math.BigDecimal
    Integerjava.lang.Integer
    Vectorjava.util.Vector. It's better to use List, normally.
    Listjava.util.List
    Longjava.lang.Long
    Doublejava.lang.Double
    Floatjava.lang.Float
    Datejava.util.Date
    Fieldorg.mmbase.bridge.Field
    FieldValueorg.mmbase.bridge.FieldValue
    Booleanjava.lang.boolean
    fileitemorg.apache.commons.fileupload.FileItem. Can be used in multipart fileuploads (confortable in combination with EL)
  • write
    Whether to write to the page or not. Normally the default value will suffice. If you don't write to the page, the produced string can e.g. be used by sub tags, or only written to a context variable.
    true
    false
  • escape (since: MMBase-1.7)
    Override the default escape behaviour determined by the surrounding Content-tag.
    Escaper
    text/plainThis equals no escaping
    noneNo escaping
    text/htmlEscapes for use in HTML.
    text/html/attributeEscapes for use in HTML atributes
    text/xmlEscapes for use in XML (or XHTML).
    inlineInterpret as 'enriched' ASCII for 'inline' HTML parts (so no blocks)
    pInterpret as 'enriched' ASCII for 'block' HTML parts. It normally generates one or more p-tags.
    ppAs 'p', but only one sequences of one br-tags are produced
    p-ommit-surroundingas p, but surrounding p /p tags are omitted (you must place them by hand). This can be needed for 'read-more' links.
    pp-ommit-surrounding
    wikiGenerates piece of XHTML2 compatible XML
    sqlEscapes for use in SQL (escaping of quotes). You will _not_ have to use this if use mm:constraint.
    js-single-quotesEscapes single quotes for use in Javascript (with \').
    js-double-quotesEscapes double quotes for use in Javascript (with ").
    urlEscapes for use in an URL (using escaping with %). When you use mm:url with mm:param tags you will not have to use this.
    urlparamSimilar to 'url' but also escapes '+'
    uppercaseConverts to all uppercase.
    lowercaseConverts to all lowercase.
    identifierReplaces anything which is not alphanumeric by underscores.
    censorFinds and replaces 'forbidden' words.
    swallowEverything disappears
    linksFinds and makes clickable URL's.
    plainlinksFinds and makes clickable URL's, assuming plain/text input.
    figletFilters through the command-line tool 'figlet', which can have amusing results.
    trimmerTrims leading and trailing whitespace
    cp1252 Escapes the CP1252 characters which are not in ISO-8859-1. You don't want to serve your pages as CP1252 (it is not a standard encoding). It is adviceable to do it using UTF-8, but if you really want to use ISO-8859-1, you can create reasonable surrogates by this (nicer then question marks).
    cp1252wrong Escapes the CP1252 characters, but suppose that the String was originally wrongly encoded (CP1252 bytes were incorrectly supposed ISO-8859-1)
    spaceremover Replace 1 or more white space characters by one space, unless, those are the first or last of the string, those are replaced with nothing.
    spaceswallower Removes all whitespace.
    roman This works on integers only, and converts them to a roman numbers (lowercase, so see also 'uppercase'). This works only for natural numbers smaller than 4000.
    rot13 Performs 'rot 13' encoding of the string, to scramble letters. Can be decoded by doing a rot13 again.
    rot5 Performs 'rot 5' encoding of the string. This scrambles the digits.
    md5
    adler32 Performs a 'adler32' checksum.
    crc32 Performs a 'crc32' checksum.
    java Escapes non-ASCII characters to java escape sequences.
    reducespace

    Replaces groups of one and more newlines by one new line, and one or more space by one space. This spares bandwidth and makes the result better readable.

    This is default for most XML-like content types.

    entitiesAny non-ASCII character will be replaced by an XML-entity.
    xmetodoReplaces ĉ, ĝ, ĥ, ĵ, ŝ, ŭ with cx, gx, hx, jx, sx, ux
    hmetodoReplaces ĉ, ĝ, ĥ, ĵ, ŝ, ŭ with ch, gh, hh, jh, sh, u
    perl Interpret the complete body as a perl program, and write the result.
    sitestat Rewrites the input to the characters which are alowed in Sitestat keys for page statistics, being: "A-Z, a-z, 0-9, - . _".

    see: content | format attribute of formatter
tags of this typealiaslist | attachment | cloudinfo | countrelations | depth | field | fieldinfo | formatter | function | image | index | info | listfunction | nextbatches | nodeinfo | previousbatches | shrink | size | stringlist | time | link | treeinclude | leafinclude | include | treefile | leaffile | url | write
toc
`writerreferrer' tags A writer referrer tag can live in the body of a writer tag, and use the supplied information.
see alsowriter
attributes
  • writer
    Which writer to use. If the tag is living in more than one writer, and you want to refer to another then the direct parent.
tags of this typeisgreaterthan | islessthan | compare | isempty | isnotempty | time | write
toc
<mm:ageconstraint>

In MMBase, objects on default do not have a `creation time' field. But the `number' field can be used to estimate the age (in days), because for every day a `day mark' is remembered. This tag gives easy access to this functionality.

Note that in MMBase 1.8 it is possible to define creation and lastmodified time fields of DATETIME database type. Age-constraints can then also be accomplished by constraints on the date parts of such a field.

(since: MMBase-1.7)
see alsolistnodescontainer | listcontainer | part attribute of constraint
attributes
  • element (since: MMBase-1.8)
    If the surrounding nodelist container is a list container then the constraint can be on the several elements from the path. With this attribute you must indicate to which. This is not needed for listnodes and relatednodes containers.
    see: listcontainer | listnodescontainer
  • field
    If the surrounding nodelist container is a list container then the constraint can be on the several elements from the path. With this attribute you must indicate to which. This is not needed for listnodes and relatednodes containers (and probably would be a `number' field otherwise). This attribute is deprecated in favour of 'element'.
    see: element attribute of ageconstraint | listcontainer | listnodescontainer
  • minage (since: MMBase-1.7)
    Minimal age of the object in days.
  • maxage
    Maximal age of the object in days.
  • inverse
    Inverses the constraint. So adds a NOT.
querycontainerreferrer attributes
containerreferrer attributes
example 1
<mm:listnodescontainer type="typedef">
  <mm:ageconstraint maxage="100" />
  <mm:listnodes>
    <mm:field name="name" />
  </mm:listnodes>
</mm:listnodescontainer>
    
toc
<mm:aliasconstraint> Pinpoints one of the elements to an alias. (since: MMBase-1.7)
see alsolistnodescontainer | listcontainer
attributes
  • element

    see: listcontainer | listnodescontainer
  • name
    The name of the alias, or (since MMBase-1.8) a list of possible aliases.
  • inverse
    Inverses the constraint. So adds a NOT.
querycontainerreferrer attributes
containerreferrer attributes
example 1
<%-- list all portals except the two portals with alias 'portalhome' and 'portalkids' --%>
<mm:listnodescontainer type="portals">
  <mm:aliasconstraint name="portalhome,portalkids" inverse="true" />
  <mm:listnodes>
    <mm:field name="title" />
  </mm:listnodes>
</mm:listnodescontainer>
toc
<mm:aliaslist> This is a list which can only live under a NodeProvider, to iterate through all aliases of the Node. In the body you can use the `writer' functionality to actually write out current alias.
nodereferrer attributes
writer attributes
listprovider attributes
contextreader attributes
contextwriter attributes
contextreferrer attributes
example 1
<mm:listnodes type="list">
  <mm:field name="title" />
  has the following aliases:
  <mm:aliaslist>
     <mm:write /> <mm:last inverse="true">,</mm:last>
  </mm:aliaslist><br/>
</mm:listnodes>
  
toc
<mm:attachment>

Returns an URL to the attachment servlet. This is a NodeReferrer and consequently has to live as a child of a (attachment) node.

Using this tag makes your pages more portable to other system, and hopefully less sensitive for future changes in how the attachment servlet works.

attributes
nodereferrer attributes
writer attributes
contextwriter attributes
contextreferrer attributes
example 1
 <mm:listnodes type="attachments">
  <a href="<mm:attachment />">Download</a>
</mm:listnodes>
    
toc
<mm:booleanfunction>

Gets the function value of function `name'. The function value is supposed to be Boolean, and this tag acts as a `condition' tag.

For more information about how function tags work generally see the the `functiontag' entry of this reference.

(since: MMBase-1.7)
see alsonode | function | listfunction | functiontag
condition attributes
contextreader attributes
contextwriter attributes
contextreferrer attributes
functiontag attributes
nodereferrer attributes
containerreferrer attributes
more examples
example 1
<%!
public static boolean booleanFunction() {
    return System.currentTimeMillis() % 2 == 0;
}
%>
<mm:booleanfunction set="THISPAGE" name="booleanFunction" id="yes">
  YES
</mm:booleanfunction>
<mm:booleanfunction referid="yes" inverse="true">
  NO
</mm:booleanfunction>
toc
<mm:cancel> The cancel tag can be used to cancel a transaction.
see alsotransaction
attributes
  • transaction
    The id of the transaction.
example 1
See the example for tag `transaction'.
toc
<mm:changed>

Can be used in a list to determine if this item has changed compared to the previous one. The criteria applies to the first field given in the orderby attribute of the accompanying list. This field should also be included in the fields attribute of a list or related tag, to make the field accessible.

The first item of a list is always considered `changed'.

see alsofirst | listcondition
condition attributes
listreferrer attributes
example 1
See the example for tag `first'.
toc
<mm:cloud>The cloud tag initializes the cloud to use.
attributes
  • name
    The name of the cloud. On default it is `mmbase'. The default will normally suffice, so you don't need not use this attribute.
    mmbase
  • username

    The authentication name to use (account). When used together with e.g. the method="http" option, validation only succeeds if the username equals this attribute. In this case it is also possible to supply a list of usernames here (comma separated)

    It can also be used in combination with the `password' attribute, in which case authentication will happen automatically with the specified credentials.


  • logon
    Synonym to `username'
    see: username attribute of cloud
  • rank
    The required rank. This is another way to force a special user when using several methods. Often, you should use this attribute in combination with some `method' attribute, because if the `current' cloud (of the session) does not have a user of at least this required rank, then it needs to know how to login again then. If there is no method in that case, then the body will be skipped, and no error will be shown (This behaviour may be usefull to `check' a cloud only).
    administrator
    basic user
  • loginpage

    You can use the loginpage attribute to specify the (relative) path to a security login page. i.e.:

            
    <mm:cloud name="mmbase" loginpage="login.jsp">
    ...
    </mm:cloud>
            
            
    The attribute has effect whenever someone who is not already logged on to the cloud requests the page containing the cloud tag. In that case, the tag checks whether the page has been called with a predefined set of parameters.

    If the page was called with the `command' parameter set to `login', the tag assumes a request is being made to log on using the parameters passed. The actual names of the parameter passed differs by security method chosen, which is defined by the `authenticate' attribute. For instance, with authenticate method `username/password', the following additional parameters are recognized:

    • cloud: similar to the cloudtag's `name' attribute
    • username: similar to the cloudtag's `username' attribute
    • password: similar to the cloudtag's `password' attribute
    If login succeeds, the page continues and displays normally. If the login fails, or if no `command=login' attribute was specified, the request is redirected to the page specified in the attribute. This `login page' can then take care of authentication, i.e. by displaying a form that allows the user to enter and submit the appropriate parameters (username/password) back to the originally called page. The page may also implement its own method of authentication. The `command=login' parameter has no effect when the loginpage attribute was not specified.

    The page should link page to the page which is supplied in the reference parameter. The login page itself should have a parameter `command' with value `login', `authenticate' with the authentication method which is wanted. Additional parameters will be passed to the underlying security implementation. A simple login page could contain the following jsp-code:

            
    <%@ taglib uri="http://www.mmbase.org/mmbase-taglib-1.0"  prefix="mm"%>
    <html>
    <mm:import externid="referrer" required="true" />
    <mm:import externid="reason">please</mm:import>
    <mm:write referid="reason">
      <mm:compare value="failed">
        <font color="red">Failed to log in. Try again</font>
      </mm:compare>
    </mm:write>
        <form method="post" action="<mm:url page="$referrer" />" >
        <input type="hidden" name="command" value="login">
        <input type="hidden" name="cloud" value="mmbase"><!-- also default -->
        <input type="hidden" name="authenticate" value="name/password">
    
        <input type="text" name="username" value="">
        <br />
        <input type="password" name="password" value="">
        <br />
        <input type="submit" name="Login" value="login">
    </form>
    </html>
            
            
    When a user is logged in, a call in that page, with parameter `command' and value `logout' causes the user to be logged out.

    There are different situations on which the cloud tag with the attibute loginpage can react, they are:

    • scenario 1 : not logged-in, no parameter with value login: Stop current page processing, show the login.jsp, which is a form with parameter command with value login. Parameters can be specified inside a form. When the button submit is pressed, this parameters will be send to the referencing page (foo.jsp). The login page wil be called with a `reference' attribute containing this page's URL, and a `reason' attribute `please'.
    • scenario 2 : not logged-in, a parameter with value login: The parameters will be retrieved from the request. These parameters will be passed to the security (CloudContext.getCloud(cloud, authenticate, otherparameters)), and the cloud retrieved will be stored inside the context.(from now you are logged in) Page processing of foo.jsp will continue, unless the authentications failed, because then again is redirected to the login page, but this time with `reason' `failed'.
    • scenario 3: logged-in Page foo.jsp will simply be processed. (Unless e.g. the `logon' attribute is not satisfied).
    • scenario 4: logged-in with parameter command with value logout The cloud in the session will be removed (you are now logged out) and we can continue here from scenario 1. Can also be done with method='logout'.

  • password
    The password to use to logon to the cloud. Always consider using method="pagelogon" when you use this attribute, because the default method will otherwise be "sessionlogon". Then, the resulting cloud-object is written to the session, and the visitor of your page can abuse this to gain authorisation also on other pages.
  • pwd
    Synonym to `password'
    see: password attribute of cloud
  • method
    Describes how to get the authentication information. The default behaviour is as described in `asis'.
    http Use http protocol to ask name and password from the user. If the `username' attribute is specified too, then logging on will fail if the user does not use that username. The `password' (or `pwd') attribute will be ignored.
    logout When using `http' to log on, the browser will store name and password. If you want to log on again, you have to `logout' first. In this case the `realm' of the http authentication will be changed, and you obtain a new possibility to log on after that. The cloud you obtain is anonymous.
    anonymous Ignore the `logon' attribute and create (or reuse) a cloud with an anonymous user.
    asis

    Ignore the `logon' attribute and reuse the cloud as it is in the session, or create an `anonymous' cloud, if there is not cloud in the session.

    pagelogon

    This method should be used together with the "password" attribute, to indicate that the resulting cloud should only be available to the current page, and not to the session.

    sessionlogon

    This method can be used together with "password" attribute, to indicate that the resulting cloud must be written in the session, and can be picked up with method="asis" in another page. Visitors of the page using the login-method should be trusted, because they could perhaps exploit this cloud-object in the session.

    For backwards compatibility reasons this method is the default method if you use the `password' attribute, but a warning will be logged to encourage to state this explicitely, because it is good that you are aware of the consequences.

    A page using a non-anymous cloud in the session should not be cached publicly, that is another reason to use `pagelogon'.

    delegate

    Delegates logging in to the security's authentication implemenation itself. The current request and response objects are given as credentials (e.g. to redirect to an external authentication server). You can also be authenticated only based on class (if in classauthentication.xml this jsp's class was mentioned).

    sessiondelegate

    As delegate, only the resulting cloud is written to the session (and can be picked up with `asis'). This should only be used if the user is trusted (and not e.g. when using `class' security, because then the class is trusted, rather then the user).

  • sessionname

    The name the cloud must get in the session. Using this it is possible to avoid retyping your password when switching between two sites which both use http authentication, but don't share users.

    You can also use a different sessionname for editor pages, so that editors need to log in seperatedly on the front-end, which makes it easier for them to see how pages look for normal users.


  • authenticate
    The authentication module which must be used by the security system. The default is "name/password", which will do in many cases. Other values are often needed when method="delegate" or method="sessiondelegate".
    name/password

    The most common authentication method. You somehow have to supply a name/password combination.

    class

    This can be used in combination with method="delegate". The 1.8 class security (which can be installed in 1.7) feature can recognize this, and supply a cloud based on the class name of this jsp.

  • uri
    The uri in case the cloud has to be retrieved using the RMMCI. This makes it possible to display remote content.
    local Get a local cloud.
    rmi://... RMMCI cloud.
    rmi://www.mmbase.org/remotecontext
  • jspvar
    The name of The JSP variable to create that contains a reference to the cloud.
contextreader attributes
contextwriter attributes
contextreferrer attributes
cloudprovider attributes
example 1
<!-- Show titles of all news articles from user kamer
    (which are in pool kamer_pool) only to user kamer -->
<mm:cloud jspvar="cloud" logon="kamer" method="http">
logged on as: <bean:write name="cloud" property="user.identifier" /><br />
<mm:node number="kamer_pool" id="my_node">
  <mm:related paths="news" orderby="number" directions="DOWN">
     <mm:first>
        <!-- show a small heading,
            which also contains the node-number of the pool -->
        <mm:field node="my_node" name="number" />:
        <mm:field name="number" />
            <mm:fieldinfo type="guiname" />
        </mm:field>:
        <mm:field name="title" />
            <mm:fieldinfo type="guiname" />
        </mm:field>:
     </mm:first>
     <mm:field name="number" />: <mm:field name="title" /><br />
  </mm:related>
</mm:node>
</mm:list>
</mm:cloud>
    
example 2
<!-- To logon on as a different user on my_page.jsp,
    make a ref to a page -->
<mm:cloud method="logout" />
<% response.sendRedirect("http://my_host/my_page.jsp"); %>
    
more examples
example 1
<mm:cloud>
   <!-- show some data, in this case, the first 'typedef', 
        because this type is availabe in every MMBase installation -->
   <mm:listnodes type="typedef" max="1">
     <mm:field name="name" /> : <mm:field name="description" />
   </mm:listnodes>
</mm:cloud>
example 1
<mm:cloud method="http" jspvar="cloud">
  logged on as: <%= cloud.getUser().getIdentifier() %><br />
</mm:cloud>
<a href="<mm:url page="logout.jsp" />">logout</a>
example 1
<mm:cloud method="logout" />
<br />
<a href="<mm:url page="cloud.jsp" />">back to cloud.jsp</a>
toc
<mm:cloudinfo> The nodeinfo tag can be used inside a CloudProvider tag, to get certain information about the cloud. (since: MMBase-1.8)
see alsohasrank
attributes
  • type
    nameThe name of the cloud (Usually just `mmbase')
    userThe identifier of the user of this cloud. You can show who is logged in by this.
    rankThe rank of the user of this cloud, as a String
    rankintThe rank of the user of this cloud, as an Integer
    mmbaseversionThe version of the current instance of MMBase to which this cloud refers.
writer attributes
cloudreferrer attributes
contextwriter attributes
contextreferrer attributes
example 1
      You are <mm:cloudinfo type="user" /> (<mm:cloudinfo type="rank" />)
      <mm:hasrank value="administrator">
        You are administrator !!
      </mm:hasrank>
      <mm:hasrank minvalue="administrator" inverse="true">
        You are not administrator!
      </mm:hasrank>
        Cloud: <mm:cloudinfo type="name" />
toc
<mm:commit> The commit tag can be use to commit a transaction.
see alsotransaction
attributes
  • transaction
    The id of the transaction.
example 1
See the example for tag `transaction'.
toc
<mm:compare> Compares the value of a context variable to a String value. Only if they are equal the body is evaluated.
see alsoisempty | isnotempty | isgreaterthan | islessthan
attributes
  • referid
    Which context variable to compare. It this attribute is missing, then the value of the parent `writer' is taken.
  • value (Either `value', `valueset', `referid2' or 'regexp' must be present.)
    The value to which you want to compare, this is always a String.
  • valueset (Either `value', `valueset', `referid2' or 'regexp' must be present.) (since: MMBase-1.7)
    List of values. Compare is done with each, and total result is true if one of them evaluates true.
  • referid2 (Either `value', `valueset', `referid2' or 'regexp' must be present.)
    The value can also be another context variable, which is not necessarily a string. The type (set by `vartype') is taken into account.
    see: vartype attribute of writer
  • regexp (Either `value', `valueset', `referid2' or 'regexp' must be present.) (since: MMBase-1.8)
    Matches value to a regular expression. See javadoc of java.util.regex.Pattern
condition attributes
writerreferrer attributes
example 1
    <mm:import id="carry_out">yes</mm:import>
    <mm:compare referid="carry_out" value="yes">
        Body should be carried out!
    </mm:compare>
    <mm:compare referid="carry_out" value="no">
        Body should not be carried out!
    </mm:compare>
    
example 2

      <mm:compare referid="zipcode" regexp="(?i)[0-9]{4}\s?[a-z]{2}">
         zip-code correct.
      </mm:compare>

    
toc
<mm:composite> Combines constraints with a conditional operator. (since: MMBase-1.7)
see alsoconstraint | listnodescontainer | listcontainer | querycontainer | ageconstraint
attributes
  • operator
    The operator to be used in the comparison. Defaults to `AND'
    OR
    AND
querycontainerreferrer attributes
containerreferrer attributes
example 1
The following code lists all users with username 'admin' or 'test'.

<mm:listnodescontainer type="people">
  <mm:composite operator="OR">
    <mm:constraint field="username" value="admin" operator="LIKE" />
    <mm:constraint field="username" value="test" operator="LIKE" />
  </mm:composite>
  <mm:listnodes>
    <mm:field name="username" /> <br />
  </mm:listnodes>
</mm:listnodescontainer>
        
toc
<mm:constraint> Applies a constraint to the query of the surrounding nodelist container. (since: MMBase-1.7)
see alsolistnodescontainer | listcontainer | querycontainer | ageconstraint | composite
attributes
  • field
    The field to which the constraint must be applied.
  • field2
    Another field the field is to be compared with.
  • value
    The value the field is to be compared with.
  • referid
    The value the field is to be compared.
  • value2
    Needed for BETWEEN operator.
  • referid2
    Needed for BETWEEN operator.
  • inverse
    Inverses the constraint. So adds a NOT.
  • casesensitive
    Changes the given constraint's `case sensitivity' (if applicable). Default it is false.
  • part (since: MMBase-1.8)
    Designates a part of a date field to compare.
    CENTURY
    YEAR
    MONTH
    QUARTER
    WEEK
    DAY
    DAYOFYEAR
    DAYOFMONTH
    DAYOFWEEK
    HOUR
    MINUTE
    SECOND
  • operator
    The operator to be used in the comparison. Defaults to `='
    EQUAL
    =
    LESS
    <
    LESS_EQUAL
    <=
    GREATER
    >
    GREATER_EQUAL
    >=
    LIKE
    BETWEENShould also use value2 or referid2
    INThe value can be a comma seperated String of values. You can also refer to some list with `referid' (e.g. to a nodelist tag)
    NULLTests wether the value of the field is NULL (or NOT NULL if inverse="true"). The `value' attributes are ignored.
querycontainerreferrer attributes
containerreferrer attributes
example 1
<mm:listnodescontainer type="people">
  <mm:composite operator="OR">
    <mm:constraint field="username" value="admin" operator="LIKE" />
    <mm:constraint field="username" value="test" operator="LIKE" />
  </mm:composite>
  <mm:listnodes>
    <mm:field name="username" /> <br />
  </mm:listnodes>
</mm:listnodescontainer>
    
toc
<mm:content>

The content tag is meant to put around your whole page, and set general properties, like language, taglib behaviour, content type.

The content-tag can also provide a default `escaping' behavior for surrounded `writer' tags.

It also tries to set reasonable cache-headers. Make sure to read the documentation of the `expires' attribute.

(since: MMBase-1.7)
see alsocloud | time | locale | expires attribute of content
attributes
  • language
    The language in which this page is supposed to be written. This information is available to sub-tags (like cloud-tag).
    see: language attribute of locale
  • country
    see: country attribute of locale
  • variant (since: MMBase-1.8)
    see: variant attribute of locale
  • jspvar
  • type

    The Content-Type of this page.

    Setting the content-type can also trigger a default `escaper' and `postprocessor'.

    IdContent-TypeDefault escaperDefault postprocessorDefault encoding
    htmltext/htmltext/htmlreducespaceNOTSPECIFIED
    xhtmlapplication/xhtml+xmltext/xmlreducespace
    xmlapplication/xmltext/xmlreducespace
    text/htmltext/htmltext/htmlreducespaceNOTSPECIFIED
    text/xmltext/xmltext/xmlreducespaceNOTSPECIFIED
    application/xmlapplication/xmltext/xmlreducespace
    application/xhtml+xmlapplication/xhtml+xmltext/xmlreducespace
    audio/x-pn-realaudioaudio/x-pn-realaudiononereducespace
    application/smilapplication/smiltext/xmlreducespace
    text/vnd.rn-realtexttext/vnd.rn-realtexttext/xmlreducespace
    video/x-ms-wmpvideo/x-ms-wmptext/xmlreducespace
    text/javascripttext/javascriptnonereducespace
    text/csstext/cssnonereducespace

  • encoding
    The output text encoding. Don't attribute too much value too this. Normally it's better to arrange this with the page-directive of JSP. Certainly this attribute cannot arrange the pageEncoding (or the coding of the JSP source itself).
    UTF-8
  • expires

    Defines when this page expires (in seconds after now). If you set this, this has influence on some http header being set ('Cache-Control' and `Expires'). This default to one minute public-caching if there is no session used on the page, and to no caching otherwise.

    Setting this to 0 has the effect of disabling all proxy-caching.

    If expires is is set to a value greater than 0, and there is a Cloud-tag in the page which wrote a non-anonymous cloud object to the session, then the Cache-Control header is `private', rather than public, because such a situation implies that there is something on the page which is not public.


  • postprocessor

    If this attribute is set the complete body-result is piped through this. If you specified `type', then a default postprocessor might be defined.

    The following postprocessors can be specified (besides the ones defined with mm:escaper tags).

    Postprocessor
    reducespace

    Replaces groups of one and more newlines by one new line, and one or more space by one space. This spares bandwidth and makes the result better readable.

    This is default for most XML-like content types.

    entitiesAny non-ASCII character will be replaced by an XML-entity.
    xmetodoReplaces ĉ, ĝ, ĥ, ĵ, ŝ, ŭ with cx, gx, hx, jx, sx, ux
    hmetodoReplaces ĉ, ĝ, ĥ, ĵ, ŝ, ŭ with ch, gh, hh, jh, sh, u
    perl Interpret the complete body as a perl program, and write the result.
    sitestat Rewrites the input to the characters which are alowed in Sitestat keys for page statistics, being: "A-Z, a-z, 0-9, - . _".

    see: escaper
  • escaper

    The default value of the escape attribute of all writer tags in the body. The values are defined in taglibcontent.xml. Reasonable defaults apply if you explicitely speficy a type.

    The `escape' attribute of the surrounded writers can be used to override this. (E.g. if the writer itself produces HTML (e.g. mm:function name="gui"), then you should use escape="none").

    The following `escapers' can be specified (besides the ones defined with mm:escaper tags):

    Escaper
    text/plainThis equals no escaping
    noneNo escaping
    text/htmlEscapes for use in HTML.
    text/html/attributeEscapes for use in HTML atributes
    text/xmlEscapes for use in XML (or XHTML).
    inlineInterpret as 'enriched' ASCII for 'inline' HTML parts (so no blocks)
    pInterpret as 'enriched' ASCII for 'block' HTML parts. It normally generates one or more p-tags.
    ppAs 'p', but only one sequences of one br-tags are produced
    p-ommit-surroundingas p, but surrounding p /p tags are omitted (you must place them by hand). This can be needed for 'read-more' links.
    pp-ommit-surrounding
    wikiGenerates piece of XHTML2 compatible XML
    sqlEscapes for use in SQL (escaping of quotes). You will _not_ have to use this if use mm:constraint.
    js-single-quotesEscapes single quotes for use in Javascript (with \').
    js-double-quotesEscapes double quotes for use in Javascript (with ").
    urlEscapes for use in an URL (using escaping with %). When you use mm:url with mm:param tags you will not have to use this.
    urlparamSimilar to 'url' but also escapes '+'
    uppercaseConverts to all uppercase.
    lowercaseConverts to all lowercase.
    identifierReplaces anything which is not alphanumeric by underscores.
    censorFinds and replaces 'forbidden' words.
    swallowEverything disappears
    linksFinds and makes clickable URL's.
    plainlinksFinds and makes clickable URL's, assuming plain/text input.
    figletFilters through the command-line tool 'figlet', which can have amusing results.
    trimmerTrims leading and trailing whitespace
    cp1252 Escapes the CP1252 characters which are not in ISO-8859-1. You don't want to serve your pages as CP1252 (it is not a standard encoding). It is adviceable to do it using UTF-8, but if you really want to use ISO-8859-1, you can create reasonable surrogates by this (nicer then question marks).
    cp1252wrong Escapes the CP1252 characters, but suppose that the String was originally wrongly encoded (CP1252 bytes were incorrectly supposed ISO-8859-1)
    spaceremover Replace 1 or more white space characters by one space, unless, those are the first or last of the string, those are replaced with nothing.
    spaceswallower Removes all whitespace.
    roman This works on integers only, and converts them to a roman numbers (lowercase, so see also 'uppercase'). This works only for natural numbers smaller than 4000.
    rot13 Performs 'rot 13' encoding of the string, to scramble letters. Can be decoded by doing a rot13 again.
    rot5 Performs 'rot 5' encoding of the string. This scrambles the digits.
    md5
    adler32 Performs a 'adler32' checksum.
    crc32 Performs a 'crc32' checksum.
    java Escapes non-ASCII characters to java escape sequences.
    reducespace

    Replaces groups of one and more newlines by one new line, and one or more space by one space. This spares bandwidth and makes the result better readable.

    This is default for most XML-like content types.

    entitiesAny non-ASCII character will be replaced by an XML-entity.
    xmetodoReplaces ĉ, ĝ, ĥ, ĵ, ŝ, ŭ with cx, gx, hx, jx, sx, ux
    hmetodoReplaces ĉ, ĝ, ĥ, ĵ, ŝ, ŭ with ch, gh, hh, jh, sh, u
    perl Interpret the complete body as a perl program, and write the result.
    sitestat Rewrites the input to the characters which are alowed in Sitestat keys for page statistics, being: "A-Z, a-z, 0-9, - . _".

    see: escape attribute of writer | function | escaper
toc
<mm:context>

`Contextwriter' tags inside a context tag supplying the `id' attribute register themselves in the context. Other tags can refer to this id. See for example how the createrelation tag works. A special case of a another tag referring to this id is a tag of the same type. Normally with an attribute `referid' you could `repeat' the tag.

With the import tag you can explicitly put things from outside this context into this context, e.g. from the parameter list or from a parent context. It is also possible to put new strings in the context with the import tag.

There are several ways to refer to objects in the context.

When you are adding a new object then the used attribute is `id'.

The `id' of an `external' object like a request parameter is referred to as `externid' (only in the import tag).

If you are reusing the same object, for example you have put a node in the context, and are using it again then an attribute `referid' is used.

If some attribute wants to use the value of an object in the context, and it is an attribute which can refer to the context (which most attributes are), then you can use something like <context-id;>.<object-id>. The `context-id' is optional when you are in the same context, or sub-context. The value of a context variable can be written to the page with the `write' tag. The {}-parentheses are optional too.

And finally there are some attributes which can only refer. For example if some tag has to live as a child of another tag but you want it to refer not to its direct parent, then there should be an attribute with the name of the parent in which you can put the id of the parent which it has to refer to. For example the field tag has an attribute `node'. This kind of referring does not function per the ContextTag, and is only good for finding ancestor tags. Other tags, like the createrelation tag have attributes like `source' and `destination' attributes which also simply contain the node id's. Please find the examples.

In TCP there is a `tag' called `create', which is comparable to `context'.

On default a context has no id. The implicit `page' context also doesn't have. If a context has no id, there is no way of referring to variables of it if you are not in the context itself (or one of the sub-contexts).

see alsocreaterelation
attributes
  • referid (since: MMBase-1.7)
    Pick up existing context.
  • scope (since: MMBase-1.8)
    Pick up existing context.
    page
    request
    session
    application
contextwriter attributes
contextreferrer attributes
example 1
Use a context inside another context (inside the default `context')
                and import parameters:
<mm:import id="hoi">greetings from amsterdam</mm:import>
<mm:import id="alias" externid="hoi" required ="true" />
<mm:context id="other_context">
  <mm:import externid="alias" />
  <mm:write referid="alias" /><br/>
  <mm:import id="hoi_again">greetings from hilversum</mm:import>
  <mm:write referid="hoi_again" />
</mm:context>
more examples
example 1
<mm:import id="hoi" externid="haj" from="parameters" required="true" jspvar="groet" />
example 1
<mm:write referid="hoi" />,
<mm:write referid="hoi" jspvar="greet">
  <%= greet %>
</mm:write>
example 1
<mm:context id="A">  
  <mm:import id="hoi">hola!</mm:import>
  In context A we also create the variable 'hoi'. This time its value
 is 'hola!' </p><p>
  <mm:context id="B">
    Within a 'child' context of A (we named it B), you can write easily the variable
    from the parent context:
	<mm:write referid="hoi" /></p><p>
    Imagine that also in this context B we create a variable 'hoi', so
    that now we already have three variable named 'hoi'.
	<mm:import id="hoi">foobar</mm:import>
    <mm:context id="C">
     Then we could also demonstrate the use of the attribute
	'context'. It is not really necessary but exist for symmetry
	reasons. With it you can indicate in which of the parent contexes
	the write tag must be evaluated: <mm:write context="A"
	referid="hoi" />, <mm:write referid="A.hoi" />, <mm:write
	context="B" referid="hoi" />, <mm:write referid="A.B.hoi" />,
	<mm:write referid="hoi" /> </p>
    <p>The most upper value of the
	variable 'hoi' in this page (the one which was gotten with 'haj')
	is not accessible here in context C, because the implicit page
	context is unnamed and the 'hoi' variables of contextes A and B
	are shielding it.
    </mm:context>
  </mm:context>
</mm:context>
example 1
<mm:write referid="A.B.hoi" />, 
<mm:write referid="A.hoi" />, 
<mm:write referid="hoi" />
toc
<mm:countrelations> Can be used inside a node tag to show the number of relations the node has. The same effect can be reached by a relatednodescontainer tag with a `size' tag in it.
see alsorelatednodescontainer | size
attributes
  • type
    If specified only the number of relations to the type of nodes specified by this attribute are returned.
  • searchdir (since: MMBase-1.7)

  • role (since: MMBase-1.7)

writer attributes
nodereferrer attributes </