<xen:if is="{$visitor.language_id} == x">Category</xen:if>

  1. rafass

    rafass - Jun 7, 2015 Active Member VIP Member

    Credit
    Point
    Hello Brivium! Thanks for this addon is really very useful!
    I would like to edit the templates and use:
    Code:
    <xen:if is="{$visitor.language_id} == x">
    CATEGORY
    </xen:if>
    So, depends of the language selected the user will see only certain categories.
    Editing the templates only without change the addon would be perfect.
    Could you please give me a hand to do this. I appreciate your great work and your help.
    Thank you friend!
    .
    .
     
    Loading...
  2. Brivium

    Brivium - Jun 8, 2015 XenForo Services Staff Member

    Credit
    Point
    Could you please send me the template title which you're editting ?
     
    #2
  3. rafass

    rafass - Jun 8, 2015 Active Member VIP Member

    Credit
    Point
    Hello again Brivium!
    I guess the template that we have to edit is resource_index.
    Code:
    <xen:title>{xen:phrase resources}</xen:title>
    
    <xen:container var="$searchBar.resourceUpdate"><xen:include template="search_bar_resource" /></xen:container>
    <xen:container var="$head.canonical">
        <link rel="canonical" href="{xen:link 'canonical:resources', '', "page={xen:if '{$page} > 1', $page, ''}"}" /></xen:container>
    
    <xen:require css="resource_list.css" />
    
    <xen:if is="{$canAddResource}">
        <xen:topctrl><a href="{xen:link resources/add, '', 'resource_category_id={$category.resource_category_id}'}" class="callToAction OverlayTrigger"><span>{xen:phrase add_resource}</span></a></xen:topctrl>
    </xen:if>
    
    <div class="resourceListBlock">
    
    <div class="resourceListSidebar">
        <div class="secondaryContent categoryList">
            <h3>{xen:phrase categories}</h3>
            <xen:if is="{$categories}">
                <ol>
                <xen:foreach loop="$categories" value="$_category">
                    <li class="{xen:if '{$_category.resource_category_id} == {$selectedCategoryId}', selected}">
                        <a href="{xen:link resources/categories, $_category}" {xen:if $_category.category_description, 'title="{xen:helper striphtml, $_category.category_description}" class="Tooltip" data-tipclass="resourceCategoryTooltip"'}>{$_category.category_title}</a>
                        <span class="count">{xen:number $_category.resource_count}</span>
                    </li>
                </xen:foreach>
                </ol>
            <xen:else />
                <div>{xen:phrase n_a}</div>
            </xen:if>
        </div>
    
        <xen:if is="{$topResources}">
            <div class="secondaryContent miniResourceList">
                <h3><a href="{xen:link resources, '', 'order=rating_weighted'}" class="concealed">{xen:phrase top_resources}</a></h3>
                <xen:include template="resource_list_mini">
                    <xen:map from="$topResources" to="$resources" />
                </xen:include>
            </div>
        </xen:if>
    
        <xen:if is="{$activeAuthors}">
            <div class="secondaryContent avatarList">
                <h3><a href="{xen:link resources/authors}" class="concealed">{xen:phrase most_active_authors}</a></h3>
                <ol>
                <xen:foreach loop="$activeAuthors" value="$author">
                    <li>
                        <xen:avatar user="$author" size="s" img="true" href="{xen:link resources/authors, $author}" class="NoOverlay" />
                        <xen:username user="$author" rich="true" href="{xen:link resources/authors, $author}" class="NoOverlay" />
                        <div class="extraData"><a href="{xen:link resources/authors, $author}">{xen:phrase resources}: {xen:number $author.resource_count}</a></div>
                    </li>
                </xen:foreach>
                </ol>
            </div>
        </xen:if>
    </div>
    
    <div class="resourceListMain">
        <xen:if is="{$featuredResources}">
            <div class="section">
                <h2 class="textHeading">
                    <a class="viewAllFeatured" href="{xen:link resources/featured}">{xen:phrase view_all}</a>
                    {xen:phrase featured_resources}
                </h2>
                <xen:include template="resource_featured_list" />
            </div>
        </xen:if>
    
        <div class="section">
    
        <xen:include template="resource_helper_filters">
            <xen:set var="$linkBase" value="resources" />
            <xen:set var="$linkData" value="" />
        </xen:include>
    
        <div class="resourceHeaders">
            <xen:if is="{$showFilterTabs}">
                <div class="extraLinks">
                    <div class="Popup filterLink JsOnly">
                        <a rel="Menu">{xen:phrase filters}</a>
                        <div class="Menu resourceFilterMenu" id="ResourceFilterMenu"
                            data-contentsrc="{xen:link resources/filter-menu, '', 'params={$pageNavParams}'}"
                            data-contentdest="#ResourceFilterMenu > .primaryContent"
                            data-insertfn="replaceAll"
                        >
                            <div class="primaryContent">{xen:phrase loading}...</div>
                        </div>
                    </div>
                </div>
            </xen:if>
            <ol class="tabs">
                <li class="{xen:if '{$order} == "last_update"', active}"><a href="{xen:link resources, '', '_params={$pageNavParams}', 'order='}">{xen:phrase latest_updates}</a></li>
                <li class="{xen:if '{$order} == "resource_date"', active}"><a href="{xen:link resources, '', '_params={$pageNavParams}', 'order=resource_date'}">{xen:phrase newest_resources}</a></li>
                <li class="{xen:if '{$order} == "rating_weighted"', active}"><a href="{xen:link resources, '', '_params={$pageNavParams}', 'order=rating_weighted'}">{xen:phrase top_resources}</a></li>
                <li class="{xen:if '{$order} == "download_count"', active}"><a href="{xen:link resources, '', '_params={$pageNavParams}', 'order=download_count'}">{xen:phrase most_downloaded}</a></li>
            </ol>
        </div>
    
        <form action="{xen:link resources/inline-mod/switch}" method="post"
            class="InlineModForm"
            data-cookieName="resources"
            data-controls="#InlineModControls"
            data-imodOptions="#ModerationSelect option">
    
            <ol class="resourceList">
            <xen:if is="{$resources}">
                <xen:foreach loop="$resources" value="$resource">
                    <xen:include template="resource_list_item">
                        <xen:set var="$linkPrefixHtml" value="{xen:if $resource.prefix_id, {xen:link resources, '', '_params={$pageNavParams}', 'prefix_id={$resource.prefix_id}'}, ''}" />
                        <xen:set var="$showCategoryTitle">1</xen:set>
                    </xen:include>
                </xen:foreach>
            <xen:else />
                <li class="primaryContent">{xen:phrase there_currently_no_resources_to_display}</li>
            </xen:if>
            </ol>
        
            <div class="pageNavLinkGroup">
                <xen:if is="{$inlineModOptions}"><div class="linkGroup InlineMod SelectionCountContainer"></div></xen:if>
                <div class="linkGroup"{xen:if '!{$ignoredNames}', ' style="display: none"'}><a href="javascript:" class="muted jsOnly DisplayIgnoredContent Tooltip" title="{xen:phrase show_hidden_content_by_x, "names={xen:helper implode, $ignoredNames, ', '}"}">{xen:phrase show_ignored_content}</a></div>
                <xen:pagenav link="resources" linkparams="{$pageNavParams}" page="{$page}" perpage="{$perPage}" total="{$totalResources}" />
            </div>
    
            <xen:if is="{$inlineModOptions}">
                <xen:include template="inline_mod_controls_resource" />
            </xen:if>
        </form>
        </div>
    </div>
    
    </div>
    Your addon change this template using TMS. and you replace a block with your own template: <xen:include template="BRRCE_categories_expand" />
    <xen:require css="BRRCE_categories_expand.css" />
    <ol>
    <xen:foreach loop="$_category.childCategories" value="$childCategory">
    <li>
    <a href="{xen:link resources/categories, $childCategory}" {xen:if $childCategory.category_description, 'title="{xen:helper striphtml, $childCategory.category_description}" class="Tooltip" data-tipclass="resourceCategoryTooltip"'}>{$childCategory.category_title}</a>
    <span class="count">{xen:number $childCategory.resource_count}</span>
    </li>
    <xen:if is="{$childCategory.childCategories_lvl1}">
    <ol>
    <xen:foreach loop="$childCategory.childCategories_lvl1" value="$childCategoryLvl1">
    <li>
    <a href="{xen:link resources/categories, $childCategoryLvl1}" {xen:if $childCategoryLvl1.category_description, 'title="{xen:helper striphtml, $childCategoryLvl1.category_description}" class="Tooltip" data-tipclass="resourceCategoryTooltip"'}>{$childCategoryLvl1.category_title}</a>
    <span class="count">{xen:number $childCategoryLvl1.resource_count}</span>
    </li>
    <xen:if is="{$childCategoryLvl1.childCategories_lvl2}">
    <ol>
    <xen:foreach loop="$childCategoryLvl1.childCategories_lvl2" value="$childCategoryLvl2">
    <li>
    <a href="{xen:link resources/categories, $childCategoryLvl2}" {xen:if $childCategoryLvl2.category_description, 'title="{xen:helper striphtml, $childCategoryLvl2.category_description}" class="Tooltip" data-tipclass="resourceCategoryTooltip"'}>{$childCategoryLvl2.category_title}</a>
    <span class="count">{xen:number $childCategoryLvl2.resource_count}</span>
    </li>
    <xen:if is="{$childCategoryLvl2.childCategories_lvl3}">
    <ol>
    <xen:foreach loop="$childCategoryLvl2.childCategories_lvl3" value="$childCategoryLvl3">
    <li>
    <a href="{xen:link resources/categories, $childCategoryLvl3}" {xen:if $childCategoryLvl3.category_description, 'title="{xen:helper striphtml, $childCategoryLvl3.category_description}" class="Tooltip" data-tipclass="resourceCategoryTooltip"'}>{$childCategoryLvl3.category_title}</a>
    <span class="count">{xen:number $childCategoryLvl3.resource_count}</span>
    </li>
    <xen:if is="{$childCategoryLvl3.childCategories_lvl4}">
    <ol>
    <xen:foreach loop="$childCategoryLvl3.childCategories_lvl4" value="$childCategoryLvl4">
    <li>
    <a href="{xen:link resources/categories, $childCategoryLvl4}" {xen:if $childCategoryLvl4.category_description, 'title="{xen:helper striphtml, $childCategoryLvl4.category_description}" class="Tooltip" data-tipclass="resourceCategoryTooltip"'}>{$childCategoryLvl4.category_title}</a>
    <span class="count">{xen:number $childCategoryLvl4.resource_count}</span>
    </li>
    </xen:foreach>
    </ol>
    </xen:if>
    </xen:foreach>
    </ol>
    </xen:if>
    </xen:foreach>
    </ol>
    </xen:if>
    </xen:foreach>
    </ol>
    </xen:if>
    </xen:foreach>
    </ol>
    So, using the conditional to show content depending of the language selected
    Code:
    <xen:if is="{$visitor.language_id} == x">
    CATEGORY
    </xen:if>
    We could be able to show categories according with the language selected. that's cool.
    If you want to take a look directly in the templates into my ACP, I've opened a ticket with my credentials. you're very welcome!
    Many Thanks!
    .
    .
     
    Last edited: Jun 8, 2015
    #3