Template Coding

  • Templates to reserve the url

    These will be in the active skin directory, and can be the simplest template possible, containing only the smarty function:
    {ujCategories_default_index category_set="genres" page_title="Xgenres"}
  • Menu templates

    The menu position and template is selected in the create/update forms for each category set.

    The button templates (buttons_above, buttons_below, etc) can be overridden by creating a template named ujCategories_menu_buttons.tpl in the active skin directory, or edited under the Templates tab in the control panel.

    This lays out the links to the categories in a grid. So if you needed to change the number of rows you would copy the contents of this template to your override /skins/jrElastic/ujCategories_menu_buttons.tpl

    From /modules/ujCategories/templates/menu_buttons.tpl
    		{$i = 0}
    		{foreach from=$_cat_options key="category_url" item="category"}
    			{$category_url = jrCore_url_string($category_url)}
    			{if $i == 0}
    			<div class="row">
    			{/if}
    				<div class="col3{if $i == 4} last{/if}">
    					<div class="media_title center p20">
    						<a href="{$jamroom_url}/{$xurl}/{$category_url}">{$category}</a>
    					</div>
    				</div>
    				{$i = $i+1}
    			{if $i == 4}
    			</div>
    			{$i = 0}
    			{/if}
    		{/foreach}
  • Category set header templates

    If text or a template name is entered for the category description when creating a category set, it will show below the menu/title on that main category set page.

    category_description.tpl is an empty default template which can be edited in the ACP, or add a ujCategories_category_description.tpl into the skin dir.
    {* This is the category_description template for the front page of the category set *}
  • Doing it all in a template

    In a skin template, all you need is
    {ujCategories_default_index category_set="genres" page_title="Xgenres"}

    But if you need more freedom than the "output everything" smarty function provides, you can create your url-reserving template (eg genres.tpl) in the skin dir and adapt the full override code to your needs.

    It will look something like this example:

    {$murl = 'talents'}
    {$fieldname = 'profile_myModule_talents'}
    {$order_by = "_created"}
    {$_catnav_list = ujCategories_get_categories('talents')}{* where 'talents' is the category set name/url *}
    
    {assign var="selected" value=$fieldname}
    
    {jrCore_page_title title=$murl}
    {jrCore_include template="header.tpl"}
    
    {if isset($_post.option) && strlen($_post.option) > 0}
    
        {$category = $_catnav_list[$_post.option]}
        {$search = $_post.option|replace:"-":"_"}
    
    {else}
    
    	{$template = "talents_row.tpl"}
    	
    {/if}
    {*debug*}
    {*jrCore_list module="jrProfile" order_by={$order_by} search="{$fieldname} like %{$search}%" pagebreak=5 page={$p} pager=true*}
    <div class="inner">
    
    {if isset($_post.option)}
    	
    	<h1>{$category}</h1>
    	{jrCore_list module="jrProfile" order_by=$order_by search="`$fieldname` like %`$search`%" pagebreak=$_conf.ujCategories_default_pagebreak page=$p pager=true}
    	
    {else}
        	
    	{$i = 0}
    	{foreach from=$_catnav_list key="category_url" item="category"}
    		{$category_url = jrCore_url_string($category_url)}
    		{if $i == 0}
    		<div class="row">
    		{/if}
    			<div class="col3{if $i == 4} last{/if}">
    				<div class="media_title center p20">
    					<a href="{$jamroom_url}/{$murl}/{$category_url}">{$category}</a>
    				</div>
    			</div>
    			{$i = $i+1}
    		{if $i == 4}
    		</div>
    		{$i = 0}
    		{/if}
    	{/foreach}
    
    {/if}
    
    </div>
    
    {jrCore_include template="footer.tpl"}

Tags