Problems, need help? Have a tip or advice? Post it here.
2 posts Page 1 of 1
I was going through the index page tutorial but didn't quite understand the part about how to embed a particular post in that page. In particular I wanted to embed one of my videos on the index page. How do you indicate that? My current code on the index page:

Code: Select all
                                <iframe title="YouTube video player" width="480" height="390" src="http://www.youtube.com/embed/<cms:show video/>" frameborder="0" allowfullscreen></iframe>


The tutorial used <cms:show image_1/> is there a way images and videos are numbered that we can call indivvidual ones?
Hi,

The <cms:show video/> you are using in your code references 'video' which, of course, is the name of an editable region defined within the template.

When we are in a page-view (i.e. accessing a single page), Couch knows that 'video' represents the value contained within the particular page being shown. However, in list-views (like the lndex page you mentioned), there is no page associated with the view so simply stating <cms:show video/> will not work.
You need to fetch in the page(s) that contain that fields.

The standard method is to use the 'pages' tag.
If we use -
Code: Select all
<cms:pages>
   <cms:show video/>
</cms:pages>

- the code above will loop through all the pages cloned from the current template and try to show the value of 'video' within each page.

If you wish to show the values from only some pages or a single page, you can use specify further attributes to filter the pages being fetched by the 'pages' tag.
e.g
Code: Select all
<cms:pages page_name='test-video-2'>
   <cms:show video/>
</cms:pages>

will fetch only a single page with the name of 'test-video-2'.

Please see http://www.couchcms.com/docs/tags-reference/pages.html for a detailed discussion of all the available parameters.

Hope this answers the question.
2 posts Page 1 of 1