We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum
How to: Single list of employees, sorted by department as categories, with multi...
Iâ€™m working on a team-page for a company where about 40 employees are sorted into departments. Their department affiliation is changing a lot due to restructuring. So I decided to make a category set of â€ždepartmentsâ€œ, where the client can change/add/create new categories if they need, and choose from the categories for each employee. The employee list is a multiple-item region.
All of this is placed on a single team-page. What I want is a list of departments, and the employees in that department. I got it working so that the heading of the department is only shown if it is different from the last one. Re-ordering employees makes the list work almost completely.
Some employees are in multiple departments, and this is where my current solution stops working: When I add two or more categories to an employee, using the following template, the heading (h3) is repeated, and the employee is added after the last of his/her categories:
<?php perch_content('BÃ¼roteam'); ?>
<perch:before> <div class="container container--team"> </perch:before> <perch:if different="team-abteilungen"> <perch:categories id="team-abteilungen" label="Abteilung" set="team-abteilungen" required="true" /><h3 class="abteilung" id="<perch:category id="catSlug" label="Kurzname" />"><perch:category id="catTitle" /></h3></perch:categories> </perch:if> <div class="person"> <img src="<perch:content type="image" id="foto" label="Foto" required="true" />" /> <div class="contact-info"> <h3><perch:content type="text" id="vorname" label="Vorname" required="true" /> <perch:content type="text" id="nachname" label="Nachname" required="true" title="true" /></h3> <perch:if exists="position"> <p><perch:content type="text" id="position" label="Position/Aufgaben" /></p> </perch:if> </div> <!-- .contact-info --> </div> <!-- .person --> <perch:after> </div> </perch:after>
How can I make a list of all employees, where I donâ€™t have to add the same person multiple times with a different category selected, but can select multiples from my categories so that the employee gets repeated automatically for each category he/she is in? So this:
Jane Doe: Category 1 and 3 John Doe: Category 1 and 2 Mark Doe: Category 3
should become this:
Category 1 Jane Doe John Doe Category 2 John Doe Category 3 Mark Doe Jane Doe
Iâ€™m already using perch_categories() to display a list of all categories on top of the page (for jumping to a department quickly), but I couldnâ€™t get the categories list to work with additional parameters for sorting etc. They just didnâ€™t display.
Best regards, Jannis
Want to reply to this thread?Login with Perch