2

I am using matrix to pull instagram photos using the pic puller plugin. Sometimes, the picture is not available. I am able to skip these by using an if conditional in the pic puller loop. however an empty matrix row is still parsed and shown on the final template. I am not sure how to just show the rows with instagram content.

{exp:channel:entries channel="mychannel" status="open" }
    {matrix_field} 

        {exp:ig_picpuller:media user_id="1" media_id="{media_id}" use_stale_cache="yes"}
        {if ig_status == "true"}
            {ig_standard_resolution}
        {/if}
        {/exp:ig_picpuller:media}

    {/matrix_field}
{/exp:channel:entries}

I considered using the ig_status tag as a search parameter in matrix, but didn't work.

{exp:channel:entries channel="mychannel" status="open" }
    {exp:ig_picpuller:media user_id="1" media_id="{media_id}" use_stale_cache="yes"}

        {matrix_field search:{ig_status}="true"} 
                {ig_standard_resolution}
        {/matrix_field}

    {/exp:ig_picpuller:media}

{/exp:channel:entries}

Any ideas how i can skip the rows without any pictures from being parsed?

14
  • Why doesn't your first code example work? Just keep all of your markup for the row inside of the {if ig_status == "true"} conditional, so nothing will show for that row if there's no photo. – Derek Hogue Jan 17 '15 at 19:49
  • The pic puller tags depends on the {media_id} variable from the matrix field. So can't wrap the matrix tags with the pic puller conditional. I tried using nsm transplant to retrieve the media_ids within the conditional ( only rows with actual pictures ), then use it as a search parameter in the matrix field ( hence limiting it to parse only rows with actual pictures. That seemed to work - ( only rows with pictures showed up). But the row count variable was off - it still shows the count of each row with the excluded rows. – juju Jan 18 '15 at 22:29
  • I wasn't suggesting wrapping the Matrix tags inside the conditional - but just everything you want to do with the Matrix tags (i.e., your markup). Another Q: what is media_id - a text input? When you ay "sometimes the picture is not available", why is that? Bad media_id? Timeout on Instagram's end? Or no media_id at all? – Derek Hogue Jan 18 '15 at 22:37
  • media_id is a text input column in matrix. the pic puller plugin uses that to pull the pictures from instagram. Sometimes, the original picture on instagram is deleted - hence not available. so the media_id exists just no picture. when there is no picture, pic puller has a field called "ig_status" which registers as "false". hence the conditional. I am not following what you mean with the wrap. can you give me a quick code example? – juju Jan 19 '15 at 0:50
  • I mean: put all of your markup and code for each Matrix row inside of {if ig_status == "true"} - even the stuff which might not be related to the photo itself. This way, you're displaying nothing at all for that row when there's no photo. You have the same issue with the row_count being off of course - but there's no alternative to that really. You can't filter a query by the result of an operation within that query. – Derek Hogue Jan 19 '15 at 12:48
0

Assuming ig_status is a column in the Matrix field, you don't want the curlies in the search:col_name="" parameter:

{exp:channel:entries channel="mychannel" status="open" }
{exp:ig_picpuller:media user_id="1" media_id="{media_id}" use_stale_cache="yes"}

    {matrix_field search:ig_status="true"} 
            {ig_standard_resolution}
    {/matrix_field}

{/exp:ig_picpuller:media}

{/exp:channel:entries}

2
  • Unfortunately, {ig_status} is not a matrix field. Rather it is a field from the pic puller plugin. I guess I can't use an external field as a parameter in matrix? Generally how can i turn off rows based on an external parameter? – juju Jan 17 '15 at 3:30
  • Also, {media_id} is a matrix field - which is a required parameter in the pic puller tag. – juju Jan 17 '15 at 3:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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