{"id":1190,"date":"2025-10-05T19:43:18","date_gmt":"2025-10-05T17:43:18","guid":{"rendered":"https:\/\/darrigan.net\/blog\/?p=1190"},"modified":"2025-10-06T21:58:22","modified_gmt":"2025-10-06T19:58:22","slug":"manage-site-pages-in-collectiveaccess","status":"publish","type":"post","link":"https:\/\/darrigan.net\/blog\/manage-site-pages-in-collectiveaccess\/","title":{"rendered":"Manage \u00ab\u00a0site pages\u00a0\u00bb in CollectiveAccess"},"content":{"rendered":"<p>In <a href=\"https:\/\/collectiveaccess.org\/\" target=\"_blank\" rel=\"noopener\">CollectiveAccess<\/a> (CA) code, <em>Providence<\/em> can manage \u00ab\u00a0site pages\u00a0\u00bb in the <em>Pawtucket2<\/em> part but are not well known by users. This is a concrete example of how to use them and (optional) customize the top menu bar with a drop-down list.<!--more--><\/p>\n<p>This tutorial is tested for <a href=\"https:\/\/collectiveaccess.org\/\" target=\"_blank\" rel=\"noopener\">CollectiveAccess<\/a> 2.0.9 but may work with earlier and later versions.<\/p>\n<p>Suppose you want to add some site pages such as \u00ab\u00a0Contribute\u00a0\u00bb, \u00ab\u00a0Terms of use\u00a0\u00bb, \u00ab\u00a0Contact\u00a0\u00bb, \u00ab\u00a0About\u00a0\u00bb, etc., in the public site (<em>Pawtucket2<\/em>). You can manage these pages apart from content relating to the collection base itself. In <em>Providence<\/em>, it&rsquo;s possible to manage \u00ab\u00a0site pages\u00a0\u00bb that allow you to edit the content of these pages directly in <em>Providence<\/em> (instead of editing them \u00ab\u00a0by hand\u00a0\u00bb).<\/p>\n<p>This functionality is documented in <a href=\"https:\/\/pawtucket2.readthedocs.io\/en\/latest\/pawtucket\/templates.html#\" target=\"_blank\" rel=\"noopener\">this old user guide<\/a> (<a href=\"https:\/\/docs.collectiveaccess.org\/providence\/\" target=\"_blank\" rel=\"noopener\">actual user guide<\/a> of CA is not yet completed).<\/p>\n<h2>Template files<\/h2>\n<p>\u00ab\u00a0Template files\u00a0\u00bb (.tmpl) are already present in default install in the <em>Pawtucket2<\/em> directory <span style=\"font-family: courier new, courier, monospace;\">\/themes\/&lt;your_theme&gt;\/templates<\/span> and you don&rsquo;t have to create one, excepting if you want a custom template.<\/p>\n<p>The existing template files are: <span style=\"font-family: courier new, courier, monospace;\">about.tmpl<\/span> and <span style=\"font-family: courier new, courier, monospace;\">staffpage.tmpl<\/span>.<\/p>\n<p style=\"padding-left: 40px;\">Remark: <span style=\"font-family: courier new, courier, monospace;\">about.tmpl<\/span> is <strong>not<\/strong> to be confused with the \u00ab\u00a0About\u00a0\u00bb default page&#8230; which is edited by hand in <span style=\"font-family: courier new, courier, monospace;\">\/themes\/&lt;your_theme&gt;\/views\/About\/Index.php<\/span>. To avoid confusion, I suggest to rename the file <span style=\"font-family: courier new, courier, monospace;\">about.tmpl<\/span> by <span style=\"font-family: courier new, courier, monospace;\">simple_page.tmpl<\/span> (for example). Every time you change or add a template file, you&rsquo;ll need to relaunch the <span style=\"font-family: courier new, courier, monospace;\">caUtils<\/span> script to update templates (see after).<\/p>\n<p>The <span style=\"font-family: courier new, courier, monospace;\">about.tmpl<\/span> template is:<\/p>\n<pre>&lt;div class=\"row\"&gt;\r\n\t&lt;div class=\"col-sm-12\"&gt;\r\n\t\t&lt;H1&gt;{{{title}}}&lt;\/H1&gt;\r\n\t\t&lt;h2&gt;{{{subtitle}}}&lt;\/h2&gt;\r\n\t\t{{{bodytext}}}\r\n\t\t&lt;div&gt;&lt;em&gt;Viewed {{{page_view_count}}} times &lt;\/em&gt;&lt;\/div&gt;\r\n\t&lt;\/div&gt;\r\n&lt;\/div&gt;<\/pre>\n<p>It defines 3 fields in this site page: <span style=\"font-family: courier new, courier, monospace;\">title<\/span> (of the page), <span style=\"font-family: courier new, courier, monospace;\">subtitle<\/span> (if needed) and the <span style=\"font-family: courier new, courier, monospace;\">bodytext<\/span> of the page, that can accept \u00ab\u00a0rich text\u00a0\u00bb format.<\/p>\n<p>The field <span style=\"font-family: courier new, courier, monospace;\">page_view_count<\/span> will be replaced automatically by <em>Pawtucket2<\/em>, but you can remove this line if don&rsquo;t want to display counting if visitors.<\/p>\n<p>First thing to do is executing the <span style=\"font-family: courier new, courier, monospace;\">caUtils<\/span> script to scan existing templates:<\/p>\n<ul>\n<li>Open a terminal windows and go to the <em><strong>Pawtucket2<\/strong><\/em> directory <span style=\"font-family: courier new, courier, monospace;\">\/support\/bin<\/span><\/li>\n<li>Execute:<br \/>\n<span style=\"font-family: courier new, courier, monospace;\">php -f caUtils scan-site-page-templates<\/span><br \/>\nor:<br \/>\n<span style=\"font-family: courier new, courier, monospace;\">sudo .\/caUtils scan-site-page-templates<\/span><\/li>\n<li>This will give you:<\/li>\n<\/ul>\n<p style=\"padding-left: 40px;\"><span style=\"font-family: courier new, courier, monospace;\">CollectiveAccess 2.0 (204\/GIT) Utilities<br \/>\n<\/span><span style=\"font-family: courier new, courier, monospace;\">(c) 2013-2019 Whirl-i-Gig<br \/>\n<\/span><span style=\"font-family: courier new, courier, monospace;\">Scanning templates for tags<br \/>\n<\/span><span style=\"font-family: courier new, courier, monospace;\">Added 2 templates; updated 0 templates<\/span><\/p>\n<p>This command parses the <em>Pawtucket2<\/em> <span style=\"font-family: courier new, courier, monospace;\">templates<\/span> directory and add them in the database.<\/p>\n<h2>Create \u00ab\u00a0site pages\u00a0\u00bb<\/h2>\n<p>At this point, you can go to <strong><em>Providence<\/em><\/strong> MANAGE &gt; Content Management interface:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-1193 aligncenter\" src=\"https:\/\/darrigan.net\/blog\/wp-content\/uploads\/2025\/10\/CA-site-pages-1-300x51.jpg\" alt=\"\" width=\"300\" height=\"51\" srcset=\"https:\/\/darrigan.net\/blog\/wp-content\/uploads\/2025\/10\/CA-site-pages-1-300x51.jpg 300w, https:\/\/darrigan.net\/blog\/wp-content\/uploads\/2025\/10\/CA-site-pages-1-624x106.jpg 624w, https:\/\/darrigan.net\/blog\/wp-content\/uploads\/2025\/10\/CA-site-pages-1.jpg 640w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>Choose the desired template page (here <span style=\"font-family: courier new, courier, monospace;\">simple_page<\/span>) and click \u00ab\u00a0+\u00a0\u00bb.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-1194 aligncenter\" src=\"https:\/\/darrigan.net\/blog\/wp-content\/uploads\/2025\/10\/CA-site-pages-2-300x274.jpg\" alt=\"\" width=\"300\" height=\"274\" srcset=\"https:\/\/darrigan.net\/blog\/wp-content\/uploads\/2025\/10\/CA-site-pages-2-300x274.jpg 300w, https:\/\/darrigan.net\/blog\/wp-content\/uploads\/2025\/10\/CA-site-pages-2.jpg 525w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>Here you can name the site page, like \u00ab\u00a0Terms of Use\u00a0\u00bb.<\/p>\n<p>In the \u00ab\u00a0URL path\u00a0\u00bb field, why I choose something like \u00ab\u00a0\/About\/terms-of-use\u00a0\u00bb? Because I would like a menu \u00ab\u00a0About\u00a0\u00bb with drop-down list toward site pages, like for the \u00ab\u00a0Browse\u00a0\u00bb menu.<br \/>\nSo you can create other pages like \u00ab\u00a0Contribute\u00a0\u00bb, \u00ab\u00a0About the collection\u00a0\u00bb (where you can move the content of the actual \u00ab\u00a0About\u00a0\u00bb page). And so on. Do not forget to set the <em>Access<\/em> to \u00ab\u00a0accessible to public\u00a0\u00bb.<\/p>\n<p>The tutorial could end here if you just want to create site pages. But what I would like is for all of these pages to be grouped into an \u00ab\u00a0About\u00a0\u00bb drop-down menu in the top navigation bar.<\/p>\n<h2>Make a drop-down menu<\/h2>\n<p>In <em>Pawtucket2<\/em>, go to directory <span style=\"font-family: courier new, courier, monospace;\">\/themes\/&lt;your_theme&gt;\/views\/pageFormat<\/span> and create a new file named <span style=\"font-family: courier new, courier, monospace;\">aboutMenu.php<\/span> containing this:<!--?php \/* ---------------------------------------------------------------------- * views\/pageFormat\/browseMenu.php : * ---------------------------------------------------------------------- * CollectiveAccess * Open-source collections management software * ---------------------------------------------------------------------- * * Software by Whirl-i-Gig (http:\/\/www.whirl-i-gig.com) * Copyright 2014-2015 Whirl-i-Gig * * For more information visit http:\/\/www.CollectiveAccess.org * * This program is free software; you may redistribute it and\/or modify it under * the terms of the provided license as published by Whirl-i-Gig * * CollectiveAccess is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTIES whatsoever, including any implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * This source code is free and modifiable under the terms of * GNU General Public License. (http:\/\/www.gnu.org\/copyleft\/gpl.html). See * the \"license.txt\" file for details, or visit the CollectiveAccess web site at * http:\/\/www.CollectiveAccess.org * * ---------------------------------------------------------------------- *\/ ?--><\/p>\n<pre><span style=\"color: #000000; font-family: courier new, courier, monospace;\">&lt;li class=\"dropdown active\" style=\"position:relative;\"&gt;\r\n   &lt;a href=\"#\" class=\"dropdown-toggle mainhead top\" data-toggle=\"dropdown\"&gt;About&lt;\/a&gt;\r\n   &lt;ul class=\"dropdown-menu\"&gt;\r\n      &lt;li&gt;&lt;a href=\"https:\/\/complete-url-to-your.site\/index.php\/About\/Index\"&gt;About&lt;\/a&gt;&lt;\/li&gt;\r\n      &lt;li&gt;&lt;a href=\"https:\/\/complete-url-to-your.site\/index.php\/About\/terms-of-use\"&gt;Terms of Use&lt;\/a&gt;&lt;\/li&gt;\r\n      &lt;li&gt;&lt;a href=\"https:\/\/complete-url-to-your.site\/index.php\/About\/contribute\"&gt;Contribute&lt;\/a&gt;&lt;\/li&gt;\r\n      &lt;li&gt;&lt;a href=\"https:\/\/complete-url-to-your.site\/index.php\/About\/contact\"&gt;Contact&lt;\/a&gt;&lt;\/li&gt;\r\n   &lt;\/ul&gt;\t\r\n&lt;\/li&gt;\r\n<\/span><\/pre>\n<p>Each <span style=\"font-family: courier new, courier, monospace;\">&lt;li&gt;&#8230;&lt;\/li&gt;<\/span> line will add a new list item in the drop-down menu, so you can give a custom link pointing to where-you-want with the title you want, in the order you want. In this example, the \u00ab\u00a0About\u00a0\u00bb link points to the default \u00ab\u00a0About\u00a0\u00bb page; other links point to \u00ab\u00a0site pages\u00a0\u00bb created with the Content Management interface. Adapt this part as you like.<\/p>\n<p>In the same directory <span style=\"font-family: courier new, courier, monospace;\">\/themes\/&lt;your_theme&gt;\/views\/pageFormat<\/span> , edit the <span style=\"font-family: courier new, courier, monospace;\">pageHeader.php<\/span> file. You have to insert the call of <span style=\"font-family: courier new, courier, monospace;\">aboutMenu.php<\/span> somewhere to make it appear in the navigation bar.<br \/>\nSearch the following part and add the line #3:<\/p>\n<pre class=\"\"><span style=\"font-family: courier new, courier, monospace;\">&lt;ul class=\"na<span style=\"color: #000000;\">v navbar-nav navbar-right menuItems\" role=\"list\" aria-label=\"&lt;?= _t(\"Primary Navigation\"); ?&gt;\"&gt;\r\n   &lt;li &lt;?= ($this-&gt;request-&gt;getController() == \"About\") ? 'class=\"active\"' : ''; ?&gt;&gt;&lt;?= caNavLink($this-&gt;request, _t(\"About\"), \"\", \"\", \"About\", \"Index\"); ?&gt;&lt;\/li&gt;\r\n   &lt;?= $this-&gt;render(\"pageFormat\/aboutMenu.php\"); ?&gt;\r\n   &lt;?= $this-&gt;render(\"pageFormat\/browseMenu.php\"); ?&gt; \r\n   &lt;li &lt;?= (($this-&gt;request-&gt;getController() == \"Search\") &amp;&amp; ($this-&gt;request-&gt;getAction() == \"advanced\")) ? 'class=\"active\"' : ''; ?&gt;&gt;&lt;?= caNavLink($this-&gt;request, _t(\"Advanced Search\"), \"\", \"\", \"Search\", \"advanced\/objects\"); ?&gt;&lt;\/li&gt;\r\n   &lt;li &lt;?= ($this-&gt;request-&gt;getController() == \"Gallery\") ? 'class=\"active\"' : ''; ?&gt;&gt;&lt;?= caNavLink($this-&gt;request, _t(\"Gallery\"), \"\", \"\", \"Gallery\", \"Index\"); ?&gt;&lt;\/li&gt;\r\n   &lt;li &lt;?= ($this-&gt;request-&gt;getController() == \"Collections\") ? 'class=\"active\"' : ''; ?&gt;&gt;&lt;?= caNavLink($this-&gt;request, _t(\"Collections\"), \"\", \"\", \"Collections\", \"index\"); ?&gt;&lt;\/li&gt; \r\n   &lt;li &lt;?= ($this-&gt;request-&gt;getController() == \"Contact\") ? 'class=\"active\"' : ''; ?&gt;&gt;&lt;?= caNavLink($this-&gt;request, _t(\"Contact\"), \"\", \"\", \"Contact\", \"Form\"); ?&gt;&lt;\/li&gt;\r\n&lt;\/ul&gt;<\/span><\/span><\/pre>\n<p>If you decide to remove \u00ab\u00a0Contact\u00a0\u00bb and \u00ab\u00a0About\u00a0\u00bb default pages because you created new ones into \u00ab\u00a0site pages\u00a0\u00bb, you can remove the lines #2 and #8. You can also move the <span style=\"font-family: courier new, courier, monospace;\">aboutMenu.php<\/span> after the <span style=\"font-family: courier new, courier, monospace;\">Collections<\/span> button.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In CollectiveAccess (CA) code, Providence can manage \u00ab\u00a0site pages\u00a0\u00bb in the Pawtucket2 part but are not well known by users. This is a concrete example of how to use them and (optional) customize the top menu bar with a drop-down list.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[39],"tags":[121,122,46],"_links":{"self":[{"href":"https:\/\/darrigan.net\/blog\/wp-json\/wp\/v2\/posts\/1190"}],"collection":[{"href":"https:\/\/darrigan.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/darrigan.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/darrigan.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/darrigan.net\/blog\/wp-json\/wp\/v2\/comments?post=1190"}],"version-history":[{"count":21,"href":"https:\/\/darrigan.net\/blog\/wp-json\/wp\/v2\/posts\/1190\/revisions"}],"predecessor-version":[{"id":1214,"href":"https:\/\/darrigan.net\/blog\/wp-json\/wp\/v2\/posts\/1190\/revisions\/1214"}],"wp:attachment":[{"href":"https:\/\/darrigan.net\/blog\/wp-json\/wp\/v2\/media?parent=1190"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/darrigan.net\/blog\/wp-json\/wp\/v2\/categories?post=1190"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/darrigan.net\/blog\/wp-json\/wp\/v2\/tags?post=1190"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}