Recently Browsing 0 members
No registered users viewing this page.
Any guidance, remarks, comments, or a nudge in the right direction greatly appreciated.
By Moritz Both
For our PW project we use markup regions and, for one template, url segments. The documentation recommends throwing a new Wire404Exception() from the template when the code concludes that the url segments from the request are invalid, and so we do.
However, the 404 page is not displayed properly. Viewing the page source in the browser we can see that the original, unmodified markup region contents from our _init.php file is prepended to the correct html output, messing the whole page up.
Any advice is greatly appreciated.
By Robin S
This module corrects a few things that I find awkward about the "Add New Template" workflow in the PW admin. I opened a wishlist topic a while back because it would good to resolve some of these things in the core, but this module is a stopgap for now.
Originally I was going to share these as a few standalone hooks, but decided to bundle them together in a configurable module instead.
Add Template Enhancements
A module for ProcessWire CMS/CMF. Adds some efficiency enhancements when adding or cloning templates via admin.
Derive label from name when new template added: if you like to give each of your templates a label then this feature can save some time. The label can be added automatically when templates are added in admin, in admin/API, or not at all. There are options for underscore/hyphen replacement and capitalisation of the label. Edit template after add: when adding only a single template, the template is automatically opened for editing after it is added. Copy field contexts when cloning: this copies the field contexts (a.k.a. overrides such as column width, label and description) from the source template to the new template when using the "Duplicate/clone this template?" feature on the Advanced tab. Copy field contexts when duplicating fields: this copies the field contexts if you select the "Duplicate fields used by another template" option when adding a new template. Usage
Install the Add Template Enhancements module.
Configure the module settings according to what suits you.
On a new pw 3.0.89 installation of mine I've got a problem with role permissions. The setup is like this:
Templates: home, basic-page, text-only, folder
All of these have no restrictions in the "family" section and all of them have the same access definitions (see edit-template.jpg below)
There is a role "redaktor" that has permission to edit, add, delete, move and also clone pages (see permissions.jpg below).
Now, when logged in as a user with this role, I can only choose from basic-page and folder. The text-only template is not available.
lets say, in _main.php I have some placeholder regions for content/sidebar
<div id="content">foo</div> <div id="sidebar">bar</div> in my home.php template, maybe i don't want the sidebar div at all. But when I put in the intentionally blank code
<region id="sidebar"></region> I simply make my sidebar div blank, it doesn't remove it.
Q: Is there a slick way to simply nuke that div#sidebar entirely from markup?