Hi smartpill, from which place into which new place you need to move content? And which content it is?
Within the child categories is a field “f_chair” if this is not empty (starts line 11 above):
{if '{exp:single_field field="f_chair" entry_id="{entry_id}"}' != ''}
{exp:replace_plus find='<p>{exp:single_field field="f_first" entry_id="{entry_id}"}
{exp:single_field field="f_last" entry_id="{entry_id}"}, <i>Chair</i></p>'}{/exp:replace_plus}{/if}
I want that content to appear right after <div class=”staffList”> which I have (see line 4) as
{replace_area}{/replace_area}
Basically it should appear as if it were the single entry in the parent category. I’m using the parent categories as a “Department” and the child categories as “Programs” within the Department. Each entry is for a staff member who is assigned to a “Program” (a.k.a “child category”) as an entry.
One staff member (entry) is also “Department Chair”. This is indicated by checking a box in the field “f_chair”. Those people are listed in two places, a “Program” (child category) and need to be additionally listed as I’ve indicated above.
Hi smartpill,
From my point of view, your main problem is this: you need to get the output of conditional
{if '{exp:single_field field="f_chair" entry_id="{entry_id}"}' != ''}
{exp:single_field field="f_last" entry_id="{entry_id}"}, <i>Chair</i>{/if}
and only then to move the output if available.
This is not possible using usual conditionals.
My suggestion is this: at first get the code
{exp:single_field field="f_last" entry_id="{entry_id}"}, <i>Chair</i>
outputted inside correct child categories using Switchee plugin v1.5 and its
excise="min"
parameter. Then it will be possible to move this piece of code inside the output of {parent_category_start}{parent_category_end} variable pair by using Reeposition plugin.
OK. Sooooooo close.
Only problem now is the line moved with Reeposition only outputs the last item that matches the Switchee condition, so I get the same data every time. Look at example here. You’ll see the lines under “Department” that end with “chair” list the same person when they should be different. But everything else is perfect.
Here’s the most current code:
{exp:reeposition}
{exp:child_categories parent="13|14" show_empty="no" weblog="faculty" parse="inward"
entries_sort_by="title" entries_sort_direction="asc"}
{parent_category_start}
<h4 id="oc_{parent_category_url_title}" class="h_rule">{parent_category_name} Department</h4>
<div class="staffList">{reeposition:put_item}{parent_category_end}
{child_category_start}
<h4>{child_category_name}</h4><div>{child_category_end}
{entries_wrapper_top_start}
<ul>
{entries_wrapper_top_end}
{entries_start}
{exp:switchee variable="{exp:single_field field='f_chair' entry_id='{entry_id}'}" excise="min" parse="inward"}
{case value="y"}{reeposition:item}{exp:single_field field="f_first" entry_id="{entry_id}"}
{exp:single_field field="f_last" entry_id="{entry_id}"}, <i>Chair</i>{/reeposition:item}
{/case}
{case default="Yes"}<li>{exp:single_field field='f_first' entry_id='{entry_id}'}
{exp:single_field field='f_last' entry_id='{entry_id}'}</li>{/case}
{/exp:switchee}
{entries_end}
{entries_wrapper_bottom_start}</ul>{entries_wrapper_bottom_end}
{/exp:child_categories}
{/exp:reeposition}
Hi,
You don’t use “id” parameter of {reeposition:item} and {reeposition:put_item} variables. Try this code:
{exp:reeposition}
{exp:child_categories parent="13|14" show_empty="no" weblog="faculty" parse="inward"
entries_sort_by="title" entries_sort_direction="asc"}
{parent_category_start}
<h4 id="oc_{parent_category_url_title}" class="h_rule">{parent_category_name} Department</h4>
<div class="staffList">{reeposition:put_item id="chair_{parent_category_id}"}{parent_category_end}
{child_category_start}
<h4>{child_category_name}</h4><div>{child_category_end}
{entries_wrapper_top_start}
<ul>
{entries_wrapper_top_end}
{entries_start}
{exp:switchee variable="{exp:single_field field='f_chair' entry_id='{entry_id}'}" excise="min" parse="inward"}
{case value="y"}{reeposition:item id="chair_{parent_category_id}"}{exp:single_field field="f_first" entry_id="{entry_id}"}
{exp:single_field field="f_last" entry_id="{entry_id}"}, <i>Chair</i>{/reeposition:item}
{/case}
{case default="Yes"}<li>{exp:single_field field='f_first' entry_id='{entry_id}'}
{exp:single_field field='f_last' entry_id='{entry_id}'}</li>{/case}
{/exp:switchee}
{entries_end}
{entries_wrapper_bottom_start}</ul>{entries_wrapper_bottom_end}
{/exp:child_categories}
{/exp:reeposition}
I fear I may be a little bit dense here, but I’m looking to list the other categories that match with my entry in the side menu. I thought I would want to use the sibling tag, but maybe I’m wrong?
When I use this code:
{exp:weblog:entries weblog="projects" disable="member_data|trackbacks" category={segment_2} limit="1"}
{exp:child_categories sibling={category_id}}
{child_category_name}
{/exp:child_categories}
{/exp:weblog:entries}
I get nothing back. Am I going about this wrong? The URL is http://battlestar.onebrightlight.com/index.php/projects/C4/
Never mind, I got it working with the help of TheTristan:
{exp:child_categories parent="{segment_3_category_parent_id}"}
{child_category_start}
<a href="http://{homepage}/category/{child_category_url_title}/">{child_category_name}</a>
{child_category_end}
{/exp:child_categories}
But now, how do I go about wrapping a <ul> around this entry, short of placing one outside the entire loop?
Hi Chris,
About wrapping output of Child categories plugin with <ul> and <li> tagrs read this post.
The parent category count tag on my list is outputting the incorrect number of child categories. In fact, there are a few instances where there are no child categories but the count says there is 1. What would be causing this?
It also appears as if the show_empty parameter is not working and is actually causing the wrong count.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.