Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Hello Guys,

Help will be greatly appreciated.

Is there a way to show nested_page images in a loop. I have a the following code below, everything works except being able to show the nested_page image.
Code: Select all
<h1><cms:show k_page_title /></h1>
<img src="<cms:show image />" alt="<cms:show k_page_title /> " />

<cms:nested_pages masterpage='page.php' depth='1' childof='@current' >
<li><a href="<cms:show k_nestedpage_link />" title="<cms:show k_nestedpage_title />"></a></li>
<img src="<cms:show (what to put here to show image)  />"
</cms:nested_pages>

Unfortunately I cant seem to get the nested_pages to show their own images in the loop rather it replicates the same image throughout.

Thanks in advance.
Hi,

As noted in the docs (https://docs.couchcms.com/tags-referenc ... pages.html) -
For performance reasons, data from the custom fields (i.e. the editable regions defined for the nested-pages template) is not made available by default. You can set the 'include_custom_fields' parameter to '1' to make the custom fields available.

So by adding that param to your code, you can access to the editable region you defined for the image. Assuming its name is 'my_image', following should work -
Code: Select all
<cms:nested_pages masterpage='page.php' depth='1' childof='@current' include_custom_fields='1'>
    <li><a href="<cms:show k_nestedpage_link />" title="<cms:show k_nestedpage_title />"></a></li>
    <img src="<cms:show my_image />"
</cms:nested_pages>

Hope this helps.
YAAY!!!

It worked like MAGIC.

Thank you very much.

Its always a pleasure learning from you.

Its day 44 for me since i started web programming with couchcms.
You are welcome :)
4 posts Page 1 of 1
cron