Empire CMS Template Tricks: Shared Sub-Category Data via the Flexible Tag, and Sibling Categories in List Templates

Empire CMS template tricks

I've been building an education site on Empire CMS, and it has a deep, sprawling category tree.
The tree runs four levels deep: one studio category holds 9 departments, each department splits into 36 rooms, and each room holds 18 leaf categories.
Fortunately, those 18 leaf categories are named identically in every department.
The studio home page, list pages, and content pages all share the same template structure — they just pull different data from the matching department category.

To avoid maintaining 36 home templates, 36 list templates, and 36 more of everything downstream, I needed the flexible tag to fetch shared sub-category data, and to pull sibling categories in list templates.

Here's how it works:

Cover template, i.e. the studio home page:
[e:loop={"select classid, classname, classpath from phome_enewsclass where bclassid='$GLOBALS[navclassid]' and classname='Research Topics'",5,24,0,0,0}] [ecmsinfo]$bqr[classid],6,46,0,0,2,0[/ecmsinfo] [/e:loop]

Calling the sub-category name:
<?=$class_r[$bqr[classid]]['classname']?>

Calling the sub-category link:
<?=$class_r[$bqr[classid]]['classpath']?>

In the leaf-category list, fetching sibling categories under the same parent:
<?php $bclassid=$class_r[$GLOBALS[navclassid]][bclassid]; ?> [e:loop={"select classid, classname, classpath from phome_enewsclass where bclassid='$bclassid' and classname='Featured Courseware'",5,24,0,0,0}] [ecmsinfo]$bqr[classid],6,46,0,0,2,0[/ecmsinfo] [/e:loop]

Note that [!--bclass.id--] does nothing inside the flexible tag — I had to assign it to a variable before the parent ID came through.

I also asked on the forum how to get the parent of the parent category's name:
<?php $bclassid=$class_r[$GLOBALS[navclassid]][bclassid]; $bbclassid=$class_r[$bclassid][bclassid]; echo $class_r[$bbclassid][classname]; ?>

Leave a Comment

Comments No Comments

Table of Contents