https://github.com/faithlifechurch/video-embed I added the full code to github
Hm, Iām a bit surprised this template doesnāt break the page, I count 4 if statements but only 2 endifs?
And where is the $item defined? If this is the complete code, thereās something wrong?
Somehow I was expecting a foreach loop that would loop through the structure field. I donāt know where this video_url field is supposed to beā¦
Me too⦠hmm⦠maybe theres some closures in the footer snippet? Does a closing endif break if theres no opening to match? I know the other way round does.
@jimbobrjames Yes, that would be a parse error as well. But you can easily test this yourself, Iām trying to sort out this problem and itās already taking too much time.
Well, Iām sorry. I am trying to help too.
What you would need is some code like this:
<?php snippet('header') ?>
<?php $videos = $pages->find('videos')->dkm_videos()->toStructure() ?>
<section class="section">
<div class="container">
<div class="columns">
<?php foreach($videos as $item): ?>
<div class="column is-8 is-offset-2">
<?php if($item->video_type() === 'vimeo'): ?>
<div class="embed">
<iframe src="https://player.vimeo.com/video/<?= $item->video_id();?>?api=1&color=ffffff&title=0&byline=0&portrait=0" width="640" height="360" frameborder="0" class="episode" webkitallowfullscreen mozallowfullscreen allowfullscreen ></iframe>
</div>
<h1 class="is-size-2 is-size-4-mobile mt10"><?= $item->name() ?></h1>
<?php endif; ?>
<?php if($item->video_type() === 'youtube'): ?>
<div class="embed">
<iframe src="https://www.youtube.com/watch?v=<?= $item->video_id();?>?api=1&color=ffffff&title=0&byline=0&portrait=0" width="640" height="360" frameborder="0" class="episode" webkitallowfullscreen mozallowfullscreen allowfullscreen ></iframe>
</div>
<h1 class="is-size-2 is-size-4-mobile mt10"><?= $item->name() ?></h1>
<?php endif; ?>
</div>
<?php endforeach ?>
</div>
</div>
</section>
<?php snippet('footer') ?>
I added the new code to videos.php in staging. Video Embed code is still throwing error see screen capture below. Thanks for all your time spent on this. Much appreciated.
http://faithlifenow.com/screen-shot-2018-04-03-at-4-28-13-pm/
Could you post here or on GitHub what is in the videos.txt file now?
I think this is the piece I am missing because I am not seeing my New You tube data in here.
Well, thatās what I already asked two hours ago⦠Without the field, the code canāt possibly work. Just adding the field in the blueprint doesnāt add any value in your text file by some magic, Iām afraid.
So the blueprint video.txt needs to match the video.yml file?
May I suggest you read the Getting Started guide to get an understanding what files are for what purpose if that is not really clear yet?
In short:
Blueprint defines form fields for the Panel.
In Panel, you fill in the form.
Panel saves content in text files.
Template pulls content from text files and renders it on the page.
If you do not use the Panel but edit the files in a text editor, you do not need a blueprint file.
If you add a field later, you have to go back to the Panel and fill in the value for each radio field for each item. Or do that manually in each text file.
Your text file has to look like this when you are finished:
-
name: Christmas Show 2016
episode: "608"
video_id: "195994715"
video_type: vimeo
-
name:Tax Madness
episode: ""
video_id: "db-SP_AYQg8"
video_type: youtube