ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Using categories on one-page "view"?

February 20, 2013 10:32am

Subscribe [2]
  • #1 / Feb 20, 2013 10:32am

    Magnusvb

    57 posts

    Hello
    Here are a static dummy page I’m working on: http://cigar2.se/nyheter.html
    (it is easier for me to explain my question referring to that page)

    This is a News page, where each news article is assign to a category. Bellow the view area, for a selected article, is a list with a title and a excerpt. Now, I want to filter that list to show just articles belonging to a category, by clicking on one of the blue links (for example “Matchreferat”).

    I would prefer to “reload” the same page, but only show news articles from selected category. Is this possible?

    To show the article list I have this code:

    {exp:channel:entries
          channel="news"
          dynamic="no"
          status="open"
           limit="5"
           paginate="bottom"
    }
       <dl>
          <dt><a href="http://{title_permalink=news}">{title}</a></dt>
              <dd>{news_excerpt}</dd>
          </dl>
     {paginate}
          Sida {current_page} av {total_pages} sidor {pagination_links}
      {/paginate}
     {/exp:channel:entries}

    And I have tried to filter by category with this code:

    {exp:channel:categories channel="news" style="nested" class="kategori"}
     <a href="http://{path=news}">{category_name}</a>
    {/exp:channel:categories}

    This is not working the way I want to: the article list shows all categories all the time - no matter which category link I select.

    Is there a solution?

    Best regards, Magnus

  • #2 / Feb 20, 2013 10:49am

    Magnusvb

    57 posts

    Hello
    An update:
    If I remove “dynamic=“no”” the list works when selecting category. But, that “breaks” the news view page. Like this:

    I have a sidebar on other pages with a limited news article list - and links to the whole story on the news page. By removing “dynamic=no”“, the list shows only the selected news.

    Can a condition be used here?

    Best regards, Magnus

  • #3 / Feb 20, 2013 5:30pm

    ahmad saad

    364 posts

    Hi Magnusvb,

    just remove “dynamic=no” from channel entries you want it to filter by cat, and keep it in the sidebar cahnnel entries.

    Regards,

    Ahmad saad.

  • #4 / Feb 21, 2013 3:05am

    Magnusvb

    57 posts

    Thanks, Ahmad

    That almost works. The problem with that solution is that, if you click on a link in the news sidebar (on another page), only that article is showed in list on the news page.

    I wonder if it is possible to solve it with Conditionals and / or Segments?

    Best regards,
    Magnus

  • #5 / Feb 21, 2013 11:19am

    ahmad saad

    364 posts

    Hi Magnusvb,

    can you PM me with a live link for this page so I can see what happened there.

    Regards,

    Ahmad saad.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases