Back

Display Related Content Listed by Categories in a Multilingual Environment

Description

Sometimes you want to display related content listed and classified by category in a multilingual environment.

Code

###Use this line if you want the categories to be displayed alphabetically by their name###
##foreach($cat in $sorter.sort($categories. getChildrenCategoriesByKey("EnterCategoryKey"), "categoryName"))

#foreach($cat in $categories. getChildrenCategoriesByKey("EnterCategoryKey"))
##This flag makes sure that the category name is displayed only once.
#set($flag1 = 'true')
#foreach($con in  $dotcontent.pullRelated(" RelationshipName","$!{URLMapContent.identifier}","+(categories:$cat.categoryVelocityVarName)",false,0,"StructureName.day"))     

#if($flag1 == 'true')
   <p>

##In a multilingual environment it is best to use the category key to create a language key variable and handle the translation that way.

<strong>$text.get("content.restaurants.$cat.key")</strong></p>
#set($flag1 = 'false')
#end