1

I have a Matrix field that I'm using the search parameter on. Within the output I need to grab the actual {row_count} associated with each row based on the order the row appears within the CP-based entry and not the order associated with the filtered results. It seems like the {field_row_count} variable should give me exactly what I need, but it's not working as expected.

Here's a simplified sample of the code:

{cf_project_images search:categories="{segment_category_ids_piped}" }
    <h2><a href="/portfolio/detail/{url_title}/{field_row_count}">{title}</a></h2>
{/cf_project_images}

As an example: The sample I'm testing has 4 rows within the Matrix field. Using the search parameter I'm only returning 1 of those 4 rows. If the row that is returned is the 4th row I would expect the value of {field_row_count} to be 4, but it's returning as 1.

Am I misinterpreting the way the {field_row_count} variable works?

2
  • What do you get in your example when using {field_total_rows}? Nov 19, 2013 at 21:41
  • {field_total_rows} returns the value of the number of rows that the search parameter returns (which doesn't match the total number of rows in the original entry). Nov 21, 2013 at 5:31

2 Answers 2

1

For anyone else that might stumble on this question, it turns out there was a bug in Matrix 2.5.10 that was impacting my specific issue. They've got a patch in place and it sounds like they'll be releasing an update soon.

Turns out {field_row_count} works exactly as I was expecting it to. Yip!

0

Can you use {row_id} instead? I think the count you're getting is based on the way the search aspect works with the returned results.

1
  • 1
    {row_id} returns an ID unique to that row, but it looks like the number isn't related to the specific row within a given entry, which is what I need for this instance. Thanks though! Nov 19, 2013 at 19:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.