Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DeskSupport/1474489 to your computer and use it in GitHub Desktop.
Save DeskSupport/1474489 to your computer and use it in GitHub Desktop.
Filter Portal by Topic
{% assign _kb_topic_ids = '89110,89111,89112,89113,89114,89115,89116,89117,89118,89119,89120,89121,89122' %}

<input type='hidden' id='kb_topic_ids' name='kb_topic_ids' value='{{ _kb_topic_ids }}' />

<input type='hidden' id='kb_topic_ids' name='kb_topic_ids' value='{{ _kb_topic_ids }}' />

<input type='hidden' id='kb_topic_ids' name='kb_topic_ids' value='{{ _kb_topic_ids }}' />

<input type='hidden' id='kb_topic_ids' name='kb_topic_ids' value='{{ _kb_topic_ids }}' />

if ($('form').hasClass('support-search-small'))
{ autocomplete_source += '?size=small&'; }
else
{ autocomplete_source += '?'; }

if($('form').find('#kb_topic_ids').length > 0) { autocomplete_source += ('&kb_topic_ids=' + $('form').find('#kb_topic_ids').val() + '&'); }

if ($('form').hasClass('support-search-small'))
{ autocomplete_source += '?size=small&'; }
else
{ autocomplete_source += '?'; }

if($('form').find('#kb_topic_ids').length > 0) { autocomplete_source += ('&kb_topic_ids=' + $('form').find('#kb_topic_ids').val() + '&'); }

<h3>Help Articles</h3>

{% if topics_count > 0 %}

<table width='100%' cellspacing='0'>

{% for topic in topics %}
 {% capture _topic_id %}{{topic.id}}{% endcapture %}

{% if _kb_topic_ids contains _topic_id %}

{% if topic.article_count >0 %}

{% cycle 'open': '<tr><td>', '<td>' %} 

<div class='topic topic{{ topic.id }}'>

<h4><a href='{{ topic.public_articles_url }}'>{{ topic.name }}</a></h4>
 {% if topic.article_count > 0 %}
 <ul>
 {% for article in topic.articles limit:3 %}
 <li>
<a href='{{ article.public_url }}'>{{ article.subject_plain | clip:40 }}</a></li>
{% endfor %}

</ul>

<a class='pill' href='{{ topic.public_articles_url }}'>
 View all
 <strong>{{ topic.article_count }}
 {{ 'article' | pluralize: topic.article_count }}</strong>
 </a>

{% endif %}
 </div>

{% cycle 'close': '</td>', '</td></tr>' %} 

{% endif %}

{% endif %}

{% endfor %}

</table>
 {% else %}
 <h4>No topics are available.</h4>
 {% endif %}
<h3>Help Articles</h3>

{% if topics_count > 0 %}

<table width='100%' cellspacing='0'>

{% for topic in topics %}
 {% capture _topic_id %}{{topic.id}}{% endcapture %}

{% if _kb_topic_ids contains _topic_id %}

{% if topic.article_count >0 %}

{% cycle 'open': '<tr><td>', '<td>' %} 

<div class='topic topic{{ topic.id }}'>

<h4><a href='{{ topic.public_articles_url }}'>{{ topic.name }}</a></h4>
 {% if topic.article_count > 0 %}
 <ul>
 {% for article in topic.articles limit:3 %}
 <li>
<a href='{{ article.public_url }}'>{{ article.subject_plain | clip:40 }}</a></li>
{% endfor %}

</ul>

<a class='pill' href='{{ topic.public_articles_url }}'>
 View all
 <strong>{{ topic.article_count }}
 {{ 'article' | pluralize: topic.article_count }}</strong>
 </a>

{% endif %}
 </div>

{% cycle 'close': '</td>', '</td></tr>' %} 

{% endif %}

{% endif %}

{% endfor %}

</table>
 {% else %}
 <h4>No topics are available.</h4>
 {% endif %}
<h3>Help Articles</h3>

{% if topics_count > 0 %}

<table width='100%' cellspacing='0'>

{% for topic in topics %}
 {% capture _topic_id %}{{topic.id}}{% endcapture %}

{% if _kb_topic_ids contains _topic_id %}

{% if topic.article_count >0 %}

{% cycle 'open': '<tr><td>', '<td>' %} 

<div class='topic topic{{ topic.id }}'>

<h4><a href='{{ topic.public_articles_url }}'>{{ topic.name }}</a></h4>
 {% if topic.article_count > 0 %}
 <ul>
 {% for article in topic.articles limit:3 %}
 <li>
<a href='{{ article.public_url }}'>{{ article.subject_plain | clip:40 }}</a></li>
{% endfor %}

</ul>

<a class='pill' href='{{ topic.public_articles_url }}'>
 View all
 <strong>{{ topic.article_count }}
 {{ 'article' | pluralize: topic.article_count }}</strong>
 </a>

{% endif %}
 </div>

{% cycle 'close': '</td>', '</td></tr>' %} 

{% endif %}

{% endif %}

{% endfor %}

</table>
 {% else %}
 <h4>No topics are available.</h4>
 {% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment