Recently Browsing 0 members
No registered users viewing this page.
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.
I as have been a bit confused for some time about how the "Markup Regions" functionality in Processwire worked.
But i have know read a bit more and think that i am getting to grips with it. And Markup Regions is going to be huge.
To aid me in understanding Markup Regions better i started to read the Source code for the new "Regular" theme in conjunction with the Blog about the markup regions.
It helped me a great deal to understand the basics and more fine details of it.
A tip is to open both links and use the Source code of the "Regular" theme while reading the blog post.
The Source code:
The Blog post:
I hope this could help others starting out with markup regions.
Just take it slow and read it a couple a times and soon you will see the greatness of markup regions.
So I am making a front-end dashboard for an internal project, and was curious if it is possible to match 2 pages together based on their title and retrieve the data.
To make it more clear:
I have two pages "Section A" and "Section B" that each has child pages with names (the specific person) with subpages for their services offered.
Section A - John Doe (name=john-doe) - Service 1 - Service 2 - Service 3 - Jane Doe (name=jane-doe) - Service 1 - Service 2 - Service 3 Section B - John Doe (name=john-doe) - Service 4 - Service 5 - Service 6 - Jane Doe (name=jane-doe) - Service 4 - Service 5 - Service 6 What I would like to achieve on the front-end (if it is even possibile), is an output like:
John Doe - Service 1 - Service 2 - Service 3 - Service 4 - Service 5 - Service 6 Jane Doe - Service 1 - Service 2 - Service 3 - Service 4 - Service 5 - Service 6 Thinking aloud: use a find to get all pages using the template "service user" and then foreaching through their children (and possibly getting a few field values as well) to output in the front end. The service templates used in the sections vary slightly in which fields they use.
<?php $findUsers = $pages->find("template=service-a (and or) service-b,(some how match based on names)"); //if no match exists, output what is available ?> <ul> <?php foreach ($findUsers as $groupedUser): ?> <li><?php echo $groupedUser->title; ?></li> <li><?php echo $groupedUser->service_a_location; ?></li> <li><?php echo $groupedUser->service_a_body; ?></li> <li><?php echo $groupedUser->service_b_location; ?></li> <li><?php echo $groupedUser->service_b_phone; ?></li> <?php endforeach; ?> </ul> Sorry, it is just me thinking aloud, but I was not even sure if it is possible to group them together like that. I was going to have a page for each "section" only displaying that data, but I thought it would be nice to display them all together as an overview for the user.
Just a quick question, I have a function in my ready.php file that creates a new js file inside the "scripts" folder (under templates). Everything is working as expected, however, is it possible for the url to look like www.domain.com/scripts/generated.js ?
Currently, the only way I can access it is via www.domain.com/site/templates/scripts/generated.js. Or is there a better place I should be putting these scripts ? I I am trying to use the scripts elsewhere (not on the processwire install).