Forum for discussing general topics related to Couch.
11 posts Page 1 of 2
Relatively new to Couch, and loving it thus far!

I have created a blog section that is set to clonable, creating multiple pages. I've called it "Pages"...

Code: Select all
<cms:template title='Pages' clonable='1'>


When I access the page, once saved, with the reference url, for example .com?p=45, I only get the latest post created and not the matching post.

As I am still getting my head around all this, any help will be much appreciated!

Thanks!
Hi,

Could you please let us know the code you are employing within the template to show the blog posts?
Thanks for the reply.

This is what I am using to define the page areas.

Code: Select all
<cms:template title='Pages' clonable='1'>
    <cms:editable name='group_pages' label='Page Content' desc='Create Pages' type='group' />
       
        <cms:folder name='product' title='Product' group='group_pages' />
        <cms:folder name='public' title='Public' group='group_pages' />
        <cms:folder name='media' title='Media + Press' group='group_pages' />
       
        <cms:editable name='page_heading' label='Page Heading' type='text' group='group_pages' />
        <cms:editable name='page_sub_heading' label='Page Sub Heading' type='text' group='group_pages' />
        <cms:editable name='page_summary' label='Page Summary' type='text' group='group_pages' />
        <cms:editable name='tags' label='Tags' desc='Use comma to separate multiple tafs' type='text' group='group_pages' />
        <cms:editable name='page_content' label='Page Content' desc='enter content as required to fill page' type='richtext' group='group_pages' />
        <cms:editable name='page_image_1' label='Main Image' desc='Add a main image for the page' type='image' crop='1' group='group_pages' width='1920' height='950' />
        <cms:editable name='page_image_2' label='Inset Image' desc='Add an image to the top' type='image' crop='1' group='group_pages' />
       
</cms:template>

Then this is what I am calling in the page itself:

Code: Select all
                    <!-- Module area start -->
                    <cms:embed 'pages.inc' />
                    <!-- Module area End -->
                    <cms:embed 'section_subscribe.inc' />
Thanks.

I think the code I am interested in would be in 'pages.inc' snippet.
Could you please post that?
Sure thing. Thanks for this...

Here you are.

Code: Select all
                <section id="article" class="about-area gray-bg pt-80">
                    <div class="container">
                        <div class="row">
                            <div class='col-sm-8'>
                                <h2 class="p-0">
                                    <cms:show page_sub_heading/>   
                                </h2>
                                <blockquote  class="pt-10 pb-0">
                                    Publish Date: <cms:date k_page_date />
                                </blockquote>
                                <div class="col-sm-12">
                                    <div class="large-text pb-20" style="font-size: 2rem;">
                                        <!-- Add Socials -->
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-4">

                            </div>
                            <div class="col-md-8 about-content pb-40">
                                    <cms:show page_content />         
                            </div>
                            <div class="col-md-4">
                                    <div class="about-img">
                                            <img src="<cms:show page_image_2/>" />
                                    </div>
                            </div>
                        </div>
                    </div>
                </section>
Thanks.

The code looks pretty OK to me - nothing that would tie the variables up to the latest post.

Could you please let me know what exactly happens when you visit a blog post from within the admin-panel (by clicking on the magnifying glass icon in the list of posts)? Do you still reach the wrong post?
Thanks for coming back to me.

Clicking the magnifying glass beside each of the clonable pages, the post that is returned is always the latest content from the most recent post, no matter the URL.

For instance, the most recent post created is ../pages.php?p=53. When I click on the other pages, I expect to see the page content from the relevant page, ie pages.php?p=45, pages.php?p=52 ... etc, but for some reason, it only shows the page content from post 53.

It is like it is holding the latest page as a variable... can't work it out...
OK, that is quite intriguing.

Could you please PM me the main template along with all snippets it embeds? (make sure to zip up the files before attaching).
Let me set it up on my end and see what is happening.

Thanks
Sure thing.

Shot you over the files via PM.

Thanks!
Thanks.

I had a look and found the following to be the problem -
You have enclosed almost the entire markup within a <cms:pages> tag:
Code: Select all
<html class="no-js" lang="zxx">
<cms:pages limit='1' >
    <head>
    ..
        <cms:embed 'pages.inc' />
    ..
    </body>
</cms:pages>
</html>

That <cms:pages> tag is being explicitly instructed to fetch one single page and since, by default, it lists pages in descending order of their publish date it faithfully fetches the latest one it finds (regardless of which page is indicated in the URL).

Please remove the <cms:pages></cms:pages> tags and that should solve the current issue.

In all likelihood, you'll also want to list all the pages somewhere - for that please see our Aurelius tutorial on how to make use of 'views'.

Hope this helps.
11 posts Page 1 of 2