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.

Show content based on a Matrix custom field

July 21, 2010 8:58am

Subscribe [3]
  • #1 / Jul 21, 2010 8:58am

    Martagnan

    10 posts

    Hello,
    Instead of using categories i’ve used a Matrix checkbox group.  I now need to filter content based on what has been checked in the group.

    Any ideas?

    Thanks

  • #2 / Jul 21, 2010 10:14am

    Focus Lab Dev Team

    1129 posts

    When you say “Matrix checkbox group” are you referring to checkboxes within a Matrix field or just a Fieldframe Checkbox group?

    Also, what version of EE and Matrix are you using?

  • #3 / Jul 21, 2010 10:20am

    Martagnan

    10 posts

    Hello,

    It’s a FF Checkbox group ‘within’ a Matrix field group.

    I’m using EE 1.6.9, FF 1.4.2 and Matrix 2.0.6.

    I hope that helps

  • #4 / Jul 21, 2010 10:22am

    Focus Lab Dev Team

    1129 posts

    Matrix 2 uses a separate database table to store the custom field data. Because of this you’ll need a custom query to actually filter the data based on the checkboxes selected (I think)

    Have are your mysql skills? 😊

  • #5 / Jul 21, 2010 2:13pm

    Wes Rice

    103 posts

    Hello,
    Instead of using categories i’ve used a Matrix checkbox group.  I now need to filter content based on what has been checked in the group.

    Any ideas?

    Thanks

    I don’t think this would be ideal, but I think it would work.

    1) Set up your url like this: http://mywebsite.com/name_of_my_page/?category=category_name

    2) Install the plugin I attached to get the category url variable.

    3) Put this in your main template

    {embed=template_group/template_name entry_id="{exp:weblog:entries weblog="weblog_name"}{matrix_name search:matrix_column_name="{exp:url_variables variable="category"}" backspace="1"}{entry_id}|{/matrix_name}{/exp:weblog:entries}"}

    4) Create a new template that will search for the entries only passed through the {embed:entry_id} variable.

    {exp:weblog:entries weblog="weblog_name" entry_id="{embed:entry_id}"}
        {title}    
    {/exp:weblog:entries}

    ===================

    What step three should do is loop through your matrix field and build a string of entry ids that have the category found in the url. It should output a list like 1|2|3|4. Then the embedded template will only find those entries.

    I’m not 100% sure putting the {exp:weblog} tag in a embed variable will work, but it seems like it should in theory.

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

ExpressionEngine News!

#eecms, #events, #releases