0

Confused as to why this does not work (EE5).

I have a Channel Videos field named {p_vids}.
In my template, within the channel:entries I have the below, but it doesn't display the video/code. (Displays fine without the 'if' conditional)

{if p_vids}

<section class="section">
    <div class="container">
      <div class="row">
        <div class="col-12">
          <h3 class="text-center">Videos</h3>
        </div>
        <div class="col-12">
          <div class="row">
            {exp:channel_videos:videos entry_id="{entry_id}"}
            <div class="col-md-10 col-lg-4">
              <div class="vid">{video:embed_code}
                <h6 class="title">{video:title}</h6>
              </div>
            </div>
            {/exp:channel_videos:videos}
          </div>
        </div>
      </div>
    </div>
  </section>

{/if}

I cannot use/have the {if video:no_videos} within the channel_videos tag since there is the entire layout outside of that - which I Do Not want displaying unless a video(s) is/are added.

What am I missing? Any help is appreciated.

0

You should use {if video:no_videos} inside the Channel Videos tag for no results. So, you should try your code in below manner.

{exp:channel:entries channel="your_channel_name"}
<div>
    {exp:channel_videos:videos entry_id="{entry_id}"}

    {if video:no_videos}
    <p>Sorry, no videos found!!!</p>
    {/if}

    <div>{video:embed_code}
        <h6>{video:title}</h6>
    </div>

    {/exp:channel_videos:videos}
</div>
{/exp:channel:entries}

HTH

| improve this answer | |
  • Thanks for that but unfortunately that is not suitable (layout divs outside Channel VIdeos tag). See updated question. – ZEDG Jun 14 '19 at 10:36
0

Solution (provided by eeharbor) was to use the below 'if' statement.

{if '{exp:channel_videos:videos entry_id="{entry_id}" limit="1"}{video:total}{/exp:channel_videos:videos}' != ''}

code

{/if}
| improve this answer | |

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.