Hello, and sorry in advance for my very basic question.
I’m trying to learn Kirky, but I’m totally new with php.
I’m adding a button that opens a vidéo in a lightbox in my templates.php and would like to be able to add in admin panel the Youtube link with blueprint.
I use in blueprint:
url:
label: link to video
type: url
But I don’t know and did not found how to add the correct php to add link from the admin
a href=“?youtube?”>open youtube
If someone has an advice or a link where I can learn how to, It would be helpful.
I search in doc and cheat sheet, but all i tried gave me an error.
Thank you,
I think the easiest way to implement videos (youtube, vimeo, …) is the oEmbed-Plugin by @distantnative
There’s a really good instruction on the plugin page, so maybe you should have try.
If you have any questions don’t hesitate to ask …
Hello Flokosiol,
Thank you for your response, yes I already use this plugin to implemente video, it is very well done and well documented.
But for my “problem” I can’t use it, my video opens in a lightbox, and just would need to be able to write correctly in php:
<div class="video"><a href ="<?php echo MyYoutubeUrl() ?>"> Link open video in LB</a></div>
It could be a link for a video or anything else.
Thanks again for your welcome 
If the name of your url-field defined in your blueprint is url
, you can use the following code to echo just the URL
<?php echo $page->url() ?>
But I’m still not really sure if it’s that what you want to achieve?!
Which lightbox plugin are you using?
EDIT: I corrected my code as mentioned by @Targoran below. Sorry.
If you just want to output the url and your field name is ‘url’, use
<?php echo $page->url() ?>
So the complete would be
<div class="video"><a href ="<?php echo $page->url() ?>"> Link open video in LB</a></div>
Hi Targoran, thank you for your help.
Yes I already tried this way but it open the page in a frame, not the Video 
my blueprint:
url:
label: URL
type: url
Yep, that’s why @flokosiol was asking want you are trying to achieve.
You would probably want to combine the lightbox with the oembed plugin, so the embedded video opens inside the lightbox. Just a thought, haven’t tried it…
If I use :
<div class="video"><a href ="https://www.youtube.com/embed/rnvPXek4y5E"> Link open video in LB</a></div>
It works good.
I just installed and tried oembed it but I actually do not use it.
Oembed creates some div that’s why i can’t use it to show lightbox or I have to review all css.
I thought it could have some troubles with Oembed installed so i delete it and tried <?php echo $page->url() ?>
but still open page, and not video link.
YouTube supports iframe-urls like this:
https://www.youtube.com/embed/YOUTUBEVIDEOCODE
Lightcase supports iframes as mentioned here:
So, if you store the iframe-url from YouTube in your field and echo it with $page->url()
in your template, something like this should do the trick (untested) …
<a class="lightcase-video" href ="<?php echo $page->url() ?>">Click to open lightbox</a>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('a.lightcase-video').lightcase({
iframe : {
width : auto,
height : auto,
frameborder : 0
}
});
});
</script>
The rest is up to you. Good luck!
Finally I used :
<?php echo $page->youtube() ?>
youtube:
label: Link to embed youtube
type: url
required: true
I don’t know if it is the good way to do what I want but it Works.
Thank you for your help and advices.