Message Boards

Displaying selected category with a template

thumbnail
Fernando Fernandez, modified 7 Years ago.

Displaying selected category with a template

Expert Posts: 396 Join Date: 8/22/07 Recent Posts
Hi all,

I hooked the categories navigation portlet so that it shows a select box and redirects to another page where an asset publisher is waiting to show the relevant content.

My problem is: I'd like to show the selected category name on the second page.

I'm using 6.2 and at this point I wish I'd used ADT instead of hooks but it's done...

Is there any easy way (without creating a portlet to do it) to display the selected category?

TIA

Fernando
thumbnail
Fernando Fernandez, modified 7 Years ago.

RE: Displaying selected category with a template

Expert Posts: 396 Join Date: 8/22/07 Recent Posts
Having slept on this subject I realised that even after hooking the Categories Navigation I could still use an ADT for this portlet. After that, it was very simple to solve:

## ShowSelectedCategory

#set( $selectedCategoryId = $request.getParameter("categoryId") )

#if (!$entries.isEmpty())
	#foreach ($curVocabulary in $entries)
		#foreach ( $curCategory in $curVocabulary.getCategories() )
		    #if( $curCategory.getCategoryId() == $selectedCategoryId )
		       <h1>$curCategory.getName()</h1>
		    #end
		#end
	#end
#end


Hope this helps someone else with a similar problem.

Fernando
John Conrad, modified 7 Years ago.

RE: Displaying selected category with a template

New Member Posts: 2 Join Date: 1/16/17 Recent Posts
It's Amazing to add.