Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am working on a project in which I store youtube video links in a database and then I retrieve those links and using blade template engine i try to embed them into page. I use a loop to put videos in a page. For some reason I'm not getting any video in the browser. It is covering the mentioned space but not rendering anything. I'm using laravel 3. Here's couple of code snippets, if they help.


This is the index.blade.php

@layout('layouts.master')

@section('content')

@foreach ($videos as $video)
    <h4>{{ $video->title }}</h4>
    <br>
    <div class="media">
        <div class="media-body">
            <iframe width="560" height="315" src="{{ $video->link }}" frameborder="0" allowfullscreen>
            </iframe>
        </div>
    </div>
    <br>
@endforeach

@endsection

The $videos variable is passed from controller.

class Videos_Controller extends Base_Controller
{
public $restful = true;

public function get_index()
{
    $videos = DB::table('videos')->get();
    return View::make('videos.index')
        ->with('title', 'Videos')
        ->with('videos', $videos);
}
}

All i get is a blank page. I don't understand what i'm doing wrong. I'm using twitter bootstrap for css prototyping. Any help will be appreciated.

Here's how master.blade.php's 'head' looks like:

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ $title }} </title>
    <meta name="viewport" content="width=device-width">
    {{ HTML::style('css/bootstrap.min.css') }}
    {{ HTML::style('css/bootstrap-responsive.min.css') }}
</head>

This is what comes up in firefox when I inspect element.

<div class="media">

<div class="media-body">
    <iframe width="560" height="315" frameborder="0" allowfullscreen=""   src="http://www.youtube.com/watch?v=1iBm60uJXvs">
        #document
            <html>
                <head></head>
                <body></body>
            </html>
    </iframe>
</div>

</div>
share|improve this question
 
Did you check the blank page's source code? Is it generating the iFrames? If so, did you check that the links work in an browser? –  Sven Jun 6 at 12:39
 
It does generate the iframes and the links does work in the browser. –  Xk0nSid Jun 6 at 15:59
add comment

1 Answer

how does your 'layouts.master' looks like? any html source code in your browser? have a look: your 'index.blade.php' should be encoded in UTF-8 WITHOUT 'BOM' (in your editor)!!

'@layout('layouts.master')' has to be the very first (same issue to me yesterday in L4).

share|improve this answer
 
this is not an answer for this question .. plzz post this as a comment –  Mingebag Jun 6 at 9:47
 
"@layouts('layouts.master')" is the first thing. I've added the master.blade.php's '<head>' content in the question. –  Xk0nSid Jun 6 at 16:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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