I’ve created a page that lists the titles and descriptions of items in the parent category, followed by the titles and descriptions of items by subcategory.
I have a few conditionals in here to control the display of various bits of field content. This page was working fine until I added the {if PDF==“YES”} sections to both the category and subcategory display.
I can have this conditional in either of these locations with no problem, but when I have the conditional in both locations I get bad output—the list under the subcategory is truncated after the fist title, or I get an extra {/if} tag printing on pages which have no subcategories.
I’ve read through the code over and over and I can’t figure out where I’ve gone wrong… can anyone with fresh eyes see my mistake?
Thanks!
{embed=“resources/header”}
{exp:weblog:category_heading weblog=“resources”}
<P class=“sectionhead”>{category_name}<embed=“global/pdf”}{/if}
</p>
{/exp:weblog:entries}
{if segment_4 != “” }
{exp:query sql=“SELECT cat_id FROM exp_categories WHERE cat_name = ‘{segment_4}’;”}
{exp:query sql=“SELECT cat_name, cat_id AS cat_id2 FROM exp_categories WHERE parent_id = {cat_id} ORDER BY cat_order;”}
<embed=“global/pdf”}{/if}
</p>
{/exp:weblog:entries}
{/exp:query}
{/exp:query}
{/if}
{embed=“resources/footer”}
