We publish content to a SQL database for use on some dynamic pages on our site, and we are considering consolidating our database publish and unpublish templates. Right now, each content type has two database templates, which are identical except for the value for the binding of $db.action. Maintenance is a hassle, since every change to database publishing involves changing two templates.
We figured out that we could test the value of $sys.params.sys_itemfilter in the template to determine whether to set the $db.action binding to “r” (to publish the row) or “d” (to unpublish the row), and thus use the same template for both publish and unpublish. The item filter value comes from the content list being used, but can be checked within the template.
Does anyone have any comments on possible pitfalls of this approach?