<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns:media="http://search.yahoo.com/mrss/" xmlns="http://www.w3.org/2005/Atom"><title>André van Toly / MMBase tips</title><subtitle>A weblog with tips about MMBase stuff like the tag library and the use of different applications.</subtitle><link type="application/atom+xml" rel="self" href="http://www.toly.nl/rss/mmbase/"/><link href="http://www.toly.nl/"/><id>http://www.toly.nl/rss/mmbase/</id><updated>2012-10-29T09:51:17Z</updated><author><name>André van Toly</name><uri>http://www.toly.nl/</uri><email>andre@toly.nl</email></author><rights>Creative Commons Attribution 3.0</rights><generator version="1.9.2" uri="http://www.mmbase.org/">MMBase</generator><icon>http://www.toly.nl/favicon.ico</icon><logo>http://www.toly.nl/css/images/bird-sm.png</logo><entry xmlns:media="http://search.yahoo.com/mrss/"><title>Blobs to disk recipe</title><link href="http://www.toly.nl/mmbase/2902/Blobs_to_disk_recipe"/><id>http://www.toly.nl/mmbase/2902/Blobs_to_disk_recipe</id><updated>2012-10-29T09:51:17Z</updated><published>2012-10-29T00:00:00Z</published><author><name>André</name></author><summary type="html">&lt;p&gt;MMBase has the option to serve large binary files - like images and other big files - from disk in stead of from the database. The default configuration is to save all binaries or blobs in the database, but can lead to hefty database backups. This recipe is about saving binaries on your filesystem.&lt;/p&gt;</summary><content type="html">&lt;p&gt;MMBase has the option to serve large binary files - like images and other big files - from disk in stead of from the database. The default configuration is to save all binaries or blobs in the database, but can lead to hefty database backups. This recipe is about saving binaries on your filesystem.&lt;/p&gt;&lt;p&gt;The last couple of months I did this exercise a few times in a row for some rather long running MMBase installations. Database backups took over two hours or more, because of a large number of big images and other blobs like videos. The &lt;a href=&quot;http://www.mmbase.org/mmdocs/backenddevelopers/storage/conversions.html&quot;&gt;documentation&lt;/a&gt; about this procedure is a bit scarse, here are my notes.&lt;/p&gt;
&lt;p&gt;MMBase has various database description files for MySQL as well as PostgreSQL, Oracle etc. These files live in /config/storage/databases and contain templates for typical SQL procedures that differ. This example prepares and an older MySQL database from the latin1 era to use blobs from disk.&lt;/p&gt;&lt;h4&gt;Recipe&lt;/h4&gt;&lt;p&gt;1. Stop your web application server, e.g. Tomcat.&lt;/p&gt;
&lt;p&gt;2. Make sure there is  /WEB-INF/config/storage/databases/mysql-binaryasfile-latin1.xml. To create it, copy the existing mysql-latin1.xml, rename it 'mysql-binaryasfile-latin1.xml' and modify it. Right below the following line:&lt;/p&gt;
&lt;pre&gt;&amp;lt;option name=&quot;database-supports-blob&quot; /&amp;gt;&lt;/pre&gt;
&lt;p&gt; Add a line declaring you will serve binaries from disk from now on.&lt;/p&gt;
&lt;pre&gt;&amp;lt;option name=&quot;database-stores-binary-as-file&quot; value=&quot;true&quot; /&amp;gt;&lt;/pre&gt;
&lt;p&gt;Don't mind the location where all files are saved, this is set in 'modules/mmbaseroot.xml' (step 4).&lt;/p&gt;
&lt;p&gt;3. In /WEB-INF/config/modules/mmbaseroot.xml change the database property:&lt;/p&gt;
&lt;pre&gt;&amp;lt;property name=&quot;database&quot;&amp;gt;mysql&amp;lt;/property&amp;gt;&lt;/pre&gt;
&lt;p&gt;To the exact same name as your new database storage file:&lt;/p&gt;
&lt;pre&gt;&amp;lt;property name=&quot;database&quot;&amp;gt;mysql-binaryasfile-latin1&amp;lt;/property&amp;gt;&lt;/pre&gt;
&lt;p&gt;4. Make sure the property 'datadir' is set in that same file 'mmbaseroot.xml' if you want your files to end up somewhere else but the webapp directory. In my case:&lt;/p&gt;
&lt;pre&gt;&amp;lt;property name=&quot;datadir&quot;&amp;gt;/usr/share/data&amp;lt;/property&amp;gt;&lt;/pre&gt;
&lt;p&gt;Ensure this directory is 'writable' for your web application server, e.g. Tomcat, since all binaries will end up here.&lt;/p&gt;
&lt;p&gt;5. Adapt your database. In MySQL you need these lines to change some rows in the table for icaches (image caches) and images:&lt;/p&gt;
&lt;pre&gt;mysql&amp;gt; DROP TABLE install_icaches;&lt;br /&gt;mysql&amp;gt; ALTER TABLE install_icaches add unique (ckey);&lt;br /&gt;mysql&amp;gt; ALTER TABLE install_images MODIFY handle longblob NULL DEFAULT NULL;&lt;/pre&gt;
&lt;p&gt;6. Make sure the field 'handle' in tables that contain binaries is not NULL or you will get exceptions during export of your data. To check enter on the MySQL console: &lt;/p&gt;
&lt;pre&gt;mysql&amp;gt; SELECT * FROM install_icaches WHERE handle IS NULL;&lt;/pre&gt;
&lt;p&gt;And to make all binary fields NULL that empty:&lt;/p&gt;
&lt;pre&gt;mysql&amp;gt; UPDATE install_attachments SET handle=0 WHERE handle IS NULL;&lt;br /&gt;mysql&amp;gt; UPDATE install_icaches SET handle=0 WHERE handle IS NULL;&lt;br /&gt;mysql&amp;gt; UPDATE install_images SET handle=0 WHERE handle IS NULL;  &lt;/pre&gt;
&lt;p&gt;7. If you want you can change these logging settings to follow progress during export. Typically in /WEB-INF/config/log/log4j.xml:&lt;/p&gt;
&lt;pre&gt;&amp;lt;logger name=&quot;org.mmbase.storage.implementation.database.DatabaseStorageManager&quot; additivity=&quot;false&quot;&amp;gt;&lt;br /&gt;  &amp;lt;level class=&quot;&amp;amp;mmlevel;&quot; value =&quot;service&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;appender-ref ref=&quot;sqllog&quot; /&amp;gt;
&amp;lt;/logger&amp;gt;&lt;/pre&gt;
&lt;p&gt;8. Start Tomcat again and hit the 'Blobs to disk' button in MMBase Admin. You can follow the export in the logs.&lt;/p&gt;
&lt;p&gt;When the export is finished you wil find all your files in a directory named after your database, ordered per table. And you have started serving binaries from your filesystem in stead of your database.&lt;/p&gt;&lt;h4&gt;Look for double icaches&lt;/h4&gt;&lt;p&gt;All image caches, 'icaches', in your database should be unique. These caches are altered versions, typically scaled down smaller versions, of the original large uploaded image. This MySQL command counts, the number of non unique icaches, the ones with the same 'ckey', the template that created the image cache.&lt;/p&gt;
&lt;pre&gt;mysql&amp;gt; select number,ckey,count(ckey) as cnt from install_icaches &lt;br /&gt;    group by ckey having cnt &amp;gt; 1 order by cnt;&lt;/pre&gt;&lt;ul&gt;
          &lt;li&gt;
          &lt;a href="http://www.mmbase.org/mmdocs/backenddevelopers/storage/conversions.html"&gt;Storage conversions&lt;/a&gt;
          &lt;br /&gt;MMBase documentation with HOW-TO's for various database modifications.
          &lt;/li&gt;
          &lt;/ul&gt;</content></entry><entry xmlns:media="http://search.yahoo.com/mrss/"><title>Streams app: upload and transcode video</title><link href="http://www.toly.nl/mmbase/1522/Streams_app__upload_and_transcode_video"/><id>http://www.toly.nl/mmbase/1522/Streams_app__upload_and_transcode_video</id><updated>2012-05-05T16:26:59Z</updated><published>2012-05-05T01:00:00Z</published><author><name>André</name></author><summary type="html">The MMBase Streams applications converts uploaded video (and audio and images) to different other formats, like webm, ogg or h.264. It is developed as an extension to the mmbase media application used by a few Dutch broadcasters.</summary><content type="html">The MMBase Streams applications converts uploaded video (and audio and images) to different other formats, like webm, ogg or h.264. It is developed as an extension to the mmbase media application used by a few Dutch broadcasters.&lt;p&gt;Streams adds the ability to upload and transcode video and audio to different formats using open source encoding tools like FFmpeg and FFmpeg2Theora. Streams was especially developed for Open Images, a project by the Netherlands Institute for Sound and Vision and partners. &lt;br /&gt;It converts uploaded streams to different, open formats like: Ogg or WebM but also MP4/H.264. It make use of the open source tools FFmpeg, FFmpeg2Theora and ImageMagick to transcode media. It handles all video, audio and image formats FFMpeg can recognize and was especially developed for &lt;a title=&quot;Open Images media platform build with open source and open standards hosting open content&quot; href=&quot;http://www.openimages.eu/files/OIP-1.0.2.tar.gz&quot;&gt;Open Images&lt;/a&gt;, an open source media platform.&lt;/p&gt;
&lt;p&gt;Streams can be configured to handle the mime types 'image/*', 'video/*' and 'audio/*'. It depends on FFmpeg to recognize media. Users upload media and it gets automatically converted to more or less &quot;open&quot; formats most browsers can handle: video to WebM, OGV or MP4/H.264, audio to OGA, AAC or MP3 and images to PNG. It even contains a transcoder to create segmented TS streams of video's that can be viewed on mobile phones using celular networks. Our latest version of the stream app adds the ability to create thumbnails from movie stills.&lt;/p&gt;
&lt;div class=&quot;oip_media&quot;&gt;&lt;video controls=&quot;controls&quot; width=&quot;512&quot; height=&quot;288&quot; poster=&quot;http://www.openbeelden.nl/images/67910/WEEKNUMMER741-HRE00016E93.png&quot;&gt;&lt;source type=&quot;video/ogg; codecs=theora&quot; src=&quot;http://www.openbeelden.nl/files/23/23180.23172.WEEKNUMMER741-HRE00016E93.ogv&quot;&gt;&lt;/source&gt;&lt;source type=&quot;video/mp4; codecs=h264&quot; src=&quot;http://www.openbeelden.nl/files/23/23186.23172.WEEKNUMMER741-HRE00016E93.mp4&quot;&gt;&lt;/source&gt;&lt;source type=&quot;application/x-mpegurl&quot; src=&quot;http://www.openbeelden.nl/files/23/37679.23172.WEEKNUMMER741-HRE00016E93.m3u8&quot;&gt;&lt;/source&gt;&lt;/video&gt;&lt;span class=&quot;license&quot;&gt;&lt;a rel=&quot;cc:attributionURL&quot; href=&quot;http://www.openbeelden.nl/media/23173&quot;&gt;Eerste proef met beeldtelefoon&lt;/a&gt;, door &lt;a rel=&quot;dct:creator&quot; href=&quot;http://www.openbeelden.nl/users/beeldengeluid&quot;&gt;Polygoon-Profilti (producent) / Nederlands Instituut voor Beeld en Geluid (beheerder)&lt;/a&gt;, is gelicenseerd onder &lt;a rel=&quot;license&quot; href=&quot;http://creativecommons.org/licenses/by-sa/3.0/nl/&quot;&gt;Creative Commons - Naamsvermelding-Gelijk delen&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;&lt;h4&gt;Short configuration example for audio&lt;/h4&gt;&lt;p&gt;The strength of the streams application can best be illustrated with a short example. The following FFmpeg command generates an Ogg audio file 'audio.ogg' from a source file 'audio.wav':&lt;/p&gt;
&lt;pre&gt;ffmpeg -i audio.wav -acodec libvorbis -aq 32 -ab 192k audio.ogg &lt;/pre&gt;
&lt;p&gt;It is reflected in the mmbase streams configuration file 'createcaches.xml' like this:&lt;/p&gt;
&lt;pre&gt;&amp;lt;transcoder mimetype=&quot;audio/*&quot; id=&quot;v3&quot; in=&quot;intermediate&quot;&amp;gt;&lt;br /&gt;    &amp;lt;class name=&quot;org.mmbase.streams.transcoders.FFMpeg&quot;&amp;gt;&lt;br /&gt;      &amp;lt;param name=&quot;format&quot;&amp;gt;ogg&amp;lt;/param&amp;gt;&lt;br /&gt;      &amp;lt;param name=&quot;acodec&quot;&amp;gt;libvorbis&amp;lt;/param&amp;gt;&lt;br /&gt;      &amp;lt;param name=&quot;aq&quot;&amp;gt;32&amp;lt;/param&amp;gt;&lt;br /&gt;      &amp;lt;param name=&quot;ab&quot;&amp;gt;192k&amp;lt;/param&amp;gt;&lt;br /&gt;    &amp;lt;/class&amp;gt;&lt;br /&gt;    &amp;lt;loganalyzer name=&quot;org.mmbase.streams.transcoders.FFMpegAnalyzer&quot; /&amp;gt;&lt;br /&gt;&amp;lt;/transcoder&amp;gt;&lt;/pre&gt;
&lt;p&gt;Input s a file of mimetype 'audio/*' and it is transcodes with  FFmpeg to an 192 Kb Ogg Vorbis audio file.&lt;/p&gt;&lt;h4&gt;Install FFmpeg and other tools&lt;/h4&gt;&lt;p&gt;Like the mmbase resources application that converts image files, and  depends on a correctly configured ImageMagick installation. You will  need at least FFMpeg to convert video and audio, the applications uses it for recognition and transcoding  of media. &lt;br /&gt;If you have not configured and run FFmpeg previousely it is now the moment to do so.&lt;/p&gt;
&lt;p&gt;Besides FFmpeg you may want to use FFmpeg2Theora to encode OGV and OGA. Installing and configuring FFmpeg2Theora may be a bit easier then FFmpeg.&lt;/p&gt;
&lt;p&gt;When you have at least ffmpeg runnig you can start configuring mmbase. You can confirm if ffmpeg is installed by typing 'ffmpeg -version'.&lt;/p&gt;
&lt;pre&gt;$ ffmpeg -version
FFmpeg version SVN-r26402, Copyright (c) 2000-2011 the FFmpeg developers
  built on Mar 17 2011 21:12:03 with gcc 4.2.1 (Apple Inc. build 5666) (dot 3)
  configuration: --prefix=/usr/local --enable-gpl --enable-nonfree --enable-shared 
    --enable-postproc --enable-avfilter --enable-pthreads --enable-x11grab 
    --enable-bzlib --enable-libmp3lame --enable-libtheora --enable-libvorbis 
    --enable-libx264 --enable-zlib --enable-libfaac --disable-yasm
  libavutil     50.36. 0 / 50.36. 0
  libavcore      0.16. 1 /  0.16. 1
  libavcodec    52.108. 0 / 52.108. 0
  libavformat   52.93. 0 / 52.93. 0
  libavdevice   52. 2. 3 / 52. 2. 3
  libavfilter    1.74. 0 /  1.74. 0
  libswscale     0.12. 0 /  0.12. 0
  libpostproc   51. 2. 0 / 51. 2. 0
&lt;/pre&gt;&lt;h4&gt;Installation of streams&lt;/h4&gt;&lt;p&gt;The streams application depends on two mmbase applications: media and resources. The first media handles media descriptions, the second resources handles file upload and file serving, f.e. all files in Open Images are saved &lt;a title=&quot;Media files on Open Images&quot; href=&quot;http://www.openimages.eu/files&quot;&gt;http://www.openimages.eu/files&lt;/a&gt;. Streams itself is responsible for recognition and transcoding of all media. When you use Maven to build your projects you will at least need these mmbase applications.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;mmbase-media&lt;/li&gt;
&lt;li&gt;mmbase-resources.jar&lt;/li&gt;
&lt;li&gt;mmbase-streams.jar&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;See for example the Maven project file for Open Images.&lt;/p&gt;</content></entry><entry xmlns:media="http://search.yahoo.com/mrss/"><title>Cron jobs</title><link href="http://www.toly.nl/mmbase/2594/Cron_jobs"/><id>http://www.toly.nl/mmbase/2594/Cron_jobs</id><updated>2011-10-14T15:23:09Z</updated><published>2011-10-14T01:00:00Z</published><author><name>André</name></author><summary type="html">MMBase has a simple but effective application for cron jobs named MMBase Crontab. Cron jobs can be scheduled via a configuration file, or just by creating cronjob nodes.</summary><content type="html">MMBase has a simple but effective application for cron jobs named MMBase Crontab. Cron jobs can be scheduled via a configuration file, or just by creating cronjob nodes.&lt;p&gt;The application has a config file at 'config/utils/crontab.xml'. The syntax of jobs is similar to those in cron on Unix et al.&lt;/p&gt;
&lt;p&gt;Values are seperated by a |, in this example: timeschedule (run every morning at 1), Java class to run, a descriptive name and the last part is a piece off configuration to be used by the Java class.&lt;/p&gt;
&lt;pre&gt;&amp;lt;property name=&quot;lucenefullindex&quot;&amp;gt;&lt;br /&gt;  0 1 * * *|org.mmbase.module.lucene.FullIndex|Lucene Full Index|forum&lt;br /&gt;&amp;lt;/property&amp;gt;&lt;/pre&gt;
&lt;p&gt;The following example prints memory usage to the log file every two hours.&lt;/p&gt;
&lt;pre&gt;&amp;lt;property name=&quot;memorystats&quot;&amp;gt;&lt;br /&gt;  0 */2 * * *|org.mmbase.applications.crontab.MMBaseStatsJob||Memory|short&lt;br /&gt;&amp;lt;/property&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;An example config file in the Crontab application itself contains more examples.&lt;/p&gt;&lt;h4&gt;Cron nodes&lt;/h4&gt;&lt;p&gt;Cron jobs can also be made as nodes. Which is even more flexible since you can easily edit them in one of the editors. &lt;br /&gt;The same cron job from the first example but now as a node has the following field values:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;name: Lucene full index&lt;/li&gt;
&lt;li&gt;crontime: 0 1 * * *&lt;/li&gt;
&lt;li&gt;classfile: org.mmbase.module.lucene.FullIndex&lt;/li&gt;
&lt;li&gt;config: forum&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The last field 'config' refers to the index to be done named 'forum', when left empty a full index will run on all indexes.&lt;/p&gt;
&lt;p&gt;When you have multiple MMBase instances clustered on one server, you should relate you cronjobs node to the mmservers node of the server it should run on. Or it will run on all instances, which of course can also be a feature.&lt;/p&gt;&lt;ul&gt;
          &lt;li&gt;
          &lt;a href="http://en.wikipedia.org/wiki/Cron"&gt;Cron on Wikipedia&lt;/a&gt;
          &lt;br /&gt;Explains stuff like '1 0 * * *  printf &gt; /www/apache/logs/error_log'.
          &lt;/li&gt;
          
          &lt;li&gt;
          &lt;a href="http://www.mmbase.org/mmdocs/applications/crontab/crontab.html"&gt;MMBase Crontab documentation&lt;/a&gt;
          &lt;br /&gt;
          &lt;/li&gt;
          &lt;/ul&gt;</content></entry><entry xmlns:media="http://search.yahoo.com/mrss/"><title>Properties on nodes</title><link href="http://www.toly.nl/mmbase/2563/Properties_on_nodes"/><id>http://www.toly.nl/mmbase/2563/Properties_on_nodes</id><updated>2012-05-11T11:57:00Z</updated><published>2011-09-22T01:00:00Z</published><author><name>André</name></author><summary type="html">Properties are a simple way of adding extra values to nodes, often as configuration sometimes when you are short of fields. The default mmbase property implementation can contain key/value pairs.</summary><content type="html">Properties are a simple way of adding extra values to nodes, often as configuration sometimes when you are short of fields. The default mmbase property implementation can contain key/value pairs.&lt;p&gt;Properties themselves are nodes of type 'properties' and like aliasses save a reference to the node they apply to. A properties nodes has a field 'parent' (their node), a field 'name' and field 'value'. Properties are typically used as configuration, by default key and value keep just 255 characters.&lt;/p&gt;
&lt;p&gt;If the MyNews magazine node with alias 'default.mags' would contain properties you could list them as follows. To see some examples you can add them in my_editors at the bottom of the edit node form.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:node number=&quot;default.mags&quot;&amp;gt;  
  &amp;lt;mm:hasfunction name=&quot;list&quot; nodemanager=&quot;properties&quot;&amp;gt;
     &amp;lt;mm:nodelistfunction nodemanager=&quot;properties&quot; name=&quot;list&quot; referids=&quot;_node@node&quot;&amp;gt;
       key &amp;lt;mm:field name=&quot;key&quot; /&amp;gt; 
       value &amp;lt;mm:field name=&quot;value&quot; /&amp;gt;
     &amp;lt;/mm:nodelistfunction&amp;gt;
  &amp;lt;/mm:hasfunction&amp;gt;
&amp;lt;/mm:node&amp;gt;&lt;/pre&gt;
&lt;p&gt;To see an examples you can add a property in my_editors at the bottom of the edit node form.&lt;/p&gt;
&lt;p&gt;Most trafic is done with functions. Looking up a specific property for a node, in this example 'oai-set', is done with 'get'.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:node number=&quot;default.mags&quot;&amp;gt;  
  &amp;lt;mm:import id=&quot;oaikey&quot;&amp;gt;oai-set&amp;lt;/mm:import&amp;gt;
  &amp;lt;mm:function referids=&quot;_node@node,oaikey@key&quot; nodemanager=&quot;properties&quot; name=&quot;get&quot; /&amp;gt;
&amp;lt;/mm:node&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;That will print a properties' value.&lt;/p&gt;&lt;h4&gt;Setting properties&lt;/h4&gt;&lt;p&gt;A property can only exist once on a node. When you save one with the same key on the same node, it's previous value gets overwritten. Saving a node is done with 'set'.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:node number=&quot;default.mags&quot;&amp;gt;  
  &amp;lt;mm:import id=&quot;property_key&quot;&amp;gt;oai-set&amp;lt;/mm:import&amp;gt;
  &amp;lt;mm:import id=&quot;property_value&quot;&amp;gt;A new value&amp;lt;/mm:import&amp;gt;&lt;br /&gt;
  &amp;lt;mm:function referids=&quot;_node@node,property_key@key,property_value@value&quot;
    nodemanager=&quot;properties&quot; name=&quot;set&quot; write=&quot;false&quot; /&amp;gt;
&amp;lt;/mm:node&amp;gt;
&lt;/pre&gt;&lt;h4&gt;Listing properties&lt;/h4&gt;&lt;p&gt;Properties are normal nodes, you can still for example list all properties with a specific key.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:listnodescontainer type=&quot;properties&quot;&amp;gt;
  &amp;lt;mm:constraint field=&quot;key&quot; value=&quot;oai-set&quot; operator=&quot;EQUAL&quot; /&amp;gt;
  &amp;lt;mm:listnodes&amp;gt;
    node &amp;lt;mm:field name=&quot;parent&quot; /&amp;gt;
    key &amp;lt;mm:field name=&quot;key&quot; /&amp;gt;
    value &amp;lt;mm:field name=&quot;value&quot; /&amp;gt;
  &amp;lt;/mm:listnodes&amp;gt;
&amp;lt;/mm:listnodescontainer&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;This prints all key/value pairs and the number they belong to where the key is equal to 'oai-set'.&lt;/p&gt;</content></entry><entry xmlns:media="http://search.yahoo.com/mrss/"><title>Logging with mm:log</title><link href="http://www.toly.nl/mmbase/2428/Logging_with_mm_log"/><id>http://www.toly.nl/mmbase/2428/Logging_with_mm_log</id><updated>2011-09-16T11:02:01Z</updated><published>2011-07-01T01:00:00Z</published><author><name>André</name></author><summary type="html">The mm:log tag can print messages from your templates in the MMBase log file.</summary><content type="html">The mm:log tag can print messages from your templates in the MMBase log file.&lt;p&gt;MMBase page logging is normally set to level info, the following will quite certainly print something in your log file.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:log level=&quot;info&quot;&amp;gt;Log this to the log file&amp;lt;/mm:log&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;Result in 'INFO PAGE.LOGTAG.test.jsp log.49  - 0: Log this to the log file'. When page logging is set to 'service' you may omit the 'level' attribute.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:log&amp;gt;This is print when page logging is set to SERVICE.&amp;lt;/mm:log&amp;gt;&lt;/pre&gt;
But I find it more convenient to use &amp;lt;mm:log level=&quot;info&quot; /&amp;gt; when debugging and delete them when I am done. Variables are shown as follows, for example a parameter named 'param'.&lt;br /&gt;
&lt;pre&gt;&amp;lt;mm:import externid=&quot;param&quot; /&amp;gt;&lt;br /&gt;&amp;lt;mm:log level=&quot;info&quot;&amp;gt;param: ${param}&amp;lt;/mm:log&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;N.B. The 'level' attribute exists since version 1.9 of MMBase. In previous versions you'll need to use the 'jspvar' attribute, for example named 'log' like in the following code snippet.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:import externid=&quot;param&quot; jspvar=&quot;param&quot; vartype=&quot;String&quot; /&amp;gt;&lt;br /&gt;&amp;lt;mm:log jspvar=&quot;log&quot;&amp;gt;&amp;lt;% log.info(&quot;param: &quot; + param); %&amp;gt;&amp;lt;/mm:log&amp;gt;&lt;/pre&gt;&lt;ul&gt;
          &lt;li&gt;
          &lt;a href="http://www.mmbase.org/mmdocs/applications/taglib/build/frontenddevelopers/taglib/reference/log.jsp"&gt;mm:log tag&lt;/a&gt;
          &lt;br /&gt;Tag that logs to MMBase log.
          &lt;/li&gt;
          &lt;/ul&gt;</content></entry><entry xmlns:media="http://search.yahoo.com/mrss/"><title>A dynamic optionlist in the editwizards</title><link href="http://www.toly.nl/mmbase/450/A_dynamic_optionlist_in_the_editwizards"/><id>http://www.toly.nl/mmbase/450/A_dynamic_optionlist_in_the_editwizards</id><updated>2011-05-02T09:20:12Z</updated><published>2011-05-01T00:00:00Z</published><author><name>André</name></author><summary type="html">The infamous EditWizards are used as editors in a lot of mmbase installations. Developed almost 10 years ago by for the VPRO they've evolved in very sophisticated editors. This example shows the creation of a dynamically filled options list including nodes from another nodetype.</summary><content type="html">The infamous EditWizards are used as editors in a lot of mmbase installations. Developed almost 10 years ago by for the VPRO they've evolved in very sophisticated editors. This example shows the creation of a dynamically filled options list including nodes from another nodetype.A 'traditional' non-dynamic optionlist can be made like the following example. Values are hard coded into a list to create a pulldown.&lt;br /&gt;Let's presume you have an editwizard for news articles and you want your editors to choose from a set of 'pools' nodes (you use them as topics or categories) to have them categorize the articles. With a non-dynamic list you have to asign aliases to all pools nodes and order them into a optionlist and include it in the list element of your wizard. &lt;br /&gt;
&lt;pre&gt;&amp;lt;list&amp;gt;&lt;br /&gt;  &amp;lt;optionlist name=&quot;categories_list&quot;&amp;gt;&lt;br /&gt;   &amp;lt;option id=&quot;pool_general&quot;&amp;gt;General&amp;lt;/option&amp;gt;&lt;br /&gt;   &amp;lt;option id=&quot;pool_sports&quot;&amp;gt;Sports&amp;lt;/option&amp;gt;&lt;br /&gt;   &amp;lt;option id=&quot;pool_gossip&quot;&amp;gt;Gossip&amp;lt;/option&amp;gt;&lt;br /&gt;  &amp;lt;/optionlist&amp;gt;&lt;br /&gt;&amp;lt;/list&amp;gt;
&lt;/pre&gt;
A few lines lower in the wizard you use the defined 'pools_list' as follows (a bit arbitrary) in the subtitle field of your article. These lines generate a pull down with your categories.
&lt;pre&gt;&amp;lt;field name=&quot;subtitle&quot; ftype=&quot;enum&quot;&amp;gt;&lt;br /&gt;  &amp;lt;prompt&amp;gt;Category&amp;lt;/prompt&amp;gt;&lt;br /&gt;  &amp;lt;optionlist select=&quot;categories_list&quot;&amp;gt;&amp;lt;/optionlist&amp;gt;&lt;br /&gt;&amp;lt;/field&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;That results in a pulldown that will look more or less like this in plain html:&lt;/p&gt;
&lt;pre&gt;&amp;lt;select name=&quot;field/f_1/d_3&quot; &amp;gt;&lt;br /&gt;  &amp;lt;option value=&quot;&quot;&amp;gt;Select...&amp;lt;/option&amp;gt;&lt;br /&gt;  &amp;lt;option value=&quot;pool_general&quot;&amp;gt;General&amp;lt;/option&amp;gt;&lt;br /&gt;  &amp;lt;option value=&quot;pool_sports&quot;&amp;gt;Sports&amp;lt;/option&amp;gt;&lt;br /&gt;  &amp;lt;option value=&quot;pool_gossip&quot;&amp;gt;Gossip&amp;lt;/option&amp;gt;&lt;br /&gt;&amp;lt;/select&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;h4&gt;The same list made dynamic&lt;/h4&gt;&lt;p&gt;With a bit of xpath magic the needed pools nodes you use as categories can be extracted dynamicaly from mmbase.&lt;/p&gt;
&lt;pre&gt;&amp;lt;lists&amp;gt;&lt;br /&gt;  &amp;lt;optionlist name=&quot;categories_list&quot;&lt;br /&gt;    optionid=&quot;field[@name='number']&quot;&lt;br /&gt;    optioncontent=&quot;field[@name='name']&quot;&amp;gt;&lt;br /&gt;    &amp;lt;query xpath=&quot;/*@pools&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;/optionlist&amp;gt;&lt;br /&gt;&amp;lt;/lists&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;The names of your category or pools nodes are displayed as labels of your options, their nodenumbers become the values. The xpath query &amp;lt;query xpath=&quot;/*@pools&quot; /&amp;gt; queries mmbase for all pools nodes. You include 'categories_list' the same way as we did in the previous example.&lt;/p&gt;
&lt;p&gt;Here is an example of a simple but complete editwizard for a typical mmbase news node that uses it:&lt;/p&gt;
&lt;pre&gt;&amp;lt;?xml version=&quot;1.0&quot;?&amp;gt;&lt;br /&gt;&amp;lt;!DOCTYPE wizard-schema PUBLIC &quot;-//MMBase/DTD editwizard 1.0//EN&quot; &lt;br /&gt;  &quot;http://www.mmbase.org/dtd/wizard-schema_1_0.dtd&quot;&amp;gt;&lt;br /&gt;&amp;lt;wizard-schema&amp;gt;&lt;br /&gt;  &amp;lt;title&amp;gt;News&amp;lt;/title&amp;gt;&lt;br /&gt;  &amp;lt;action type=&quot;create&quot;&amp;gt;&lt;br /&gt;    &amp;lt;object type=&quot;news&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;/action&amp;gt;&lt;br /&gt;  &amp;lt;action type=&quot;load&quot; /&amp;gt;&lt;br /&gt;  &lt;br /&gt;  &amp;lt;lists&amp;gt;&lt;br /&gt;   &amp;lt;!-- create the list with all pools nodes to use as categories --&amp;gt;&lt;br /&gt;   &amp;lt;optionlist name=&quot;categories_list&quot;&lt;br /&gt;      optionid=&quot;field[@name='number']&quot;&lt;br /&gt;      optioncontent=&quot;field[@name='name']&quot;&amp;gt;&lt;br /&gt;      &amp;lt;query xpath=&quot;/*@pools&quot; /&amp;gt;&lt;br /&gt;   &amp;lt;/optionlist&amp;gt;&lt;br /&gt;  &amp;lt;/lists&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;steps&amp;gt;&lt;br /&gt;    &amp;lt;step form-schema=&quot;step1&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;/steps&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;form-schema id=&quot;step1&quot;&amp;gt;&lt;br /&gt;    &amp;lt;title&amp;gt;News&amp;lt;/title&amp;gt;&lt;br /&gt;    &lt;br /&gt;    &amp;lt;field name=&quot;title&quot; ftype=&quot;line&quot;&amp;gt;&lt;br /&gt;      &amp;lt;prompt&amp;gt;Title&amp;lt;/prompt&amp;gt;&lt;br /&gt;    &amp;lt;/field&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;!-- subtitle is misused to contain a category --&amp;gt;&lt;br /&gt;    &amp;lt;field name=&quot;subtitle&quot; ftype=&quot;enum&quot;&amp;gt;&lt;br /&gt;      &amp;lt;prompt&amp;gt;Subtitle&amp;lt;/prompt&amp;gt;&lt;br /&gt;      &amp;lt;optionlist select=&quot;categories_list&quot;&amp;gt;&amp;lt;/optionlist&amp;gt;&lt;br /&gt;    &amp;lt;/field&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;field name=&quot;intro&quot; ftype=&quot;text&quot;&amp;gt;&lt;br /&gt;      &amp;lt;prompt&amp;gt;Intro&amp;lt;/prompt&amp;gt;&lt;br /&gt;    &amp;lt;/field&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;field name=&quot;body&quot; ftype=&quot;text&quot;&amp;gt;&lt;br /&gt;      &amp;lt;prompt&amp;gt;Tekst&amp;lt;/prompt&amp;gt;&lt;br /&gt;    &amp;lt;/field&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;/form-schema&amp;gt;  &lt;br /&gt;&amp;lt;/wizard-schema&amp;gt;&lt;br /&gt;&lt;/pre&gt;</content></entry><entry xmlns:media="http://search.yahoo.com/mrss/"><title>Default dates and times</title><link href="http://www.toly.nl/mmbase/428/Default_dates_and_times"/><id>http://www.toly.nl/mmbase/428/Default_dates_and_times</id><updated>2010-09-22T10:26:11Z</updated><published>2010-09-22T00:00:00Z</published><author><name>André</name></author><summary type="html">Setting the creation or a last modification date and time of a node is quite easy with mmbase datatypes.</summary><content type="html">Setting the creation or a last modification date and time of a node is quite easy with mmbase datatypes.&lt;p&gt;A creation date can be based on a pre-defined mmbase datatype.&lt;/p&gt;
&lt;pre&gt;&amp;lt;field name=&quot;created&quot; readonly=&quot;true&quot;&amp;gt;&lt;br /&gt;  &amp;lt;descriptions&amp;gt;&lt;br /&gt;    &amp;lt;description xml:lang=&quot;en&quot;&amp;gt;Creation date of this item&amp;lt;/description&amp;gt;&lt;br /&gt;    &amp;lt;description xml:lang=&quot;nl&quot;&amp;gt;Creatiedatum van het item&amp;lt;/description&amp;gt;&lt;br /&gt;  &amp;lt;/descriptions&amp;gt;&lt;br /&gt;  &amp;lt;gui&amp;gt;&lt;br /&gt;    &amp;lt;guiname xml:lang=&quot;en&quot;&amp;gt;Created&amp;lt;/guiname&amp;gt;&lt;br /&gt;    &amp;lt;guiname xml:lang=&quot;nl&quot;&amp;gt;Aangemaakt&amp;lt;/guiname&amp;gt;&lt;br /&gt;  &amp;lt;/gui&amp;gt;&lt;br /&gt;  &amp;lt;editor&amp;gt;&lt;br /&gt;    &amp;lt;positions&amp;gt;&lt;br /&gt;      &amp;lt;input&amp;gt;9&amp;lt;/input&amp;gt;&lt;br /&gt;      &amp;lt;list&amp;gt;9&amp;lt;/list&amp;gt;&lt;br /&gt;      &amp;lt;search&amp;gt;9&amp;lt;/search&amp;gt;&lt;br /&gt;    &amp;lt;/positions&amp;gt;&lt;br /&gt;  &amp;lt;/editor&amp;gt;&lt;br /&gt;  &amp;lt;datatype base=&quot;created&quot; xmlns=&quot;http://www.mmbase.org/xmlns/datatypes&quot;&amp;gt;&lt;br /&gt;    &amp;lt;default value=&quot;now&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;/datatype&amp;gt;&lt;br /&gt;&amp;lt;/field&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;When the builder is first installed a datetime field is created in your database and the datatype code in mmbase makes sure its correctly filled. Whenever a new node of this type is made the date and time are set upon the default value 'now'.&lt;/p&gt;
&lt;p&gt;Last modification dates and times are just as easy.&lt;/p&gt;
&lt;pre&gt;&amp;lt;field name=&quot;lastmodified&quot; readonly=&quot;true&quot;&amp;gt;&lt;br /&gt;  &amp;lt;descriptions&amp;gt;&lt;br /&gt;    &amp;lt;description xml:lang=&quot;en&quot;&amp;gt;Date and time the item was last modified&amp;lt;/description&amp;gt;&lt;br /&gt;    &amp;lt;description xml:lang=&quot;nl&quot;&amp;gt;Datum en tijd waarop het item het laatst werd gewijzigd&amp;lt;/description&amp;gt;&lt;br /&gt;  &amp;lt;/descriptions&amp;gt;&lt;br /&gt;  &amp;lt;gui&amp;gt;&lt;br /&gt;    &amp;lt;guiname xml:lang=&quot;en&quot;&amp;gt;Lastmodified&amp;lt;/guiname&amp;gt;&lt;br /&gt;    &amp;lt;guiname xml:lang=&quot;nl&quot;&amp;gt;Laatst veranderd&amp;lt;/guiname&amp;gt;&lt;br /&gt;  &amp;lt;/gui&amp;gt;&lt;br /&gt;  &amp;lt;editor&amp;gt;&lt;br /&gt;    &amp;lt;positions&amp;gt;&lt;br /&gt;      &amp;lt;input&amp;gt;8&amp;lt;/input&amp;gt;&lt;br /&gt;      &amp;lt;search&amp;gt;8&amp;lt;/search&amp;gt;&lt;br /&gt;    &amp;lt;/positions&amp;gt;&lt;br /&gt;  &amp;lt;/editor&amp;gt;&lt;br /&gt;  &amp;lt;datatype base=&quot;lastmodified&quot; xmlns=&quot;http://www.mmbase.org/xmlns/datatypes&quot; /&amp;gt;&lt;br /&gt;&amp;lt;/field&amp;gt;&lt;/pre&gt;
&lt;p&gt;Whenever a node is modified its modification date is altered. Both the 'created' and 'lastmodified' example are of course read-only fields which can not be modified by users.&lt;/p&gt;&lt;h4&gt;A 'normal' date field&lt;/h4&gt;&lt;p&gt;A more generic use of a date is for example when an item is or should be published. This one should not be set automatically but by a user.&lt;/p&gt;
&lt;pre&gt;&amp;lt;field name=&quot;date&quot;&amp;gt;&lt;br /&gt;  &amp;lt;descriptions&amp;gt;&lt;br /&gt;    &amp;lt;description xml:lang=&quot;nl&quot;&amp;gt;Tijd en publicatiedatum van dit item&amp;lt;/description&amp;gt;&lt;br /&gt;    &amp;lt;description xml:lang=&quot;en&quot;&amp;gt;Date and publish time of this item&amp;lt;/description&amp;gt;&lt;br /&gt;  &amp;lt;/descriptions&amp;gt;&lt;br /&gt;  &amp;lt;gui&amp;gt;&lt;br /&gt;    &amp;lt;guiname xml:lang=&quot;nl&quot;&amp;gt;Datum&amp;lt;/guiname&amp;gt;&lt;br /&gt;    &amp;lt;guiname xml:lang=&quot;en&quot;&amp;gt;Date&amp;lt;/guiname&amp;gt;&lt;br /&gt;  &amp;lt;/gui&amp;gt;&lt;br /&gt;  &amp;lt;editor&amp;gt;&lt;br /&gt;    &amp;lt;positions&amp;gt;&lt;br /&gt;      &amp;lt;input&amp;gt;8&amp;lt;/input&amp;gt;&lt;br /&gt;      &amp;lt;list&amp;gt;8&amp;lt;/list&amp;gt;&lt;br /&gt;      &amp;lt;search&amp;gt;8&amp;lt;/search&amp;gt;&lt;br /&gt;    &amp;lt;/positions&amp;gt;&lt;br /&gt;  &amp;lt;/editor&amp;gt;&lt;br /&gt;  &amp;lt;datatype base=&quot;datetime&quot; xmlns=&quot;http://www.mmbase.org/xmlns/datatypes&quot;&amp;gt;&lt;br /&gt;    &amp;lt;default value=&quot;today&quot; /&amp;gt;&lt;br /&gt;    &amp;lt;minInclusive enforce=&quot;never&quot; value=&quot;today - 10 year&quot; /&amp;gt;&lt;br /&gt;    &amp;lt;maxInclusive enforce=&quot;never&quot; value=&quot;today + 99 year&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;/datatype&amp;gt;&lt;br /&gt;&amp;lt;/field&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;When a node it belongs to is first created it gets the date and time of creation, because normally a publication date would not differ very from its creation date. But in stead of just a string being printed the user is offered various pulldowns to change year, month, day and time. To limit the length of the pulldown with years, which can in theory be infinite, it ranges from 10 years before this year ('minInclusive') untill 99 years from this year ('maxInclusive').&lt;/p&gt;
&lt;p&gt;More information about defining builders for nodetypes in mmbase, like for example last creator or last modifier, can be found in the mmdocs.&lt;/p&gt;&lt;ul&gt;
          &lt;li&gt;
          &lt;a href="http://www.mmbase.org/mmdocs/informationanalysts/builders.html"&gt;Builder configuration&lt;/a&gt;
          &lt;br /&gt;Documentation about the configuration and definition of mmbase node (object) types .
          &lt;/li&gt;
          
          &lt;li&gt;
          &lt;a href="http://www.mmbase.org/mmdocs/informationanalysts/datatypes.html"&gt;Datatypes in mmbase&lt;/a&gt;
          &lt;br /&gt;From binary to xml, either default or unique
          &lt;/li&gt;
          &lt;/ul&gt;</content></entry><entry xmlns:media="http://search.yahoo.com/mrss/"><title>HTML5 jspx template</title><link href="http://www.toly.nl/mmbase/1896/HTML5_jspx_template"/><id>http://www.toly.nl/mmbase/1896/HTML5_jspx_template</id><updated>2010-07-20T10:24:43Z</updated><published>2010-07-20T00:00:00Z</published><author><name>André</name></author><summary type="html">A jspx is normally used to produce xhtml. It is possible though to write valid HTML5 documents.&lt;br /&gt;</summary><content type="html">A jspx is normally used to produce xhtml. It is possible though to write valid HTML5 documents.&lt;br /&gt;&lt;p&gt;After some Googling I found that to have a jspx to output valid HTML5 you'll need these jspx headers and page directives.&lt;/p&gt;
&lt;pre&gt;&amp;lt;jsp:root &lt;br /&gt;    xmlns:jsp=&quot;http://java.sun.com/JSP/Page&quot;&lt;br /&gt;    xmlns:c=&quot;http://java.sun.com/jsp/jstl/core&quot;&lt;br /&gt;    xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&lt;br /&gt;    version=&quot;2.0&quot;&amp;gt;&lt;br /&gt;    &lt;br /&gt;  &amp;lt;jsp:directive.page contentType=&quot;text/html&quot; pageEncoding=&quot;UTF-8&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;jsp:output omit-xml-declaration=&quot;true&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;jsp:output doctype-root-element=&quot;HTML&quot; &lt;br /&gt;              doctype-system=&quot;about:legacy-compat&quot; /&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;It generates html with a proper DOCTYPE for HTML5.&lt;/p&gt;
&lt;pre&gt;&amp;lt;!DOCTYPE HTML SYSTEM &quot;about:legacy-compat&quot;&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;The parts 'SYSTEM' and 'about:legacy-compat' are not really needed but come with the trade. When writing the HTML5 specifications the working group kept in mind that some html generators needed such a DOCTYPE legacy string.&lt;/p&gt;&lt;h4&gt;Template&lt;/h4&gt;&lt;p&gt;A bare jspx template would look like this.&lt;/p&gt;
&lt;pre&gt;&amp;lt;jsp:root &lt;br /&gt;    xmlns:jsp=&quot;http://java.sun.com/JSP/Page&quot;&lt;br /&gt;    xmlns:c=&quot;http://java.sun.com/jsp/jstl/core&quot;&lt;br /&gt;    xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&lt;br /&gt;    version=&quot;2.0&quot;&amp;gt;&lt;br /&gt;    &lt;br /&gt;  &amp;lt;jsp:directive.page contentType=&quot;text/html&quot; pageEncoding=&quot;UTF-8&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;jsp:output omit-xml-declaration=&quot;true&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;jsp:output doctype-root-element=&quot;HTML&quot; &lt;br /&gt;              doctype-system=&quot;about:legacy-compat&quot; /&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;html lang=&quot;en&quot;&amp;gt;&lt;br /&gt;    &amp;lt;head&amp;gt;&lt;br /&gt;      &amp;lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot; /&amp;gt;&lt;br /&gt;      &amp;lt;title&amp;gt;HTML5&amp;lt;/title&amp;gt;&lt;br /&gt;    &amp;lt;/head&amp;gt;&lt;br /&gt;    &amp;lt;body&amp;gt;&lt;br /&gt;      &amp;lt;h1&amp;gt;HTML5&amp;lt;/h1&amp;gt;&lt;br /&gt;    &amp;lt;/body&amp;gt;&lt;br /&gt;  &amp;lt;/html&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/jsp:root&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;h4&gt;MMBase HTML5 template&lt;/h4&gt;&lt;p&gt;And a template to use with mmbase taglib.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:content&lt;br /&gt;      expires=&quot;120&quot;&lt;br /&gt;      type=&quot;text/html&quot; &lt;br /&gt;      encoding=&quot;UTF-8&quot;&lt;br /&gt;      xmlns:jsp=&quot;http://java.sun.com/JSP/Page&quot;&lt;br /&gt;      xmlns:c=&quot;http://java.sun.com/jsp/jstl/core&quot;&lt;br /&gt;      xmlns:mm=&quot;http://www.mmbase.org/mmbase-taglib-2.0&quot;&lt;br /&gt;      postprocessor=&quot;none&quot;&amp;gt;&lt;br /&gt;    &amp;lt;jsp:output omit-xml-declaration=&quot;true&quot; /&amp;gt;&lt;br /&gt;    &amp;lt;jsp:output doctype-root-element=&quot;HTML&quot; &lt;br /&gt;                doctype-system=&quot;about:legacy-compat&quot; /&amp;gt;&lt;br /&gt;    &lt;br /&gt;&amp;lt;mm:cloud&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;  &amp;lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;title&amp;gt;HTML5&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;  &amp;lt;h1&amp;gt;HTML5&amp;lt;/h1&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/mm:cloud&amp;gt;&lt;br /&gt;&amp;lt;/mm:content&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;It results in a page with a 120 seconds expire header.&lt;/p&gt;&lt;ul&gt;
          &lt;li&gt;
          &lt;a href="http://dev.w3.org/html5/spec/syntax.html#the-doctype"&gt;HTML5 doctype&lt;/a&gt;
          &lt;br /&gt;Syntax of the HTML5 DOCTYPE
          &lt;/li&gt;
          
          &lt;li&gt;
          &lt;a href="http://html5.validator.nu"&gt;HTML5 validator&lt;/a&gt;
          &lt;br /&gt;Validates HTML5 documents
          &lt;/li&gt;
          &lt;/ul&gt;</content></entry><entry xmlns:media="http://search.yahoo.com/mrss/"><title>Compilation of my most favorite escapers</title><link href="http://www.toly.nl/mmbase/1844/Compilation_of_my_most_favorite_escapers"/><id>http://www.toly.nl/mmbase/1844/Compilation_of_my_most_favorite_escapers</id><updated>2011-10-26T14:32:13Z</updated><published>2010-06-28T00:00:00Z</published><author><name>André</name></author><summary type="html">The taglib has several useful escapers for formatting text. These are some of my favorite and most used.</summary><content type="html">The taglib has several useful escapers for formatting text. These are some of my favorite and most used.&lt;p&gt;The 'escaper' attribute on mmbase tags that write values and the &amp;lt;mm:escaper /&amp;gt; itself have some great and useful ways to format text, these are the ones I used most. Most of the documentation of the escapers can  -besides &amp;lt;mm:escaper /&amp;gt; -  be found in the taglib documentation of &amp;lt;mm:content /&amp;gt;.&lt;/p&gt;
&lt;p&gt;Substring a sentence to 32 characters and append ... as ellipsis.&lt;/p&gt;
&lt;pre&gt;&amp;lt;!-- define an escaper --&amp;gt;&lt;br /&gt;&amp;lt;mm:escaper type=&quot;substring&quot; id=&quot;wrapper&quot;&amp;gt;&lt;br /&gt;  &amp;lt;mm:param name=&quot;from&quot; value=&quot;0&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;mm:param name=&quot;to&quot; value=&quot;32&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;mm:param name=&quot;ellipsis&quot; value=&quot;...&quot; /&amp;gt;&lt;br /&gt;&amp;lt;/mm:escaper&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!-- use it on a field named 'intro' --&amp;gt;&lt;br /&gt;&amp;lt;mm:field name=&quot;intro&quot; escape=&quot;wrapper&quot; /&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;Wrap the intro of an article in paragraph tags when needed and append a class named 'intro'.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:field name=&quot;intro&quot; escape=&quot;paragraph(intro)&quot; /&amp;gt;&lt;/pre&gt;
&lt;p&gt;Sometimes an editor for a contains html-editor which write &amp;lt;p&amp;gt; ... intro here ... &amp;lt;/p&amp;gt;, when it does this escaper will omit adding the paragraph tags. The result:&lt;/p&gt;
&lt;pre&gt;&amp;lt;p class=&quot;intro&quot;&amp;gt;Hi, I'm the intro.&amp;lt;/p&amp;gt;&lt;/pre&gt;
&lt;p&gt;Another one I use often is the 'links' escaper:&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:field name=&quot;text&quot; escape=&quot;links&quot; /&amp;gt;&lt;/pre&gt;
&lt;p&gt;Any link within the text, like for example www.toly.nl or written like http://www.toly.nl/, are automagically recognized and are wrapped in a link tag. Most escapers, when it makes sense of course, can be combined this one and the previous example.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:field name=&quot;text&quot; escape=&quot;paragraph,links&quot; /&amp;gt;&lt;/pre&gt;
&lt;p&gt;There is also an escaper that removes tags in stead of adding them.&lt;/p&gt;
&lt;pre&gt;&amp;lt;!-- define the escape with id 'stripper' --&amp;gt;&lt;br /&gt;&amp;lt;mm:escaper type=&quot;tagstripper&quot; id=&quot;stripper&quot;&amp;gt;&lt;br /&gt;  &amp;lt;mm:param name=&quot;escapeamps&quot; value=&quot;false&quot; /&amp;gt;&lt;br /&gt;&amp;lt;/mm:escaper&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!-- strip all html-tags from field 'intro' --&amp;gt;&lt;br /&gt;&amp;lt;mm:field name=&quot;intro&quot; escape=&quot;stripper&quot; /&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;I will keep updating this page with more examples, partly as a reference for myself.&lt;/p&gt;&lt;h4&gt;Escape and un-escape an url&lt;/h4&gt;&lt;p&gt;MMBase its &amp;lt;mm:link /&amp;gt; and &amp;lt;mm:url /&amp;gt; tag escape url's by default. Consider for example:&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:import id=&quot;first&quot;&amp;gt;first value&amp;lt;/mm:import&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;mm:link page=&quot;http://www.toly.nl/&quot; referids=&quot;first&quot;&amp;gt;&lt;br /&gt;  ${_}&lt;br /&gt;&amp;lt;/mm:link&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;Which will print &quot;http://www.toly.nl/?first=first+value&quot;.&lt;br /&gt;The &amp;lt;mm:import externid=&quot;..&quot; /&amp;gt; tag escapes it automatically back for you when you import the value into another page:&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:import externid=&quot;first&quot; /&amp;gt;&lt;br /&gt;&amp;lt;mm:write referid=&quot;first&quot; /&amp;gt;&lt;/pre&gt;
&lt;p&gt;But when that's not possible you need to define an escaper first and invert it before use.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:escaper referid=&quot;url&quot; inverse=&quot;true&quot; id=&quot;undo_url_escaping&quot; /&amp;gt;&lt;br /&gt;&amp;lt;mm:write referid=&quot;first&quot; id=&quot;undo_url_escaping&quot; /&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;That prints &quot;first value&quot; in stead of &quot;first+value&quot;.&lt;/p&gt;&lt;h4&gt;Encrypt and decrypt a string&lt;/h4&gt;&lt;p&gt;This example uses encryption. This escape works both ways, first create an escaper to encrypt strings.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:escaper id=&quot;encrypter&quot; type=&quot;encryption&quot;&amp;gt;
  &amp;lt;mm:param name=&quot;algorithm&quot; value=&quot;Blowfish&quot; /&amp;gt;
  &amp;lt;mm:param name=&quot;format&quot; value=&quot;hex&quot; /&amp;gt;
  &amp;lt;mm:param name=&quot;direction&quot; value=&quot;encrypt&quot; /&amp;gt;
&amp;lt;/mm:escaper&amp;gt;&lt;/pre&gt;
&lt;p&gt;And an escaper to decrypt them again.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:escaper id=&quot;decrypter&quot; type=&quot;encryption&quot;&amp;gt;
  &amp;lt;mm:param name=&quot;algorithm&quot; value=&quot;Blowfish&quot; /&amp;gt;
  &amp;lt;mm:param name=&quot;format&quot; value=&quot;hex&quot; /&amp;gt;
  &amp;lt;mm:param name=&quot;direction&quot; value=&quot;decrypt&quot; /&amp;gt;
&amp;lt;/mm:escaper&amp;gt;&lt;/pre&gt;
&lt;p&gt;It can be used like this.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:import id=&quot;str&quot; reset=&quot;true&quot;&amp;gt;pindakaas!&amp;lt;/mm:import&amp;gt;
&amp;lt;mm:import id=&quot;encrypted_str&quot; reset=&quot;true&quot;&amp;gt;&amp;lt;mm:write referid=&quot;str&quot; escape=&quot;encrypter&quot; /&amp;gt;&amp;lt;/mm:import&amp;gt;
encrypted: &amp;lt;mm:write referid=&quot;encrypted_str&quot; /&amp;gt;
decrypted: &amp;lt;mm:write referid=&quot;encrypted_str&quot; escape=&quot;decrypter&quot; /&amp;gt;&lt;/pre&gt;
&lt;p&gt;Prints for example &quot;encrypted: eeaa7a3568ab38de680bd9c63dc10527 decrypted: pindakaas!&quot;. Other encryption algorithms include 'AES' and 'DES', the formats can be 'hex' and 'base64', see the &amp;lt;mm:escaper /&amp;gt; docs.&lt;/p&gt;&lt;ul&gt;
          &lt;li&gt;
          &lt;a href="http://www.mmbase.org/mmdocs/applications/taglib/build/frontenddevelopers/taglib/reference/content.jsp"&gt;&lt;mm:content /&gt;&lt;/a&gt;
          &lt;br /&gt;Documents not only &lt;mm:content /&gt; but more importantly several attributes like 'type' and 'escaper' that are shared with a lot of other tags.
          &lt;/li&gt;
          
          &lt;li&gt;
          &lt;a href="http://www.mmbase.org/mmdocs/applications/taglib/build/frontenddevelopers/taglib/reference/escaper.jsp"&gt;&lt;mm:escaper /&gt;&lt;/a&gt;
          &lt;br /&gt;Escaper tag in the MMBase taglibrary
          &lt;/li&gt;
          &lt;/ul&gt;</content></entry><entry xmlns:media="http://search.yahoo.com/mrss/"><title>Add an image to an article</title><link href="http://www.toly.nl/mmbase/1786/Add_an_image_to_an_article"/><id>http://www.toly.nl/mmbase/1786/Add_an_image_to_an_article</id><updated>2010-06-01T22:50:26Z</updated><published>2010-06-01T00:00:00Z</published><author><name>André</name></author><summary type="html">MMBase has powerful image features, especially with the aid of ImageMagick. In this example I'll show an article with a related image.</summary><content type="html">MMBase has powerful image features, especially with the aid of ImageMagick. In this example I'll show an article with a related image.&lt;p&gt;MMBase depends on external software to size and modify images, most often ImageMagick but JAI (Java Advanced Imaging) can also be used. ImageMagick is default, take a look at the &lt;a title=&quot;builder configuration file images.xml in svn&quot; href=&quot;https://scm.mmbase.org/mmbase/trunk/applications/resources/src/main/config/builders/resources/images.xml&quot;&gt;comments in the images builder&lt;/a&gt; if you like to use JAI.&lt;/p&gt;
&lt;p&gt;Images are converted and displayed using the &amp;lt;mm:image /&amp;gt; tag. It can &quot;template&quot; the image for example to a certain width and height, and it can convert an image to other formats. Users can upload an image as a jpeg, but you can configure mmbase to convert them all to png to be displayed on the frontend. Images are only generated once and saved in cache, in a 'icaches' node.&lt;/p&gt;
&lt;p&gt;One of the new nodes in the MyNews example has an alias 'a.news.article'. Let's retreive it to use as an example.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:node number=&quot;a.news.article&quot;&amp;gt;&lt;br /&gt;  &amp;lt;h2&amp;gt;&amp;lt;mm:field name=&quot;title&quot; /&amp;gt;&amp;lt;/h2&amp;gt;&lt;br /&gt;  &amp;lt;h3&amp;gt;&amp;lt;mm:field name=&quot;date&quot;&amp;gt;&amp;lt;mm:time format=&quot;dd-MM-yyyy&quot; /&amp;gt;&amp;lt;/mm:field&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;  &amp;lt;p&amp;gt;&amp;lt;mm:field name=&quot;intro&quot; /&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;&amp;lt;/mm:node&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;Now we need an image.&lt;/p&gt;&lt;h4&gt;Upload and relate an image&lt;/h4&gt;Upload an image  in one of mmbase's generic editors. Relate it to the news article.&lt;br /&gt;&lt;h4&gt;&lt;mm:images /&gt;&lt;/h4&gt;&lt;p&gt;I think the most common and easy way to use the tag is like:&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:image mode=&quot;img&quot; template=&quot;s(200)&quot; /&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;With just two attributes: 'mode' produces either an url to our image, the height and width or the html image tag, 'template' contains command altering the image. In this is example the image is resized to a width of 200 pixels, the height is adjusted accordingly.&lt;/p&gt;
&lt;pre&gt;&amp;lt;img width=&quot;200&quot; height=&quot;133&quot; &lt;br /&gt;     title=&quot;Dirt&quot; alt=&quot;Dirt&quot; &lt;br /&gt;     src=&quot;/mmbase/images/613/02dirt650.5.jpg&quot; /&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;It contains its heigth, width, and both a title and an alt attribute. The url points to the mmbase images servlet serving the image resized by ImageMagick or JAI.&lt;/p&gt;&lt;h4&gt;Add &lt;mm:images /&gt; to the article&lt;/h4&gt;Integrate it with a &amp;lt;mm:relatednodes /&amp;gt; tag in the article.
&lt;pre&gt;&amp;lt;mm:node number=&quot;a.news.article&quot;&amp;gt;&lt;br /&gt;  &amp;lt;h2&amp;gt;&amp;lt;mm:field name=&quot;title&quot; /&amp;gt;&amp;lt;/h2&amp;gt;&lt;br /&gt;  &amp;lt;h3&amp;gt;&amp;lt;mm:field name=&quot;date&quot;&amp;gt;&amp;lt;mm:time format=&quot;dd-MM-yyyy&quot; /&amp;gt;&amp;lt;/mm:field&amp;gt;&amp;lt;/h3&amp;gt;&lt;br /&gt;  &lt;br /&gt;  &amp;lt;!-- related image --&amp;gt;&lt;br /&gt;  &amp;lt;mm:relatednodes type=&quot;images&quot;&amp;gt;&lt;br /&gt;    &amp;lt;mm:image mode=&quot;img&quot; template=&quot;s(200)&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;/mm:relatednodes&amp;gt;&lt;br /&gt;  &lt;br /&gt;  &amp;lt;p&amp;gt;&amp;lt;mm:field name=&quot;intro&quot; /&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;&amp;lt;/mm:node&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;Next you can do all kinds of fancy stuff with ImageMagick commands, like:&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:image mode=&quot;img&quot; template=&quot;s(200)+swirl(100)&quot; /&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;h4&gt;It generates a new image based on the original uploaded image, but with a twist. The &lt;a href=&quot;http://www.mmbase.org/mmdocs/applications/taglib/build/frontenddevelopers/taglib/reference/image.jsp&quot;&gt;taglib  documentation of &amp;lt;mm:images /&amp;gt;&lt;/a&gt; has more examples.&lt;ul&gt;
          &lt;li&gt;
          &lt;a href="http://java.sun.com/javase/technologies/desktop/media/"&gt;JAI&lt;/a&gt;
          &lt;br /&gt;Java Advanced Imaging
          &lt;/li&gt;
          
          &lt;li&gt;
          &lt;a href="http://www.imagemagick.org"&gt;ImageMagick&lt;/a&gt;
          &lt;br /&gt;
          &lt;/li&gt;
          
          &lt;li&gt;
          &lt;a href="http://www.mmbase.org/mmdocs/applications/taglib/build/frontenddevelopers/taglib/reference/image.jsp"&gt;Images tag&lt;/a&gt;
          &lt;br /&gt;MMBase images tag doc
          &lt;/li&gt;
          &lt;/ul&gt;</content></entry><entry xmlns:media="http://search.yahoo.com/mrss/"><title>Related nodes</title><link href="http://www.toly.nl/mmbase/1714/Related_nodes"/><id>http://www.toly.nl/mmbase/1714/Related_nodes</id><updated>2010-05-14T22:49:17Z</updated><published>2010-05-13T00:00:00Z</published><author><name>André</name></author><summary type="html">Revisiting the MyNews application, now including its related articles and how to display them with the mmbase taglib.</summary><content type="html">Revisiting the MyNews application, now including its related articles and how to display them with the mmbase taglib.&lt;p&gt;MMBase is all about nodes, but even more about their relations with other nodes. This example shows you how to do this in a template. Building upon the example of the tip #12 I have added an unordered list with a &amp;lt;mm:relatednodes /&amp;gt; tag.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:node number=&quot;default.mags&quot;&amp;gt;&lt;br /&gt;  &amp;lt;h1&amp;gt;&amp;lt;mm:field name=&quot;title&quot; /&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;  &amp;lt;mm:field name=&quot;intro&quot; escape=&quot;paragraph&quot; /&amp;gt;&lt;br /&gt;  &lt;br /&gt;  &amp;lt;ul&amp;gt;&lt;br /&gt;    &amp;lt;mm:relatednodes type=&quot;news&quot; &lt;br /&gt;                     role=&quot;posrel&quot; &lt;br /&gt;                     searchdir=&quot;destination&quot;&amp;gt;&lt;br /&gt;      &amp;lt;li&amp;gt;&amp;lt;mm:field name=&quot;title&quot; /&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;    &amp;lt;/mm:relatednodes&amp;gt;&lt;br /&gt;  &amp;lt;/ul&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/mm:node&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;h4&gt;I have specified three attributes: type=&quot;news&quot; meaning that I want  related news nodes, role=&quot;posrel&quot; which is the kind of relation by which  the articles are attached to the magazine node, and  searchdir=&quot;destination&quot; a saveguard to prevent database queries  traversing tables in both directions.&lt;br /&gt;Withing the &amp;lt;mm:relatednodes  /&amp;gt; the news node are available as normal nodes like in a &amp;lt;mm:node  /&amp;gt; tag.&lt;h4&gt;Relatednodes container&lt;/h4&gt;&lt;p&gt;The example shows the articles titles in a rather unpredictable order. By  using the attribute 'orderby' you can specify a field to use to order  the articles, but it is generally considered wiser to use the  &amp;lt;mm:relatednodescontainer /&amp;gt; since it provides more flexiblity  building the query.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:node number=&quot;default.mags&quot;&amp;gt;  &lt;br /&gt;  &amp;lt;h1&amp;gt;&amp;lt;mm:field name=&quot;title&quot; /&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;  &amp;lt;mm:field name=&quot;intro&quot; escape=&quot;paragraph&quot; /&amp;gt;&lt;br /&gt;  &lt;br /&gt;  &amp;lt;mm:relatednodescontainer type=&quot;news&quot; &lt;br /&gt;                            role=&quot;posrel&quot; &lt;br /&gt;                            searchdirs=&quot;destination&quot;&amp;gt;&lt;br /&gt;    &amp;lt;mm:sortorder field=&quot;date&quot; direction=&quot;DOWN&quot; /&amp;gt;&lt;br /&gt;    &lt;br /&gt;    &amp;lt;ul&amp;gt;&lt;br /&gt;    &amp;lt;mm:relatednodes&amp;gt;&lt;br /&gt;      &amp;lt;li&amp;gt;&lt;br /&gt;        &amp;lt;mm:field name=&quot;date&quot;&amp;gt;&amp;lt;mm:time format=&quot;dd-MM-yyyy&quot; /&amp;gt; - &amp;lt;/mm:field&amp;gt;&lt;br /&gt;        &amp;lt;mm:field name=&quot;title&quot; /&amp;gt;&lt;br /&gt;      &amp;lt;/li&amp;gt;&lt;br /&gt;    &amp;lt;/mm:relatednodes&amp;gt;&lt;br /&gt;    &amp;lt;/ul&amp;gt;&lt;br /&gt;    &lt;br /&gt;  &amp;lt;/mm:relatednodescontainer&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/mm:node&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;I have included a &amp;lt;mm:sortorder /&amp;gt; tag that uses the 'date'  field of every news node to sort them in descending order. A  &amp;lt;mm:relatednodescontainer /&amp;gt; has the same set of attributes as  &amp;lt;mm:relatednodes /&amp;gt; except for 'searchdir' which became  'searchdirs' making it congruent with the other container tag.&lt;br /&gt;It has  the following result.&lt;/p&gt;
&lt;pre&gt;&amp;lt;h1&amp;gt;MyNews magazine&amp;lt;/h1&amp;gt;&lt;br /&gt;&amp;lt;p&amp;gt;This MyNews magazine is an example of news articles in a magazine.&amp;lt;/p&amp;gt;&lt;br /&gt;&amp;lt;ul&amp;gt;&lt;br /&gt;  &amp;lt;li&amp;gt;29-06-2000 - XML based MMBase distribution&amp;lt;/li&amp;gt;&lt;br /&gt;  &amp;lt;li&amp;gt;26-06-2000 - Pinkpop was no problem for MMBase&amp;lt;/li&amp;gt;&lt;br /&gt;  &amp;lt;li&amp;gt;25-05-2000 - Broadcaster EO chooses MMBase&amp;lt;/li&amp;gt;&lt;br /&gt;  &amp;lt;li&amp;gt;12-05-2000 - MMBase Community Meeting&amp;lt;/li&amp;gt;&lt;br /&gt;  &amp;lt;li&amp;gt;27-03-2000 - MMBase goes OpenSource&amp;lt;/li&amp;gt;&lt;br /&gt;&amp;lt;/ul&amp;gt;&lt;/pre&gt;&lt;h4&gt;Complete example&lt;/h4&gt;&lt;p&gt;To copy and paste.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:content &lt;br /&gt;    xmlns:jsp=&quot;http://java.sun.com/JSP/Page&quot;&lt;br /&gt;    xmlns:mm=&quot;http://www.mmbase.org/mmbase-taglib-2.0&quot;&lt;br /&gt;    expires=&quot;120&quot; postprocessor=&quot;none&quot; type=&quot;text/html&quot;&amp;gt;&lt;br /&gt;&amp;lt;jsp:output omit-xml-declaration=&quot;true&quot; /&amp;gt;&lt;br /&gt;&amp;lt;mm:cloud&amp;gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;  &amp;lt;title&amp;gt;MyNews&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;mm:node number=&quot;default.mags&quot;&amp;gt;&lt;br /&gt;  &amp;lt;h1&amp;gt;&amp;lt;mm:field name=&quot;title&quot; /&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;  &amp;lt;mm:field name=&quot;intro&quot; escape=&quot;paragraph&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;mm:relatednodescontainer type=&quot;news&quot; role=&quot;posrel&quot; searchdirs=&quot;destination&quot;&amp;gt;&lt;br /&gt;    &amp;lt;mm:sortorder field=&quot;date&quot; direction=&quot;DOWN&quot; /&amp;gt;&lt;br /&gt;    &amp;lt;ul&amp;gt;&lt;br /&gt;    &amp;lt;mm:relatednodes&amp;gt;&lt;br /&gt;      &amp;lt;li&amp;gt;&lt;br /&gt;        &amp;lt;mm:field name=&quot;date&quot;&amp;gt;&amp;lt;mm:time format=&quot;dd-MM-yyyy&quot; /&amp;gt;&amp;lt;/mm:field&amp;gt;&lt;br /&gt;        - &amp;lt;mm:field name=&quot;title&quot; /&amp;gt;&lt;br /&gt;      &amp;lt;/li&amp;gt;&lt;br /&gt;    &amp;lt;/mm:relatednodes&amp;gt;&lt;br /&gt;    &amp;lt;/ul&amp;gt;&lt;br /&gt;  &amp;lt;/mm:relatednodescontainer&amp;gt;&lt;br /&gt;&amp;lt;/mm:node&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&amp;lt;/mm:cloud&amp;gt;&lt;br /&gt;&amp;lt;/mm:content&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;h4&gt;Ordering articles yourself&lt;/h4&gt;&lt;p&gt;The objectmodel of this example is rather simple and shown here. The 'posrel' relation has just one field named 'pos', an integer that can be used to order the news articles. In the above example I used 'date' to order the articles, but if you would like to influence the ordering yourself change the &amp;lt;mm:sortorder /&amp;gt; tag. The field attribute of &amp;lt;mm:sortorder /&amp;gt; contains the  nodetype 'posrel' and after the dot the field 'pos' to use for ordering.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:sortorder field=&quot;posrel.pos&quot; direction=&quot;UP&quot; /&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;The article related with position 1 will be on top, next the one with position 2 etc.&lt;/p&gt;&lt;ul&gt;
          &lt;li&gt;
          &lt;a href="http://www.mmbase.org/mmdocs/applications/taglib/build/frontenddevelopers/taglib/reference/querycontainer.jsp"&gt;Querycontainter tags&lt;/a&gt;
          &lt;br /&gt;&lt;mm:relatednodescontainer /&gt; its family 
          &lt;/li&gt;
          
          &lt;li&gt;
          &lt;a href="http://www.mmbase.org/docs/applications/taglib/frontenddevelopers/taglib/taglib-tutorial.html"&gt;MMBase taglib tutorial&lt;/a&gt;
          &lt;br /&gt;This tutorial has some more examples with MyNews
          &lt;/li&gt;
          &lt;/ul&gt;</content></entry><entry xmlns:media="http://search.yahoo.com/mrss/"><title>Display a node</title><link href="http://www.toly.nl/mmbase/1610/Display_a_node"/><id>http://www.toly.nl/mmbase/1610/Display_a_node</id><updated>2010-05-03T12:41:15Z</updated><published>2010-05-03T00:00:00Z</published><author><name>André</name></author><summary type="html">An example of a template with just one node. The ancient mmbase MyNews magazine made even simpler.</summary><content type="html">An example of a template with just one node. The ancient mmbase MyNews magazine made even simpler.&lt;p&gt;MyNews is the most used example in all mmbase releases: it is a magazine with the very first five newsarticles that featured on a former version of www.mmbase.org. This is the complete copy-and-paste-example in jspx:&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:content &lt;br /&gt;    xmlns:jsp=&quot;http://java.sun.com/JSP/Page&quot;&lt;br /&gt;    xmlns:mm=&quot;http://www.mmbase.org/mmbase-taglib-2.0&quot;&lt;br /&gt;    expires=&quot;120&quot; postprocessor=&quot;none&quot; type=&quot;text/html&quot;&amp;gt;&lt;br /&gt;&amp;lt;jsp:output omit-xml-declaration=&quot;true&quot; /&amp;gt;&lt;br /&gt;&amp;lt;mm:cloud&amp;gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;  &amp;lt;title&amp;gt;MyNews example&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;mm:node number=&quot;default.mags&quot;&amp;gt;&lt;br /&gt;  &amp;lt;h1&amp;gt;&amp;lt;mm:field name=&quot;title&quot; /&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;  &amp;lt;p&amp;gt;&amp;lt;mm:field name=&quot;intro&quot; /&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;  &amp;lt;p&amp;gt;&amp;lt;mm:field name=&quot;body&quot; /&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;&amp;lt;/mm:node&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&amp;lt;/mm:cloud&amp;gt;&lt;br /&gt;&amp;lt;/mm:content&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;Which prints in HTML5 fasion (that's why I used the &amp;lt;jsp:output omit-xml-declaration=&quot;true&quot; /&amp;gt; declaration):&lt;/p&gt;
&lt;pre&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;  &amp;lt;title&amp;gt;MyNews example&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;h1&amp;gt;MyNews magazine&amp;lt;/h1&amp;gt;&lt;br /&gt;&amp;lt;p&amp;gt;This MyNews magazine is an example of news articles in a&lt;br /&gt;magazine.&amp;lt;/p&amp;gt;&lt;br /&gt;&amp;lt;p&amp;gt;This magazine shows a news article magazine. The news articles are&lt;br /&gt;from the MMBase.org web site. This magazine contains news articles but&lt;br /&gt;it is also possible to create other magazines like: sport magazine,&lt;br /&gt;economics magazine, etc. The articles in this example are related to&lt;br /&gt;urls, and an author. While creating your own magazine you are free to&lt;br /&gt;relate it to other information. Explore this MyNews magazine and take a&lt;br /&gt;look at the templates. We hope that it will inspire you to create much&lt;br /&gt;better magazines ;-)&amp;lt;/p&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;Without all the frills of including the &amp;lt;mm:content /&amp;gt;, &amp;lt;mm:cloud /&amp;gt; and the &amp;lt;jsp:output omit-xml-declaration=&quot;true&quot; /&amp;gt; tag, displaying the magazine node boils down to just the part with the &amp;lt;mm:node /&amp;gt; tag and its fields:&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:node number=&quot;default.mags&quot;&amp;gt;&lt;br /&gt;  &amp;lt;h1&amp;gt;&amp;lt;mm:field name=&quot;title&quot; /&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;  &amp;lt;p&amp;gt;&amp;lt;mm:field name=&quot;intro&quot; /&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;  &amp;lt;p&amp;gt;&amp;lt;mm:field name=&quot;body&quot; /&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;&amp;lt;/mm:node&amp;gt;&lt;/pre&gt;
&lt;p&gt;The magazine node has an alias named 'default.mags'. In mmbase you can asign aliasses to nodes which makes them exportable to other mmbase instances. This alias translates to the node number of MyNews Magazine which is retrieved from mmbase and of which the fields title, intro and body are printed.&lt;/p&gt;&lt;ul&gt;
          &lt;li&gt;
          &lt;a href="http://www.mmbase.org/mmdocs/applications/taglib/build/frontenddevelopers/taglib/"&gt;MMBase Taglib reference&lt;/a&gt;
          &lt;br /&gt;The reference for all tags mm
          &lt;/li&gt;
          &lt;/ul&gt;</content></entry><entry xmlns:media="http://search.yahoo.com/mrss/"><title>Basic template</title><link href="http://www.toly.nl/mmbase/1579/Basic_template"/><id>http://www.toly.nl/mmbase/1579/Basic_template</id><updated>2010-04-02T13:54:04Z</updated><published>2010-03-18T00:00:00Z</published><author><name>André</name></author><summary type="html">The jspx template I use most often to create a new web page in mmbase.</summary><content type="html">The jspx template I use most often to create a new web page in mmbase.&lt;p&gt;This is the jspx template - a stationery really in BBEdit - with the taglbiraries I use most often. It includes JSTL core and functions, and the mmbase taglibrary.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:content &lt;br /&gt;    xmlns:jsp=&quot;http://java.sun.com/JSP/Page&quot;&lt;br /&gt;    xmlns:c=&quot;http://java.sun.com/jsp/jstl/core&quot;&lt;br /&gt;    xmlns:fn=&quot;http://java.sun.com/jsp/jstl/functions&quot;&lt;br /&gt;    xmlns:mm=&quot;http://www.mmbase.org/mmbase-taglib-2.0&quot;&lt;br /&gt;    expires=&quot;120&quot; postprocessor=&quot;none&quot; type=&quot;text/html&quot;&amp;gt;&lt;br /&gt;&amp;lt;jsp:output doctype-root-element=&quot;html&quot;&lt;br /&gt;      doctype-public=&quot;-//W3C//DTD XHTML 1.1//EN&quot;&lt;br /&gt;      doctype-system=&quot;http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd&quot; /&amp;gt;&lt;br /&gt;&amp;lt;mm:cloud&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;  &amp;lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;title&amp;gt;Untitled&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&amp;lt;/mm:cloud&amp;gt;&lt;br /&gt;&amp;lt;/mm:content&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;I have another one for jsp, before I started to use jspx.&lt;/p&gt;
&lt;pre&gt;&amp;lt;%@ page language=&quot;java&quot; contentType=&quot;text/html&quot; &lt;br /&gt;%&amp;gt;&amp;lt;%@ taglib prefix=&quot;c&quot; uri=&quot;http://java.sun.com/jsp/jstl/core&quot;&lt;br /&gt;%&amp;gt;&amp;lt;%@ taglib uri=&quot;http://www.mmbase.org/mmbase-taglib-2.0&quot; prefix=&quot;mm&quot; &lt;br /&gt;%&amp;gt;&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.1//EN&quot;&lt;br /&gt;  &quot;http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd&quot;&amp;gt;&lt;br /&gt;&amp;lt;mm:content expires=&quot;120&quot; type=&quot;text/html&quot; escaper=&quot;none&quot;&amp;gt;&lt;br /&gt;&amp;lt;mm:cloud&amp;gt;&lt;br /&gt;&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot;&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;  &amp;lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;title&amp;gt;Untitled&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&amp;lt;/mm:cloud&amp;gt;&lt;br /&gt;&amp;lt;/mm:content&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;The &amp;lt;mm:content /&amp;gt; tag sets the expires header to 120 seconds, meaning the page should be cached for two minutes.&lt;/p&gt;&lt;ul&gt;
          &lt;li&gt;
          &lt;a href="http://download.oracle.com/docs/cd/E17477_01/javaee/5/jstl/1.1/docs/tlddocs/overview-summary.html"&gt;JSTL 1.1 reference&lt;/a&gt;
          &lt;br /&gt;JavaServer Pages Standard Tag Library 1.1 Tag Reference
          &lt;/li&gt;
          
          &lt;li&gt;
          &lt;a href="http://www.mmbase.org/mmdocs/applications/taglib/build/frontenddevelopers/taglib/"&gt;MMBase Taglib reference&lt;/a&gt;
          &lt;br /&gt;The reference for all tags mm
          &lt;/li&gt;
          &lt;/ul&gt;</content></entry><entry xmlns:media="http://search.yahoo.com/mrss/"><title>Install a component</title><link href="http://www.toly.nl/mmbase/1555/Install_a_component"/><id>http://www.toly.nl/mmbase/1555/Install_a_component</id><updated>2010-06-02T08:54:15Z</updated><published>2010-03-08T00:00:00Z</published><author><name>André</name></author><summary type="html">Since 1.9 mmbase features a framework with an easier way to install different applications or functionalities, they're called components. Most of the older applications have been converted to these easy-to-install components and all new ones are created as components, like for example Streams.</summary><content type="html">Since 1.9 mmbase features a framework with an easier way to install different applications or functionalities, they're called components. Most of the older applications have been converted to these easy-to-install components and all new ones are created as components, like for example Streams.&lt;p&gt;Components generally consist of two parts: templates and code. By default the templates need to end up in '/mmbase/components/[component-name]', the code packaged in a JAR or WAR in '/WEB-INF/lib'. There are two main methods to installing both: use Maven to build a webapplication or just the files manually.&lt;/p&gt;
&lt;h4&gt;Maven&lt;/h4&gt;
&lt;p&gt;Easiest - and the preferred method when you're building a new web application - is to use Maven 2 while you are building your webapp. Include the following with 'dependencies' in Maven's 'pom.xml'.&lt;/p&gt;
&lt;pre&gt;&amp;lt;dependency&amp;gt;
  &amp;lt;groupId&amp;gt;org.mmbase&amp;lt;/groupId&amp;gt;
  &amp;lt;artifactId&amp;gt;mmbase-mynews&amp;lt;/artifactId&amp;gt;
  &amp;lt;version&amp;gt;1.9.2&amp;lt;/version&amp;gt;
  &amp;lt;type&amp;gt;war&amp;lt;/type&amp;gt;
&amp;lt;/dependency&amp;gt;
&lt;/pre&gt;
&lt;p&gt;When you run 'mvn clean install' the MyNews application war is downloaded and everything is installed using overlays in the right places in your webapp.&lt;/p&gt;
&lt;h4&gt;Just the files&lt;/h4&gt;
&lt;p&gt;Another method is to just download the component, unpack it and install the files in their locations in your web application. MyNews can be downloaded at http://www.mmbase.org/maven2/org/mmbase/mmbase-mynews/1.9.2/mmbase-mynews-1.9.2.war Unpacking it yields the following directories:&lt;/p&gt;
&lt;pre&gt;META-INF
mmbase/components/mynews
mmbase/mynews
WEB-INF/classes
WEB-INF/lib&lt;/pre&gt;
&lt;p&gt;All templates can be found in the 'mmbase' directory, the code in 'WEB-INF/lib'. &lt;br /&gt;The others  'META-INF' and 'WEB-INF/classes' are not necessary, they were generated by Maven and are mostly empty.&lt;/p&gt;
&lt;p&gt;The code and all configuration is in 'WEB-INF/lib/&lt;img src=&quot;file:///Users/andre/Library/Caches/TemporaryItems/moz-screenshot.png&quot; alt=&quot;&quot; /&gt;mmbase-mynews-1.9.2.jar'. If you ever need to alter a configuration setting you will need to unpack this jar. The changed configuration file goes in its mirrored position in the 'WEB-INF/config'. &lt;br /&gt;The 'mmbase-mynews-1.9.2.jar' - of course - goes in your webapp's 'WEB-INF/lib'.&lt;/p&gt;
&lt;p&gt;The directory 'mmbase/components/mynews' contains the templates that are part of the generic component structure. These 'mynews'  jspx files need to be in that exact same directory in your webapp.  &lt;br /&gt;The other templates directory can be installed anywhere if you want.&lt;/p&gt;</content></entry><entry xmlns:media="http://search.yahoo.com/mrss/"><title>Baking cookies (or using sessions)</title><link href="http://www.toly.nl/mmbase/434/Baking_cookies__or_using_sessions_"/><id>http://www.toly.nl/mmbase/434/Baking_cookies__or_using_sessions_</id><updated>2010-03-08T13:33:30Z</updated><published>2010-01-26T00:00:00Z</published><author><name>André</name></author><summary type="html">The mmbase taglib has some convenient ways to bake your own cookies. Creating session variables is done in more or less the same way.</summary><content type="html">The mmbase taglib has some convenient ways to bake your own cookies. Creating session variables is done in more or less the same way.&lt;p&gt;In my_editors I use the following piece of code to look for users cookies in case they have preferences that are different from the default settings. The defaults '25', 'top' and '99' for 'max', 'searchbox' and 'maxdays' are used if there are no cookies.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:import id=&quot;max&quot;       from=&quot;cookie&quot; externid=&quot;my_editors_maxitems&quot;&amp;gt;25&amp;lt;/mm:import&amp;gt;
&amp;lt;mm:import id=&quot;searchbox&quot; from=&quot;cookie&quot; externid=&quot;my_editors_searchbox&quot;&amp;gt;top&amp;lt;/mm:import&amp;gt;
&amp;lt;mm:import id=&quot;maxdays&quot;   from=&quot;cookie&quot; externid=&quot;my_editors_maxdays&quot;&amp;gt;99&amp;lt;/mm:import&amp;gt;
&lt;/pre&gt;
&lt;p&gt;Users can save their preferences by submitting a form. Their settings are imported from the parameters 'max_items', 'search_box' and 'max_days' and written as cookies 'my_editors_maxitems', 'my_editors_searchbox' and 'my_editors_maxdays' in their browsers cookie jar.&lt;/p&gt;
&lt;pre&gt;&amp;lt;%-- read defaults or configuration submitted by form --%&amp;gt;&lt;br /&gt;&amp;lt;mm:import externid=&quot;max_items&quot; vartype=&quot;Integer&quot;&amp;gt;&amp;lt;mm:write referid=&quot;max&quot; /&amp;gt;&amp;lt;/mm:import&amp;gt;&lt;br /&gt;&amp;lt;mm:import externid=&quot;search_box&quot;&amp;gt;&amp;lt;mm:write referid=&quot;searchbox&quot; /&amp;gt;&amp;lt;/mm:import&amp;gt;&lt;br /&gt;&amp;lt;mm:import externid=&quot;max_days&quot; vartype=&quot;Integer&quot;&amp;gt;&amp;lt;mm:write referid=&quot;days&quot; /&amp;gt;&amp;lt;/mm:import&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;mm:import externid=&quot;savethis&quot; /&amp;gt;&lt;br /&gt;&amp;lt;mm:present referid=&quot;savethis&quot;&amp;gt;&lt;br /&gt;  &amp;lt;%-- write the cookies --%&amp;gt;&lt;br /&gt;  &amp;lt;mm:write cookie=&quot;my_editors_maxitems&quot;  referid=&quot;max_items&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;mm:write cookie=&quot;my_editors_searchbox&quot; referid=&quot;search_box&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;mm:write cookie=&quot;my_editors_maxdays&quot;   referid=&quot;max_days&quot; /&amp;gt;&lt;br /&gt;&amp;lt;/mm:present&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;Sessions are done the same way. Write a value to the session with &amp;lt;mm:write /&amp;gt; using the attribute 'session'.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:write session=&quot;your_session_value&quot; value=&quot;some value...&quot; /&amp;gt;&lt;/pre&gt;
&lt;p&gt;And pick it up in a different location with &amp;lt;mm:import /&amp;gt; and specify with the attribute 'from' that you need it from session.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:import from=&quot;session&quot; id=&quot;your_session_value&quot; /&amp;gt;&lt;/pre&gt;
&lt;p&gt;When you print it you get 'some value...'.&lt;/p&gt;&lt;ul&gt;
          &lt;li&gt;
          &lt;a href="http://www.mmbase.org/mmdocs/applications/taglib/build/frontenddevelopers/taglib/reference/import.jsp"&gt;&lt;mm:import /&gt; tag&lt;/a&gt;
          &lt;br /&gt;Tag to import variables in the context like from another context, (form) parameters, sessions or cookies.
          &lt;/li&gt;
          &lt;/ul&gt;</content></entry><entry xmlns:media="http://search.yahoo.com/mrss/"><title>A basic pager with JSTL</title><link href="http://www.toly.nl/mmbase/466/A_basic_pager_with_JSTL"/><id>http://www.toly.nl/mmbase/466/A_basic_pager_with_JSTL</id><updated>2012-06-01T12:49:48Z</updated><published>2010-01-19T00:00:00Z</published><author><name>André</name></author><summary type="html">Some nodelists in your templates can grow rather large, especially in an editor or searchresults. The mmbase taglib features mm:previousbatches and mm:nextbatches tags but with JSTL you can tackle this quite as easy.</summary><content type="html">Some nodelists in your templates can grow rather large, especially in an editor or searchresults. The mmbase taglib features mm:previousbatches and mm:nextbatches tags but with JSTL you can tackle this quite as easy.&lt;p&gt;It depends on three variables: 'total' - total search results found, 'max'- maximum results you want to show per page and 'offset'. Total is typically set in your nodelist with &amp;lt;mm:size /&amp;gt; or is set in your searchresults, the other two need to be configured.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:import externid=&quot;max&quot;&amp;gt;25&amp;lt;/mm:import&amp;gt;
&amp;lt;mm:import externid=&quot;offset&quot;&amp;gt;0&amp;lt;/mm:import&amp;gt;
&lt;/pre&gt;
&lt;p&gt;Next we need construct the base url that contains all parameters that should occur in every link that is rendered within the pager. This is the spot to put any variables you need later. Here we are paging nodes of a certain 'type'.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:url id=&quot;baseurl&quot; referids=&quot;type&quot; write=&quot;false&quot; /&amp;gt;
&lt;/pre&gt;
&lt;p&gt;The first link '«« previous' only gets displayed when offset is not equal to 0, since this means we are on the first page. The next part iterates over all the pages with results and creates links of each of them except the one we are currently viewing which is marked strong. The last link is the next page link which should only be displayed when there are still more pages.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:present referid=&quot;total&quot;&amp;gt;
  &amp;lt;c:if test=&quot;${offset != 0}&quot;&amp;gt;
    &amp;lt;mm:link referid=&quot;baseurl&quot;&amp;gt;
      &amp;lt;mm:param name=&quot;offset&quot;&amp;gt;${offset - max}&amp;lt;/mm:param&amp;gt;
      &amp;lt;strong&amp;gt;&amp;lt;a href=&quot;${_}&quot;&amp;gt;«« previous&amp;lt;/a&amp;gt;&amp;lt;/strong&amp;gt;
    &amp;lt;/mm:link&amp;gt;
  &amp;lt;/c:if&amp;gt;
  Page: 
  &amp;lt;c:forEach var=&quot;index&quot; begin=&quot;0&quot; end=&quot;${(total - 1) / max}&quot;&amp;gt;
    &amp;lt;c:choose&amp;gt;
      &amp;lt;c:when test=&quot;${(index * max) == offset}&quot;&amp;gt;
        &amp;lt;strong&amp;gt;${index + 1}&amp;lt;/strong&amp;gt;
      &amp;lt;/c:when&amp;gt;
      &amp;lt;c:otherwise&amp;gt;
        &amp;lt;mm:link referid=&quot;baseurl&quot;&amp;gt;
          &amp;lt;mm:param name=&quot;offset&quot;&amp;gt;${index * max}&amp;lt;/mm:param&amp;gt;
          &amp;lt;a href=&quot;${_}&quot;&amp;gt;${index + 1}&amp;lt;/a&amp;gt;
        &amp;lt;/mm:link&amp;gt;
      &amp;lt;/c:otherwise&amp;gt;
    &amp;lt;/c:choose&amp;gt;
  &amp;lt;/c:forEach&amp;gt;
  &amp;lt;c:if test=&quot;${(total - offset) &amp;gt; max}&quot;&amp;gt;
    &amp;lt;mm:link referid=&quot;baseurl&quot;&amp;gt;
      &amp;lt;mm:param name=&quot;offset&quot;&amp;gt;${max + offset}&amp;lt;/mm:param&amp;gt;
      &amp;lt;strong&amp;gt;&amp;lt;a href=&quot;${_}&quot;&amp;gt;next »»&amp;lt;/a&amp;gt;&amp;lt;/strong&amp;gt;
    &amp;lt;/mm:link&amp;gt;
  &amp;lt;/c:if&amp;gt;
&amp;lt;/mm:present&amp;gt;
&lt;/pre&gt;
&lt;p&gt;As you can see the code tests for the presence of 'total', which means in this case there has been searched or that the nodelist we are paging is not empty.&lt;/p&gt;
&lt;p&gt;The &amp;lt;mm:link /&amp;gt; tag is a variant of &amp;lt;mm:url /&amp;gt; but with a body. It prints is output using ${_}.&lt;/p&gt;
&lt;p&gt;You could also add links to the first and last pages of the results. Again we are testing whether it is usefull to display the links. The link for the first page:&lt;/p&gt;
&lt;pre&gt;&amp;lt;c:if test=&quot;${offset != 0}&quot;&amp;gt;
  &amp;lt;mm:link referid=&quot;baseurl&quot;&amp;gt;
    &amp;lt;mm:param name=&quot;offset&quot;&amp;gt;0&amp;lt;/mm:param&amp;gt;
    &amp;lt;a href=&quot;${_}&quot;&amp;gt;first&amp;lt;/a&amp;gt;
  &amp;lt;/mm:link&amp;gt;
&amp;lt;/c:if&amp;gt;
&lt;/pre&gt;
&lt;p&gt;The link to the last page of the results is a bit tricky cause the result can become the same as total:&lt;/p&gt;
&lt;pre&gt;&amp;lt;c:if test=&quot;${(total - offset) &amp;gt; max}&quot;&amp;gt;
  &amp;lt;mm:link referid=&quot;baseurl&quot;&amp;gt;
    &amp;lt;mm:param name=&quot;offset&quot;&amp;gt;${total - (total mod max) ge total ? total - max : total - (total mod max)}&amp;lt;/mm:param&amp;gt;
    &amp;lt;a href=&quot;${_}&quot;&amp;gt;last&amp;lt;/a&amp;gt;
  &amp;lt;/mm:link&amp;gt;
&amp;lt;/c:if&amp;gt;
&lt;/pre&gt;
&lt;p&gt;Of course, these two links can be included within the previous code snippet but this made it easier to explain and read.&lt;br /&gt;I used this code in several websites, in Open Images f.e. I made it in a tagfile.&lt;/p&gt;&lt;ul&gt;
          &lt;li&gt;
          &lt;a href="http://www.mmbase.org/mmdocs/applications/taglib/build/frontenddevelopers/taglib/reference/previousbatches.jsp"&gt;mm:previousbatches&lt;/a&gt;
          &lt;br /&gt;To implemement 'previous page' links.
          &lt;/li&gt;
          
          &lt;li&gt;
          &lt;a href="http://www.mmbase.org/mmdocs/applications/taglib/build/frontenddevelopers/taglib/reference/nextbatches.jsp#nextbatches"&gt;mm:nextbatches&lt;/a&gt;
          &lt;br /&gt;To implement 'next page' links.
          &lt;/li&gt;
          &lt;/ul&gt;</content></entry><entry xmlns:media="http://search.yahoo.com/mrss/"><title>Sending mail to a group of users</title><link href="http://www.toly.nl/mmbase/438/Sending_mail_to_a_group_of_users"/><id>http://www.toly.nl/mmbase/438/Sending_mail_to_a_group_of_users</id><updated>2010-03-08T13:32:34Z</updated><published>2010-01-04T00:00:00Z</published><author><name>André</name></author><summary type="html">Following up on my previous posts about mail I will now introduce you to spamming a group of users. Mailing several people at once is done by relating an email to a node - for example a groups node - with related users.</summary><content type="html">Following up on my previous posts about mail I will now introduce you to spamming a group of users. Mailing several people at once is done by relating an email to a node - for example a groups node - with related users.&lt;p&gt;A group can have several forms: like for example an article with users that have subscribed themselves to be aknowledged of any comments. Or like the default implementation: a 'pools' node with related users. &lt;br /&gt;If you wish to change the default 'pools' and 'people' nodetypes to something different you can do so by changing some properties in the email builder. The only requirement is that the related nodes representing the users should have a field with a valid email address specified in the property 'users-email-field'.&lt;/p&gt;
&lt;pre&gt;&amp;lt;properties&amp;gt;&lt;br /&gt; &amp;lt;property name=&quot;groups-builder&quot;&amp;gt;pools&amp;lt;/property&amp;gt;&lt;br /&gt; &amp;lt;property name=&quot;users-builder&quot;&amp;gt;people&amp;lt;/property&amp;gt;&lt;br /&gt; &amp;lt;property name=&quot;users-email-field&quot;&amp;gt;email&amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;/properties&amp;gt;&lt;/pre&gt;
&lt;p&gt;Create an email, like in one of the previous tips.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:createnode id=&quot;email_node&quot; type=&quot;email&quot;&amp;gt;&lt;br /&gt;  &amp;lt;mm:setfield name=&quot;subject&quot;&amp;gt;Hi, I invite you all to...&amp;lt;/mm:setfield&amp;gt;&lt;br /&gt;  &amp;lt;mm:setfield name=&quot;from&quot;&amp;gt; you@domain.org &amp;lt;/mm:setfield&amp;gt;&lt;br /&gt;&amp;lt;/mm:createnode&amp;gt;&lt;/pre&gt;
&lt;p&gt;Refer it to a group node which has has related user nodes with a field 'email'. You can to this for example when someone posts a comment and mail it to all users who subscribed.&lt;/p&gt;
&lt;pre&gt;&amp;lt;%-- relate the newly created email to a group --%&amp;gt;&lt;br /&gt;&amp;lt;mm:node id=&quot;group_node&quot; number=&quot;group_alias&quot; /&amp;gt;&lt;br /&gt;&amp;lt;mm:createrelation source=&quot;email_node&quot; destination=&quot;group_node&quot; role=&quot;related&quot; /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;%-- send the email --%&amp;gt;&lt;br /&gt;&amp;lt;mm:node referid=&quot;new_email_node&quot;&amp;gt;&lt;br /&gt;  &amp;lt;mm:functioncontainer&amp;gt;&lt;br /&gt;    &amp;lt;mm:param name=&quot;type&quot;&amp;gt;oneshotkeep&amp;lt;/mm:param&amp;gt;&lt;br /&gt;    &amp;lt;mm:function name=&quot;mail&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;/mm:functioncontainer&amp;gt;&lt;br /&gt;&amp;lt;/mm:node&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;The mail is send immediately after it is related to the group node. &lt;br /&gt;I choose 'oneshotkeep' since this keeps the email as a node in mmbase and can be used to build a mail archive.&lt;/p&gt;&lt;ul&gt;
          &lt;li&gt;
          &lt;a href="http://www.mmbase.org/mmdocs/applications/email/email.html"&gt;Email application documentation&lt;/a&gt;
          &lt;br /&gt;
          &lt;/li&gt;
          &lt;/ul&gt;</content></entry><entry xmlns:media="http://search.yahoo.com/mrss/"><title>A form to send mail</title><link href="http://www.toly.nl/mmbase/1391/A_form_to_send_mail"/><id>http://www.toly.nl/mmbase/1391/A_form_to_send_mail</id><updated>2010-03-08T13:32:19Z</updated><published>2009-12-10T00:00:00Z</published><author><name>André</name></author><summary type="html">In my previous post I showed how easy it is to create an email node and send it. This time I'll make it into a complete example which includes a simple form.</summary><content type="html">In my previous post I showed how easy it is to create an email node and send it. This time I'll make it into a complete example which includes a simple form.&lt;p&gt;If you care to validate your user input you can use the &amp;lt;mm:form /&amp;gt; tag which was mainly designed for that purpose, but here I'll focus on creating a node with a standard html form. In the action attribute of the following form I have put an empty ${mm:link('')} tag that generates a link to the page itself thereby ensuring that we submit to the same page as we are woking on.&lt;/p&gt;
&lt;pre&gt;&amp;lt;form action=&quot;${mm:link('')}&quot; method=&quot;post&quot;&amp;gt;&lt;br /&gt;  &amp;lt;input type=&quot;text&quot; name=&quot;your_email&quot;  /&amp;gt;&lt;br /&gt;  &amp;lt;textarea name=&quot;your_message&quot;&amp;gt;&amp;lt;/textarea /&amp;gt;&lt;br /&gt;  &amp;lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Send&quot; /&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;Put it somewhere in the middle of your jsp. Above it place code to import the submitted values:&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:import externid=&quot;your_email&quot; /&amp;gt;&lt;br /&gt;&amp;lt;mm:import externid=&quot;your_message&quot; /&amp;gt;&lt;br /&gt;&amp;lt;mm:import externid=&quot;submit&quot; /&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;And some code to handle the variables that were created when someone clicks 'Send'. Here we use the &amp;lt;mm:present /&amp;gt; that is often used in mmbase but standard JSTL with &amp;lt;c:if test=&quot;${!empty submit}&quot;&amp;gt;...&amp;lt;/c:if&amp;gt; works as well. Between a lot of mmbase taglibrary tags I find it often even easier tot read.&lt;br /&gt;Right after the check with &amp;lt;mm:present /&amp;gt; I include a cloud tag to open a cloud in which we can create e-mail nodes. In the body of the cloud tag comes the code from the previous tip.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:present referid=&quot;submit&quot;&amp;gt;&lt;br /&gt;  &amp;lt;mm:cloud username=&quot;foo&quot; password=&quot;bar&quot; method=&quot;pagelogon&quot;&amp;gt;&lt;br /&gt;    &amp;lt;!-- here the code that handles e-mail creation and sending --&amp;gt;&lt;br /&gt;  &amp;lt;/mm:cloud&amp;gt;&lt;br /&gt;&amp;lt;/mm:present&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;Below you will find the complete example. Copy and paste it, but be sure to change the e-mail address 'you@somewhere.org' in that of your own. And change the username 'foo' and password 'bar' in the second &amp;lt;mm:cloud /&amp;gt; tag if you have already changed the default security settings of your application.&lt;/p&gt;
&lt;pre&gt;&amp;lt;%@ page language=&quot;java&quot; contentType=&quot;text/html&quot; &lt;br /&gt;%&amp;gt;&amp;lt;%@ taglib uri=&quot;http://www.mmbase.org/mmbase-taglib-2.0&quot; prefix=&quot;mm&quot; &lt;br /&gt;%&amp;gt;&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.1//EN&quot;&lt;br /&gt;  &quot;http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd&quot;&amp;gt;&lt;br /&gt;&amp;lt;mm:cloud&amp;gt;&lt;br /&gt;&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;nl&quot;&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;  &amp;lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;title&amp;gt;E-mail example&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;mm:import externid=&quot;your_email&quot; /&amp;gt;&lt;br /&gt;&amp;lt;mm:import externid=&quot;your_message&quot; /&amp;gt;&lt;br /&gt;&amp;lt;mm:import externid=&quot;submit&quot; /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;mm:present referid=&quot;submit&quot;&amp;gt;&lt;br /&gt;  &amp;lt;%-- pagelogin to enable visitors to create email nodes --%&amp;gt;&lt;br /&gt;  &amp;lt;mm:cloud username=&quot;foo&quot; password=&quot;bar&quot; method=&quot;pagelogon&quot;&amp;gt;&lt;br /&gt;    &lt;br /&gt;    &amp;lt;%-- create an email node --%&amp;gt;&lt;br /&gt;    &amp;lt;mm:createnode id=&quot;new_email_node&quot; type=&quot;email&quot;&amp;gt;&lt;br /&gt;      &amp;lt;mm:setfield name=&quot;from&quot;&amp;gt;${your_email}&amp;lt;/mm:setfield&amp;gt;&lt;br /&gt;      &amp;lt;mm:setfield name=&quot;to&quot;&amp;gt; you@somewhere.org &amp;lt;/mm:setfield&amp;gt;&lt;br /&gt;      &amp;lt;mm:setfield name=&quot;subject&quot;&amp;gt;A test mail&amp;lt;/mm:setfield&amp;gt;&lt;br /&gt;      &amp;lt;mm:setfield name=&quot;body&quot;&amp;gt;${your_message}&amp;lt;/mm:setfield&amp;gt;&lt;br /&gt;    &amp;lt;/mm:createnode&amp;gt;&lt;br /&gt;  &lt;br /&gt;    &amp;lt;%-- the function 'mail' shoots it off into the world --%&amp;gt;&lt;br /&gt;    &amp;lt;mm:node referid=&quot;new_email_node&quot;&amp;gt;&lt;br /&gt;      &amp;lt;mm:functioncontainer&amp;gt;&lt;br /&gt;        &amp;lt;mm:param name=&quot;type&quot;&amp;gt;oneshotkeep&amp;lt;/mm:param&amp;gt;&lt;br /&gt;        &amp;lt;mm:function name=&quot;mail&quot; /&amp;gt;&lt;br /&gt;      &amp;lt;/mm:functioncontainer&amp;gt;&lt;br /&gt;    &amp;lt;/mm:node&amp;gt;&lt;br /&gt;  &lt;br /&gt;    &amp;lt;%-- let the visitor know what happened with it --%&amp;gt;&lt;br /&gt;    &amp;lt;mm:node referid=&quot;new_email_node&quot;&amp;gt;&lt;br /&gt;      &amp;lt;mm:field name=&quot;mailstatus&quot;&amp;gt;&lt;br /&gt;        &amp;lt;mm:compare value=&quot;1&quot;&amp;gt;&lt;br /&gt;          &amp;lt;p&amp;gt;Thanks. Your mail has been send.&amp;lt;/p&amp;gt;&lt;br /&gt;        &amp;lt;/mm:compare&amp;gt;&lt;br /&gt;        &amp;lt;mm:compare value=&quot;2&quot;&amp;gt;&lt;br /&gt;          &amp;lt;p&amp;gt;Some error occured!&amp;lt;/p&amp;gt;&lt;br /&gt;        &amp;lt;/mm:compare&amp;gt;&lt;br /&gt;      &amp;lt;/mm:field&amp;gt;&lt;br /&gt;    &amp;lt;/mm:node&amp;gt;&lt;br /&gt;  &lt;br /&gt;  &amp;lt;/mm:cloud&amp;gt;&lt;br /&gt;&amp;lt;/mm:present&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;form action=&quot;${mm:link('')}&quot; method=&quot;post&quot;&amp;gt;&lt;br /&gt;  &amp;lt;fieldset&amp;gt;&lt;br /&gt;    &amp;lt;legend&amp;gt;Send an email&amp;lt;/legend&amp;gt;&lt;br /&gt;    &amp;lt;input type=&quot;text&quot; name=&quot;your_email&quot; size=&quot;42&quot; /&amp;gt;&lt;br /&gt;    &amp;lt;textarea name=&quot;your_message&quot; cols=&quot;42&quot;&amp;gt;&amp;lt;/textarea /&amp;gt;&lt;br /&gt;    &amp;lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Send&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;/fieldset&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&amp;lt;/mm:cloud&amp;gt; &lt;/pre&gt;</content></entry><entry xmlns:media="http://search.yahoo.com/mrss/"><title>Sending mail</title><link href="http://www.toly.nl/mmbase/436/Sending_mail"/><id>http://www.toly.nl/mmbase/436/Sending_mail</id><updated>2010-03-08T13:32:01Z</updated><published>2009-11-25T00:00:00Z</published><author><name>André</name></author><summary type="html">The mmbase email application enables you to send email with for example a contactform or you can even build a mailinglist with it. You can save the mails after they have been send, or discard them.&lt;br /&gt;</summary><content type="html">The mmbase email application enables you to send email with for example a contactform or you can even build a mailinglist with it. You can save the mails after they have been send, or discard them.&lt;br /&gt;&lt;p&gt;After you have installed the 'mmbase-email.jar' in your webapp's '/WEB-INF/lib/' directory, you need to configure Apache Tomcat or another prefered webapplication server. Following the configuration instructions in the README with the application this basically boils down to enabling a mail Resource for your webapplication's context. For example:&lt;/p&gt;
&lt;pre&gt;&amp;lt;Context path=&quot;&quot; docBase=&quot;ROOT&quot; debug=&quot;0&quot;&amp;gt;&lt;br /&gt;  &amp;lt;!-- there is normally more stuff here about your webapp --&amp;gt;&lt;br /&gt;  &amp;lt;Resource name=&quot;mail/Session&quot; auth=&quot;Container&quot; &lt;br /&gt;    type=&quot;javax.mail.Session&quot; &lt;br /&gt;    mail.smtp.host=&quot;smtp.someplace.org&quot; /&amp;gt;
&amp;lt;/Context&amp;gt;&lt;/pre&gt;
&lt;p&gt;After that sending mail is quite easy.&lt;/p&gt;
&lt;pre&gt;&amp;lt;%-- pagelogin to enable visitors to create email nodes --%&amp;gt;&lt;br /&gt;&amp;lt;mm:cloud username=&quot;foo&quot; password=&quot;bar&quot; method=&quot;pagelogon&quot;&amp;gt;&lt;br /&gt;  &lt;br /&gt;  &amp;lt;%-- create an email node --%&amp;gt;&lt;br /&gt;  &amp;lt;mm:createnode id=&quot;new_email_node&quot; type=&quot;email&quot;&amp;gt;&lt;br /&gt;    &amp;lt;mm:setfield name=&quot;from&quot;&amp;gt;you@someplace.org&amp;lt;/mm:setfield&amp;gt;&lt;br /&gt;    &amp;lt;mm:setfield name=&quot;replyto&quot;&amp;gt;you@someplace.org&amp;lt;/mm:setfield&amp;gt;&lt;br /&gt;    &amp;lt;mm:setfield name=&quot;to&quot;&amp;gt;me@somewhere.net&amp;lt;/mm:setfield&amp;gt;&lt;br /&gt;    &amp;lt;mm:setfield name=&quot;subject&quot;&amp;gt;Just saying hi&amp;lt;/mm:setfield&amp;gt;&lt;br /&gt;    &amp;lt;mm:setfield name=&quot;body&quot;&amp;gt;Hi there! How are you.&amp;lt;/mm:setfield&amp;gt;&lt;br /&gt;  &amp;lt;/mm:createnode&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;%-- the function 'mail' shoots it off into the world --%&amp;gt;&lt;br /&gt;  &amp;lt;mm:node referid=&quot;new_email_node&quot;&amp;gt;&lt;br /&gt;    &amp;lt;mm:functioncontainer&amp;gt;&lt;br /&gt;      &amp;lt;mm:param name=&quot;type&quot;&amp;gt;oneshotkeep&amp;lt;/mm:param&amp;gt;&lt;br /&gt;      &amp;lt;mm:function name=&quot;mail&quot; /&amp;gt;&lt;br /&gt;    &amp;lt;/mm:functioncontainer&amp;gt;&lt;br /&gt;  &amp;lt;/mm:node&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;%-- let the visitor know what happened with it --%&amp;gt;&lt;br /&gt;  &amp;lt;mm:node referid=&quot;mailtje&quot;&amp;gt;&lt;br /&gt;    &amp;lt;mm:field name=&quot;mailstatus&quot;&amp;gt;&lt;br /&gt;      &amp;lt;mm:compare value=&quot;1&quot;&amp;gt;&lt;br /&gt;        &amp;lt;h2&amp;gt;Thanks. Your mail has been send.&amp;lt;/h4&amp;gt;&lt;br /&gt;      &amp;lt;/mm:compare&amp;gt;&lt;br /&gt;      &amp;lt;mm:compare value=&quot;2&quot;&amp;gt;&lt;br /&gt;        &amp;lt;h2&amp;gt;Some error occured!&amp;lt;/h4&amp;gt;&lt;br /&gt;      &amp;lt;/mm:compare&amp;gt;&lt;br /&gt;    &amp;lt;/mm:field&amp;gt;&lt;br /&gt;  &amp;lt;/mm:node&amp;gt;&lt;br /&gt;&amp;lt;/mm:cloud&amp;gt;&lt;/pre&gt;
The 'type' function parameter is 'oneshotkeep' which sends email and stores it as an email node in mmbase. If you don't want to start collecting email from your site you can use the nodefunction with the parameter 'type' at 'oneshot'.
&lt;pre&gt;&amp;lt;mm:node referid=&quot;new_email_node&quot;&amp;gt;&lt;br /&gt;  &amp;lt;mm:functioncontainer&amp;gt;&lt;br /&gt;    &amp;lt;mm:param name=&quot;type&quot;&amp;gt;oneshot&amp;lt;/mm:param&amp;gt;&lt;br /&gt;    &amp;lt;mm:function name=&quot;mail&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;/mm:functioncontainer&amp;gt;&lt;br /&gt;&amp;lt;/mm:node&amp;gt;
&lt;/pre&gt;
&lt;p&gt;That's it. Other features of the email application include sending multipart email like mail with attachments or html.&lt;/p&gt;&lt;ul&gt;
          &lt;li&gt;
          &lt;a href="http://www.mmbase.org/mmdocs/applications/email/email.html"&gt;Email application documentation&lt;/a&gt;
          &lt;br /&gt;
          &lt;/li&gt;
          &lt;/ul&gt;</content></entry><entry xmlns:media="http://search.yahoo.com/mrss/"><title>Regular expressions</title><link href="http://www.toly.nl/mmbase/444/Regular_expressions"/><id>http://www.toly.nl/mmbase/444/Regular_expressions</id><updated>2010-03-08T13:31:48Z</updated><published>2009-11-16T00:00:00Z</published><author><name>André</name></author><summary type="html">There are several tags in the mmbase taglib in which you can use regular expressions. Really helpful to filter for unwanted html-tags, like for example whether a richtext editor has included paragraph tags in your text.</summary><content type="html">There are several tags in the mmbase taglib in which you can use regular expressions. Really helpful to filter for unwanted html-tags, like for example whether a richtext editor has included paragraph tags in your text.&lt;p&gt;Regular expressions can be used in &amp;lt;mm:compare /&amp;gt; and &amp;lt;mm:escaper /&amp;gt;. This example checks for a paragraph tag at the beginning. When it finds one it does nothing. When it does not it adds one at the end and the beginning: the second &amp;lt;mm:compare /&amp;gt; inverses the pattern with the attribute 'inverse=&quot;true&quot;'.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:node number=&quot;a.news.article&quot;&amp;gt;
  &amp;lt;mm:field name=&quot;body&quot;&amp;gt;
    &amp;lt;mm:compare regexp=&quot;^&amp;lt;p&amp;gt;.*&quot;&amp;gt;&amp;lt;mm:write /&amp;gt;&amp;lt;/mm:compare&amp;gt;
    &amp;lt;mm:compare regexp=&quot;^&amp;lt;p&amp;gt;.*&quot; inverse=&quot;true&quot;&amp;gt;&lt;br /&gt;      &amp;lt;p&amp;gt;&amp;lt;mm:write /&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;    &amp;lt;/mm:compare&amp;gt;
  &amp;lt;/mm:field&amp;gt;
&amp;lt;/mm:node&amp;gt;
&lt;/pre&gt;
&lt;p&gt;The regular expression syntax used in the mmbase taglib is the one included in Java and is very simmular to regex in Perl.&lt;/p&gt;
&lt;p&gt;The &amp;lt;mm:escaper /&amp;gt; tag can combine several regular expression patterns after another. The taglib documentation shows an example.&lt;/p&gt;&lt;ul&gt;
          &lt;li&gt;
          &lt;a href="http://java.sun.com/j2se/1.4/docs/api/java/util/regex/Pattern.html"&gt;java.util.regex.Pattern&lt;/a&gt;
          &lt;br /&gt;Regular expression syntax in Java
          &lt;/li&gt;
          
          &lt;li&gt;
          &lt;a href="http://www.mmbase.org/mmdocs/applications/taglib/build/frontenddevelopers/taglib/reference/escaper.jsp"&gt;&lt;mm:escaper /&gt;&lt;/a&gt;
          &lt;br /&gt;Escaper tag in the MMBase taglibrary
          &lt;/li&gt;
          &lt;/ul&gt;</content></entry><entry xmlns:media="http://search.yahoo.com/mrss/"><title>An easy way to nest nodes</title><link href="http://www.toly.nl/mmbase/468/An_easy_way_to_nest_nodes"/><id>http://www.toly.nl/mmbase/468/An_easy_way_to_nest_nodes</id><updated>2009-11-09T13:15:58Z</updated><published>2009-11-09T00:00:00Z</published><author><name>André</name></author><summary type="html">Often you need to display two nodes you imported with parameters - or some other way - in your template but they need to be nested. Here is an easy way how.</summary><content type="html">Often you need to display two nodes you imported with parameters - or some other way - in your template but they need to be nested. Here is an easy way how.&lt;p&gt;The contexts of both nodes would get mixed so a convenient way to this is by assigning an id to one of the nodes and have their field tags refer to it.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:import externid=&quot;page&quot; /&amp;gt;&lt;br /&gt;&amp;lt;mm:import externid=&quot;art&quot; /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;mm:node number=&quot;$page&quot; id=&quot;page_node&quot;&amp;gt;&lt;br /&gt;  &amp;lt;mm:node number=&quot;$art&quot;&amp;gt;&lt;br /&gt;    &amp;lt;h1&amp;gt;&amp;lt;mm:field name=&quot;title&quot; node=&quot;page_node&quot; /&amp;gt;&amp;lt;/h2&amp;gt;
    &amp;lt;div id=&quot;content&quot;&amp;gt;
      &amp;lt;h2&amp;gt;&amp;lt;mm:field name=&quot;title&quot; /&amp;gt;&amp;lt;/h2&amp;gt;
      &amp;lt;p&amp;gt;&amp;lt;mm:field name=&quot;intro&quot; /&amp;gt;&amp;lt;/p&amp;gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;/mm:node&amp;gt;&lt;br /&gt;&amp;lt;/mm:node&amp;gt;
&lt;/pre&gt;
&lt;p&gt;The page node has an id 'page_node' to which the first title refers with the attribute 'node=&quot;page_node&quot;'.&lt;/p&gt;
&lt;p&gt;Of course the first one with id 'pagenode' could also as well be printed outside the article node, but this was just to illustrate the example.&lt;/p&gt;</content></entry><entry xmlns:media="http://search.yahoo.com/mrss/"><title>Displaying a RSS-feed in your page</title><link href="http://www.toly.nl/mmbase/462/Displaying_a_RSS_feed_in_your_page"/><id>http://www.toly.nl/mmbase/462/Displaying_a_RSS_feed_in_your_page</id><updated>2010-03-08T13:31:09Z</updated><published>2009-11-02T00:00:00Z</published><author><name>André</name></author><summary type="html">The mmbase taglib has a formatter tag to be used with xsl to parse XML-files, like for example a RSS-feed.</summary><content type="html">The mmbase taglib has a formatter tag to be used with xsl to parse XML-files, like for example a RSS-feed.&lt;p&gt;This short example contains the www.mmbase.org feed. It imports, or rather 'cites', the url with the &amp;lt;mm:include /&amp;gt; tag. The imported content is formatted with the &amp;lt;mm:formatter /&amp;gt; and &amp;lt;mm:xslt /&amp;gt; tags.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:formatter escape=&quot;none&quot;&amp;gt;&lt;br /&gt;  &amp;lt;mm:include page=&quot;http://www.mmbase.org/rss/&quot; cite=&quot;true&quot; /&amp;gt;&lt;br /&gt;  &amp;lt;mm:xslt&amp;gt;&lt;br /&gt;    &amp;lt;xsl:template match=&quot;channel&quot; &lt;br /&gt;      xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;&amp;gt;&lt;br /&gt;      &amp;lt;ol&amp;gt;&lt;br /&gt;        &amp;lt;xsl:for-each select=&quot;item&quot;&amp;gt;&lt;br /&gt;          &amp;lt;li&amp;gt;&lt;br /&gt;    	    &amp;lt;a href=&quot;{link}&quot;&amp;gt;&amp;lt;xsl:value-of select=&quot;title&quot; /&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;          &amp;lt;/li&amp;gt;&lt;br /&gt;        &amp;lt;/xsl:for-each&amp;gt;&lt;br /&gt;       &amp;lt;/ol&amp;gt;&lt;br /&gt;    &amp;lt;/xsl:template&amp;gt;&lt;br /&gt;  &amp;lt;/mm:xslt&amp;gt;&lt;br /&gt;&amp;lt;/mm:formatter&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;When you run a recent version of mmbase you'll find the output of this example at http://127.0.0.1:8080/mmbase/about/core/mmbase_news&lt;/p&gt;&lt;h4&gt;Publication dates&lt;/h4&gt;&lt;p&gt;It's a pity that RSS-feeds have a rather ugly way of displaying dates. You can select and print an item's publication date with:&lt;/p&gt;
&lt;pre&gt;&amp;lt;xsl:variable name=&quot;datum&quot; select=&quot;pubDate&quot; /&amp;gt;&lt;/pre&gt;
&lt;p&gt;That prints for example 'Mon, 26 Oct 2009 12:00:00 +0100'.  Convertion of these dates to something more readable has to be done in Java code.&lt;/p&gt;</content></entry><entry xmlns:media="http://search.yahoo.com/mrss/"><title>&lt;mm:time time=&quot;today&quot; /&gt; prints today's date</title><link href="http://www.toly.nl/mmbase/426/_mm_time_time__today_____prints_today_s_date"/><id>http://www.toly.nl/mmbase/426/_mm_time_time__today_____prints_today_s_date</id><updated>2010-03-08T13:30:33Z</updated><published>2007-01-19T00:00:00Z</published><author><name>André</name></author><summary type="html">The  tag in the taglib has some great features. You can for example print today's date like &quot;Thursday 8 February 2007&quot; with a simple statement   &amp;lt;mm:time time=&quot;today&quot; format=&quot;EEEE dd MMMM yyyy&quot; /&amp;gt;.</summary><content type="html">The  tag in the taglib has some great features. You can for example print today's date like &quot;Thursday 8 February 2007&quot; with a simple statement   &amp;lt;mm:time time=&quot;today&quot; format=&quot;EEEE dd MMMM yyyy&quot; /&amp;gt;.&lt;p&gt;In your terminal change ('cd') to a directory that contains 'mmbase.jar', normally you will have one your local mmbase installations 'WEB-INF/lib' directory. Then insert this on the command line:&lt;/p&gt;
&lt;pre&gt;java -cp mmbase.jar org.mmbase.util.DynamicDate
&lt;/pre&gt;
&lt;p&gt;You can also pass a classpath for mmbase. But this is the easiest way. The command will print the following which basically is an example of allmost all the ways to use the  tag:&lt;/p&gt;
&lt;pre&gt;AD 1970-01-01 01:00:00.000 CET do       0
AD 1970-01-01 03:46:40.000 CET do       10000
AD 1969-12-31 22:13:20.000 CET wo       -10000
AD 1970-01-01 01:16:40.000 CET do       +1000
AD 1973-05-03 00:00:00.000 CET do       1973-05-03
AD 2006-05-09 00:00:00.000 CEST di      2006-05-09
BC 0004-12-25 00:00:00.000 CET di       -3-12-25
AD 2000-01-01 16:00:00.000 CET za       2000-01-01 16:00
AD 2001-01-01 17:00:00.000 CET ma       TZUTC 2001-01-01 16:00
AD 2007-01-24 12:34:56.789 CET wo       today 12:34:56.789
AD 2007-01-24 11:16:21.998 CET wo       now
AD 2007-01-24 00:00:00.000 CET wo       today
AD 2007-01-25 00:00:00.000 CET do       tomorrow
AD 2007-01-24 11:26:22.011 CET wo       now + 10 minute
AD 2007-01-29 00:00:00.000 CET ma       today + 5 day
AD 2007-01-01 00:00:00.000 CET ma       now this year
AD 2007-08-01 00:00:00.000 CEST wo      next august
AD 2007-08-01 00:00:00.000 CEST wo      today + 6 month next august
AD 2007-01-01 00:00:00.000 CET ma       tomonth
AD 2007-01-26 17:00:00.000 CET vr       borreltijd
AD 2007-01-28 23:57:03.691 CET zo       today + 5 dayish
AD 2006-01-01 00:00:00.000 CET zo       yesteryear
AD 2007-01-21 23:56:42.390 CET zo       mondayish
AD 1970-01-01 01:05:00.000 CET do       duration + 5 minute
AD 2070-01-01 01:00:00.000 CET wo       duration + 100 year
AD 2007-01-24 13:00:00.000 CET wo       TZUTC today noon
AD 2007-01-24 12:00:00.000 CET wo       TZEurope/Amsterdam today noon
AD 2007-01-24 01:00:00.000 CET wo       TZUTC today
AD 2007-01-24 00:00:00.000 CET wo       TZEurope/Amsterdam today
AD 2007-01-24 13:00:00.000 CET wo       TZ UTC today noon
AD 2007-01-24 12:00:00.000 CET wo       TZ Europe/Amsterdam today noon
AD 2007-01-24 01:00:00.000 CET wo       TZ UTC today
AD 2007-01-24 00:00:00.000 CET wo       TZ Europe/Amsterdam today
AD 1970-01-01 00:43:20.000 CET do       TZ Europe/Amsterdam -1000
AD 2007-01-24 06:00:00.000 CET wo       today 6 oclock
AD 2007-01-24 23:00:00.000 CET wo       today 23 oclock
AD 2007-01-25 19:00:00.000 CET do       today 43 oclock
AD 2007-01-24 11:16:22.000 CET wo       tosecond
AD 2007-01-24 11:16:00.000 CET wo       tominute
AD 2007-01-24 11:00:00.000 CET wo       tohour
AD 2007-01-24 00:00:00.000 CET wo       today
AD 2007-01-22 00:00:00.000 CET ma       previous monday
AD 2007-01-01 00:00:00.000 CET ma       tomonth
AD 2007-01-01 00:00:00.000 CET ma       toyear
AD 2000-01-01 00:00:00.000 CET za       tocentury
AD 2001-01-01 00:00:00.000 CET ma       tocentury_pedantic
AD 0001-01-01 00:00:00.000 CET za       toera
AD 2007-01-24 11:16:22.000 CET wo       now this second
AD 2007-01-24 11:16:00.000 CET wo       now this minute
AD 2007-01-24 11:00:00.000 CET wo       now this hour
AD 2007-01-24 00:00:00.000 CET wo       now this day
AD 2007-01-22 00:00:00.000 CET ma       today previous monday
AD 2007-01-01 00:00:00.000 CET ma       now this month
AD 2007-01-01 00:00:00.000 CET ma       now this year
AD 2000-01-01 00:00:00.000 CET za       now this century
AD 0001-01-01 00:00:00.000 CET za       now this era
AD 2000-01-01 00:00:00.000 CET za       now - 15 year this century
AD 2001-01-01 00:00:00.000 CET ma       now - 20 year this century_pedantic
AD 2207-01-24 00:00:00.000 CET za       today + 2 century
BC 0001-12-31 23:59:00.000 CET vr       toera - 1 minute
AD 2007-07-01 00:00:00.000 CEST zo      this july
AD 2006-07-01 00:00:00.000 CEST za      previous july
AD 2007-07-01 00:00:00.000 CEST zo      next july
AD 2007-01-28 00:00:00.000 CET zo       this sunday
AD 2007-01-21 00:00:00.000 CET zo       previous sunday
AD 2007-01-28 00:00:00.000 CET zo       next sunday
AD 2008-12-29 00:00:00.000 CET ma       2009-W01-01
AD 2010-01-03 00:00:00.000 CET zo       2009-W53-7
AD 2006-05-03 00:00:00.000 CEST wo      2006-123
AD 2004-12-27 00:00:00.000 CET ma       2005-01-01 this monday
&lt;/pre&gt;
&lt;p&gt;You can use simple strings like 'today', 'tommorrow' or 'next sunday' to enter a time to display with the tag.&lt;/p&gt;
&lt;pre&gt;&amp;lt;mm:time time=&quot;next sunday&quot; format=&quot;dd MMMM yyyy&quot; /&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;Will print the following depending on your locale settings:&lt;/p&gt;
&lt;pre&gt;28 January 2007
&lt;/pre&gt;
&lt;p&gt;The attribute format is controlled like defined in java.util.SimpleDateFormat.&lt;br /&gt; The defauls language behaviour is set in 'conf/modules/mmbaseroot.xml'. You can influence it on a page by page basis for example with the &amp;lt;mm:content /&amp;gt; tag.&lt;/p&gt;&lt;ul&gt;
          &lt;li&gt;
          &lt;a href="http://www.mmbase.org/mmdocs/applications/taglib/build/frontenddevelopers/taglib/"&gt;MMBase Taglib reference&lt;/a&gt;
          &lt;br /&gt;The reference for all tags mm
          &lt;/li&gt;
          
          &lt;li&gt;
          &lt;a href="http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html"&gt;java.text.SimpleDateFormat&lt;/a&gt;
          &lt;br /&gt;The &lt;mm:time /&gt; tag uses the same parameters as Java's SimpleDateFormat
          &lt;/li&gt;
          &lt;/ul&gt;</content></entry></feed>