Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Gallery: Display a list of parent categories only (See related posts)

The below displays a list of all parent categories for a certain Gallery. Be sure to change the gallery_id if yours doesn't have an id of 1.

   1  
   2  {exp:query sql="SELECT cat_id, cat_name FROM exp_gallery_categories WHERE gallery_id='1' AND parent_id='0' ORDER BY cat_order"}
   3  <li><a href="{path=gallery/subcat}{cat_id}">{cat_name}</a></li>
   4  {/exp:query}

You need to create an account or log in to post comments to this site.


Click here to browse all 5355 code snippets

Related Posts