# Add url for video in Blueprint

**URL:** <https://forum.getkirby.com/t/add-url-for-video-in-blueprint/1541>\
**Category:** Questions\
**Tags:** v2\
**Created:** [July 6, 2015, 6:14pm UTC](https://forum.getkirby.com/t/add-url-for-video-in-blueprint/1541 "2015-07-06T18:14:57Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon3573533](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@anon3573533](https://forum.getkirby.com/u/anon3573533)\
**Post date:** [July 6, 2015, 6:14pm UTC](https://forum.getkirby.com/t/add-url-for-video-in-blueprint/1541/1 "2015-07-06T18:14:57Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![flokosiol](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/flokosiol/32/468_2.png) [@flokosiol](https://forum.getkirby.com/u/flokosiol)\
**Post date:** [July 6, 2015, 6:53pm UTC](https://forum.getkirby.com/t/add-url-for-video-in-blueprint/1541/2 "2015-07-06T18:53:35Z")

</div>

I think the easiest way to implement videos (youtube, vimeo, …) is the [oEmbed-Plugin](http://getkirby-plugins.com/oembed) 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 …

---

<div class="post-metadata">

**Author:** ![anon3573533](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@anon3573533](https://forum.getkirby.com/u/anon3573533)\
**Post date:** [July 6, 2015, 7:18pm UTC](https://forum.getkirby.com/t/add-url-for-video-in-blueprint/1541/3 "2015-07-06T19:18:08Z")

</div>

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 😉

---

<div class="post-metadata">

**Author:** ![flokosiol](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/flokosiol/32/468_2.png) [@flokosiol](https://forum.getkirby.com/u/flokosiol)\
**Post date:** [July 6, 2015, 7:52pm UTC](https://forum.getkirby.com/t/add-url-for-video-in-blueprint/1541/4 "2015-07-06T19:52:54Z")

</div>

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
<?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.

---

<div class="post-metadata">

**Author:** ![Targoran](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/targoran/32/733_2.png) [@Targoran](https://forum.getkirby.com/u/Targoran)\
**Post date:** [July 6, 2015, 7:59pm UTC](https://forum.getkirby.com/t/add-url-for-video-in-blueprint/1541/5 "2015-07-06T19:59:58Z")

</div>

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>
```

---

<div class="post-metadata">

**Author:** ![anon3573533](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@anon3573533](https://forum.getkirby.com/u/anon3573533)\
**Post date:** [July 6, 2015, 8:03pm UTC](https://forum.getkirby.com/t/add-url-for-video-in-blueprint/1541/6 "2015-07-06T20:03:12Z")

</div>

> [@flokosiol](#):
>
> Which lightbox plugin are you using?

I use: [lightcase](http://cornel.bopp-art.com/lightcase/)

---

<div class="post-metadata">

**Author:** ![anon3573533](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@anon3573533](https://forum.getkirby.com/u/anon3573533)\
**Post date:** [July 6, 2015, 8:06pm UTC](https://forum.getkirby.com/t/add-url-for-video-in-blueprint/1541/7 "2015-07-06T20:06:19Z")

</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

---

<div class="post-metadata">

**Author:** ![Targoran](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/targoran/32/733_2.png) [@Targoran](https://forum.getkirby.com/u/Targoran)\
**Post date:** [July 6, 2015, 8:08pm UTC](https://forum.getkirby.com/t/add-url-for-video-in-blueprint/1541/8 "2015-07-06T20:08:56Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![anon3573533](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@anon3573533](https://forum.getkirby.com/u/anon3573533)\
**Post date:** [July 6, 2015, 8:22pm UTC](https://forum.getkirby.com/t/add-url-for-video-in-blueprint/1541/9 "2015-07-06T20:22:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![flokosiol](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/flokosiol/32/468_2.png) [@flokosiol](https://forum.getkirby.com/u/flokosiol)\
**Post date:** [July 6, 2015, 8:24pm UTC](https://forum.getkirby.com/t/add-url-for-video-in-blueprint/1541/10 "2015-07-06T20:24:41Z")

</div>

**YouTube** supports iframe-urls like this:  
`https://www.youtube.com/embed/YOUTUBEVIDEOCODE`

**Lightcase** supports iframes as mentioned here:

> **[Documentation :: Lightcase - The smart and flexible Lightbox Plugin](https://cornel.bopp-art.com/lightcase/documentation/)**
>
> Beautiful, flexible and responsive Lightbox Plugin to present various types of content famously.

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) …

```auto
<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!

---

<div class="post-metadata">

**Author:** ![anon3573533](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@anon3573533](https://forum.getkirby.com/u/anon3573533)\
**Post date:** [July 6, 2015, 9:14pm UTC](https://forum.getkirby.com/t/add-url-for-video-in-blueprint/1541/11 "2015-07-06T21:14:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 5:17pm UTC](https://forum.getkirby.com/t/add-url-for-video-in-blueprint/1541/12 "2025-02-06T17:17:06Z")

</div>


