Templating Matrix Block It's my first website using Craft.
I'm trying to figure out how to loop Matrix. I have created a field called bannerMatrix with a block type called banner that has 3 fields:


Image (assets)
Heading (plain text)
Subheading (plain text)


This is what I have so far:

{% for block in entry.bannerMatrix %}
    {% if block.type == "banner" %}
        &lt;div&gt;
            &lt;img src="{{ block.image }}" alt="{{ image.title }}"&gt;
            &lt;div class="hero_msg"&gt;
                &lt;h3&gt;{{ block.heading }}&lt;/h3&gt;
                &lt;h4&gt;{{ block.subheading }}&lt;/h4&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    {% endif %}
{% endfor %}


Anything will be helpful.
Thanks!



UPDATE

@JamieWade, thanks a lot for the super fast answer! 
Unfortunately, the code above still doesnt work for me :(

{% for block in entry.bannerMatrix %}
    &lt;div&gt;
        &lt;img src="{{ block.image.first().title }}" alt=""&gt;
        &lt;div class="hero_msg"&gt;
            &lt;h3&gt;{{ block.heading }}&lt;/h3&gt;
            &lt;h4&gt;{{ block.subheading }}&lt;/h4&gt;
        &lt;/div&gt;
    &lt;/div&gt;
{% endfor %}


I also tried this :

{% set image = block.image.first() %}
{% if image %}
    &lt;img src="{{ image.getUrl('image') }}"&gt;
{% endif %}


And I dont get anything as well :(

I wonder if my structure is correct. So I attached a screenshot.


@Alec, yes there is content in the entry(I attached a screenshot). Now I'm even more curious, what's missing here. I also added the path to subfolder in the Field Setting.
From your last update it looks like you simply need to get the entry that contains that matrix block, the error Variable "entry" doesn't exist simply means nothing is assigned to entry in your templates. There are a couple of ways you can solve this:

Option 1 - Tell Craft which template to load for this entry  

If you go into your section settings, there will be a field called Entry template which if, for example, you put about in this craft would look for either about.html or about/index.html in your craft/templates folder and would automatically assign a variable entry to your template when you visit the /about url.

There is also an option This is for the homepage in the settings which, if checked, will assign the entry to index.html in your templates (but i don't think this will show if there is already a section checked elsewhere)

You can see more about this in the craft docs: http://buildwithcraft.com/docs/templating-overview

Option 2 - Fetch the entry in your template using twig tags

There are numerous ways to do this, but given you are using a single you should just be able to use this:

{% set entry = craft.entries.section('homePageBanner').first() %}


You might need to adjust the homePageBanner part if that isn't the handle of your section, but this will then give you an entry variable to work with in your template and hopefully you'll find you will get the matrix content back :)

If you need some more details on how craft.entries works then the docs are a great place to find out more: http://buildwithcraft.com/docs/templating/craft.entries