| Connect to the dotCMS Using webDAV | Create a Customized Web Page |
1.The dotCMS Wiki functionality is provided mainly for a filter that takes the Wiki requests and redirects them to the proper page that display the info of the object provided by the filter. The filter should be configured in the web.xml, dotCMS by default has this filter configured this way: (note : This can be done via a plugin as of 1.7 in teh web-ext.xml)
Name and Java Class of the Filter:
<filter>
<filter-name>WikiFilter</filter-name>
<filter-class>com.dotmarketing.cms.wiki.filters.WikiFilter</filter-class>
</filter>
Filter mapping which will be processed by the filter:
<filter-mapping> <filter-name>WikiFilter</filter-name> <url-pattern>/documentation/*</url-pattern> </filter-mapping>
As you can see the filter will process all the request of this form:
If you want to have a different Wiki URL such as /wiki/ you will need to modify the web.xml to have this entry
$ecs.html("
WikiFilter
/wiki/*
")
You need to create one filter mapping for each Wiki URL that you want to have on your site.
2. The filter retrieves the object that will be displayed in the Wiki, to do that we have to configure some entries in the dotmarketing-config.properties. (Note: This can be configured in a plugin as of 1.7)
You need to configure the following properties:
Where XXX is a number from 0 to 99, in case you want to configure multiple Wiki instances.
dotcms.wikiXXX.uri: this is the URI used in the filter configured in the web.xml file.
dotcms.wikiXXX.structure: This is the name of the structure that will be retrieved by the filter and the one that will be displayed later in the Wiki page.
dotcms.wikiXXX.field: This is the name of the field that will be used as a Key to retrieve the contentlet to be displayed.
Note: remember that those three entries with the same number, are a group and will be related, that URI with that structure and that field, and we should have a group of three for each filter-mapping added to the web.xml.
As Example: #wiki dotcms.wiki0.uri=/documentation dotcms.wiki0.structure=dotCMS Documentation dotcms.wiki0.field=text1 dotcms.wiki1.uri=/wiki dotcms.wiki1.structure=Wiki Structure dotcms.wiki1.field=text1
This shows the configuration of a site running two instances of the wiki one for /documentation and the other for /wiki.
3. After the filter is ready and the configuration values are set, we should create the structure configured in the dotmarketing-config.properties. This structure is like any other dotCMS structure with text fields, WYSIWYG fields, date fields, categories, etc. the only restrictions that this structure has are: 1. The name of the structure should be the name added to the dotmarketing-config.properties file, as example the name of the structure should be “dotCMS Documentation”. 2. The field used as a Key to find the entries has to exist in the structure and should be unique.
As you can see in screenshot above, we have the field “text1” for the structure “dotCMS Documentation”.
4. After the filter is configured and the structure is created, we have to create the page that will display the data of the Wiki, the main page is always an index page in the folder configure for that instance of the wiki, like this one. "/wikiUri/index.dot" Where the wikiUri is the value added in the dotmarketing-config,properties and the .dot is the extension used by your instance of dotCMS. On that page, you could retrieve the contentlet identifier from the request and get the contentlet itself to display the info of the contentlet. To retrieve the identifier you have to retrieve as an attribute using this as the parameter’s name: com.dotmarketing.wiki.contentlet
As Example:
#set($id= ${request.getAttribute("com.dotmarketing.wiki.contentlet")})
#if($id)
#getContent($id)
#set($docContent = $content)
#end
If you don’t want do configure your own wiki, you could use the dotCMS’ default wiki, the info for this default wiki is the one that follow:
<filter>
<filter-name>WikiFilter</filter-name>
<filter-class>com.dotmarketing.cms.wiki.filters.WikiFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>WikiFilter</filter-name>
<url-pattern>/documentation/*</url-pattern>
</filter-mapping>
#wiki
dotcms.wiki0.uri=/documentation
dotcms.wiki0.structure=dotCMS Documentation
dotcms.wiki0.field=text1
Also the dotCMS’ default Wiki provides some extra functionality that will allow you create a tree of the documents you add to the wiki, that could be achieve using a relationship between two elements of the “dotCMS Documentation” structure, which will create a father-child relationship between them.
The relationship is already defined in the dotCMS’ default Wiki, you just have to add the relation to the contentlets when you create them.
DocParent-DocChild | dotCMS Documentation | dotCMS Documentation
Also the default Wiki adds two more relations to other two structures, but those two relations are more specific for the kind of Wiki we use, the relations are:
docParent-childScreencast | dotCMS Documentation | Video and Screencast
dotCMS_Documentation-Comments | dotCMS Documentation | Macro Documentation
To call or link an entry after you have configured the Wiki, you need two parts in the URI: http://serverName/wikiUri/entryId
Where: wikiUri: is the name uri you have assigned to the Wiki in the dotmarketing-config.properties and the filter-mapping added to the Wiki in the web.xml.
entryId: is the value to be searched in the field set in the “field” entry of the dotmarketing-config.properties.
As Example:
http://www.dotcms.org/documentation/TableOfContents
serverName : dotcms.org
wikiUri: documentation
entryId: TableOfContents
Example of a live Wiki: http://dotcms.org/documentation
This article is provided by :Taylor University http://www.taylor.edu/
| Connect to the dotCMS Using webDAV | Create a Customized Web Page |
Post a Comment