Comment function

1. Inclusion

The comment function module is a module that can be configured and included in each web page by adding an XML tag:

APF template
<core:importdesign namespace="APF\modules\comments\pres\templates" template="comment" categorykey="{CAT_KEY}" />

The value "{CAT_KEY}" must be changed to something meaningful.

2. Configuration

2.1. Application configuration

The module uses a database table to save the comments. For this reason, a database configuration must be defined in the module's configuration. The name of the configuration file is


and the content looks as follows:

APF configuration
[Default] Database.ConnectionKey = "..."

Details on the configuration can be taken from the Configuration chapter.

2.2. Pager configuration

Displaying a scrollable list of comments the comment module uses the Pager which requires a configuration as the module it self does.

To configure the Pager two options are provided: using the PagerManagerFabric (deprecated since 2.0 ) or the DIServiceManager. Here, the latter one is used.

Please create a configuration file named


and add the following content:

APF configuration
[CommentsPager] servicetype = "SINGLETON" class = "APF\modules\pager\biz\PagerManager" conf.entries-per-page.method = "setEntriesPerPage" conf.entries-per-page.value = "..." conf.url-param-page.method = "setPageUrlParameterName" conf.url-param-page.value = "..." conf.url-param-count.method = "setCountUrlParameterName" conf.url-param-count.value = "..." conf.statement-namespace.method = "setStatementNamespace" conf.statement-namespace.value = "APF\modules\comments" conf.count-statement.method = "setCountStatementFile" conf.count-statement.value = "load_entries_count.sql" conf.entries-statement.method = "setEntriesStatementFile" conf.entries-statement.value = "load_entry_ids.sql" conf.statement-params.method = "setStatementParameters" conf.statement-params.value = "CategoryKey:standard" conf.ui-namespace.method = "setPagerUiNamespace" conf.ui-namespace.value = "APF\modules\pager\pres\templates" conf.ui-template.method = "setPagerUiTemplate" conf.ui-template.value = "pager_2" conf.database-connection.method = "setDatabaseConnectionName" conf.database-connection.value = "MySQLi" conf.dynamic-page-size.method = "setAllowDynamicEntriesPerPage" conf.dynamic-page-size.value = "true"

Now, please fill conf.entries-per-page.value, conf.url-param-page.value, and conf.url-param-count.value with appropriate values according to your application.

Details on the options above can be taken from chapter Pager.

2.3. CSS adaption

In order to adapt the design of the module fitting your page layout, several classes are included in the HTML markup. For a start, you can use the stylesheet, that is delivered together with the module's code:

APF template

Including the module into your page, your stylesheet should contain the content of the example file. This can be achieved by adding the whole stylesheet to your page header or by defining the relevant classes within your existing stylesheets.

2.4. CAPTCHA module

To protect the comment form from spam posts, the form was added the CAPTCHA tag (for forms). This APF module needs further configuration in order to dynamically display the captcha module. So please take the steps necessary from the linked module desciption page.

3. Note

A detailed description on the function of this module can be found in the tutorials section under Comment function.


Do you want to add a comment to the article above, or do you want to post additional hints? So please click here. Comments already posted can be found below.
There are no comments belonging to this article.