Forum for discussing general topics related to Couch.
7 posts Page 1 of 1
I've created an admin page for cloned pages to be ordered manually but the view page still lists them in date order.

How can I show the list in the order I've specified.

Thanks

Mark
Hi,

<cms:config_list_view> can be used to configure the listings.
A sample from one of my template -
Code: Select all
   <cms:config_list_view orderby='weight' order='asc' exclude='default-page'>
        <cms:field 'k_selector_checkbox' />
        <cms:field 'k_page_title' sortable='0' />
        <cms:field 'k_comments_count' />
        <cms:field 'k_page_foldertitle' />
        <cms:field 'k_up_down' />
        <cms:field 'k_actions' />
    </cms:config_list_view>

More details - viewtopic.php?f=5&t=10241#p24680

Hope this helps.
Hi KK, Thanks for that but it is still not working! I must be doing something wrong.

Here's my code and as the site is not live yet.

Code: Select all
<?php
if (strpos($_SERVER['REQUEST_URI'], "projects") !== false){
    require_once( '../holoadmin/cms.php' );
    echo '<cms:template title="Projects" clonable="1" order="30" />';
}
?>
<cms:config_list_view orderby='weight' order='asc' exclude='default-page'>
        <cms:field 'k_selector_checkbox' />
        <cms:field 'k_page_title' sortable='0' />
        <cms:field 'k_comments_count' />
        <cms:field 'k_page_foldertitle' />
        <cms:field 'k_up_down' />
        <cms:field 'k_actions' />
    </cms:config_list_view>

<cms:editable
    name="projectdescription"
    label="Project Description"
    type="nicedit"
    hidden="1">
    </cms:editable>

    <cms:editable
    name="hashtags"
    label="Hash Tags"
    type="text"
    order="2"
    hidden="1">
    </cms:editable>

<cms:repeatable name="project" stacked_layout='1' order="30">
    <cms:editable
    name="projectimage"
    label="Project Image"
    type="image"
    hidden="1">
    </cms:editable>

    <cms:editable
    name="projectvideo"
    label="Project Video"
    desc="Just the first Vimeo number for the video eg: 1234567"
    type="text"
    hidden="1">
    </cms:editable>
</cms:repeatable>

<!-- ################################################## -->

<cms:if k_is_page>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Hologramica</title>

    <script type="module">
    document.documentElement.classList.remove('no-js');
    document.documentElement.classList.add('js');
    </script>

    <link rel="stylesheet" href="../css/styles.css" />

    <meta name="description" content="The cutting edge of hologram projection" />
    <meta property="og:title" content="Hologramica" />
    <meta property="og:description" content="The cutting edge of hologram projection" />
    <meta property="og:image" content="https://www.hologramica.com/img/.jpg" />
    <meta property="og:image:alt" content="Hologramica Logo" />
    <meta property="og:locale" content="en_GB" />
    <meta property="og:type" content="website" />
    <meta name="twitter:card" content="summary_large_image" />
    <meta property="og:url" content="https://www.hologramica.com" />
    <link rel="canonical" href="https://www.mywebsite.com/page" />

    <link rel="icon" href="/favicon.ico" />
    <link rel="icon" href="/favicon.svg" type="image/svg+xml /">
    <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
    <!--
    <link rel="manifest" href="/my.webmanifest" />
    -->
    <meta name="theme-color" content="#FFFFFF" />
    <link rel="preload" href="../css/styles.css" as="style" />

<script
    src="https://code.jquery.com/jquery-3.6.0.min.js"
    integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
    crossorigin="anonymous">
</script>

</head>
<body>
    <base '../'>
    <main>
    <cms:pages masterpage="pages/header.php">
<header>
    <div class="headerLeft">
        <img src="../img/hologramica_logo.svg" alt="Hologramica Logo">
    </div>

    <div class="headerRight">
        <div class="headerPhoneHolder">
            <div class="headerUKphone">
                <a href="tel:<cms:show uksitephone />">UK: <cms:show uksitephone /></a>
            </div>
           
            <div class="headerUSphone">
                <a href="tel:<cms:show ussitephone />">US: <cms:show ussitephone /></a>
            </div>
        </div>

        <div class="headerMenu menuOpen">
            <div class="headerMenuIconHolder">
                <img class="headerMenuIcon" src="../img/icon_menu.svg" alt="Menu">
            </div>
        </div>
    </div>
</header>
</cms:pages>

<div class="menuOverlay">
        <a class="menuClose">
            <img src="img/icon_menu_close.svg" alt="">
        </a>

    <div class="menuHolder">
        <h3>Menu</h3>
        <a class="menuItem" href="../index.php#home">Home</a>
        <a class="menuItem" href="../index.php#portfolio">Portfolio</a>
        <a class="menuItem" href="../index.php#whatwedo">What we do</a>
        <a class="menuItem" href="http://holonet3d.com/" target="_blank">Holonet</a>
        <a class="menuItem" href="../index.php#booking">Book a viewing</a>
        <a class="menuItem" href="../index.php#contact">Contact Us</a>
    </div>
</div>
<!-- ###################################### -->
<cms:pages masterpage='pages/projects.php' page_name="<cms:show k_page_name />">

<cms:show_repeatable 'project'>
    <section class="projectVideo">
        <div class="videoHolder">
            <div class="videomute">
                    <img src="/img/volume_mute.svg">
            </div>

            <div class="videopause">
                    <img src="/img/video_pause.svg">
            </div>

            <div class="videoFullScreen">
                <img src="/img/video_fullscreen.svg">
        </div>

        <div class="videoClose">
                <img src="/img/video_fullscreen.svg">
        </div>

            <video autoplay muted width="80%">
                <source type="video/mp4" src="<cms:show projectvideo />">
            </video>
        </div>
    </section>
    </cms:show_repeatable>
<section class="projectpage">
<h1><cms:show k_page_title /></h1>
<h4><cms:show projectdescription /></h4>
<p>back</p>
</section>
</cms:pages>

<!-- ###################################### -->
<hr>

<a href="/pages/allprojects.php">
    <div class="viewAllProjects">
            <p>View all projects
                <span>
                    <img src="/img/arrowRight.svg" alt="">
                </span>
            </p>
    </div>
</a>

<section class="portfolio">
<cms:pages masterpage='pages/projects.php' limit="6" order='asc'>
    <cms:show_repeatable "project">
    <div class="projectHolder">
        <div class="projectImageHolder" style="background-image:url(<cms:show projectimage />); background-size:contain; background-repeat:no-repeat; background-position:top center;">
        <div class="projectOverlay"><cms:show k_page_title /></div>
        <img class="playButton" src="/img/play-button.png" alt="Play button" />
        <a href="<cms:show k_page_link />"></a>     
    </div>
</div>
    </cms:show_repeatable>
    </cms:pages>
</section>

<hr>

<a href="/pages/allprojects.php">
    <div class="viewAllProjects">
            <p>View all projects
                <span>
                    <img src="img/arrowRight.svg" alt="">
                </span>
            </p>
    </div>
</a>

<!-- ###################################### -->
<footer>
    <div class="footerRowTop">
        <div class="footerTopLeft">&copy; Hologramica</div>
        <div class="footerTopRight"></div>
    </div>

    <div class="footerRowBottom">
        <div class="footerTopLeft">&copy; Hologramica</div>
        <div class="footerTopRight"></div>
    </div>
</footer>
    </main>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/waypoints/4.0.1/jquery.waypoints.js" integrity="sha512-ZKNVEa7gi0Dz4Rq9jXcySgcPiK+5f01CqW+ZoKLLKr9VMXuCsw3RjWiv8ZpIOa0hxO79np7Ec8DDWALM0bDOaQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <script src="../js/application-min.js"></script>
    <script src="../js/waypoints-min.js"></script>
    <script src="../js/video-min.js"></script>
    <script src="../js/menu-min.js"></script>
    <script src="../js/menu.js"></script>
</body>
</html>
    <cms:else />
    <span class="anchor" id="portfolio"></span>

<a href="/pages/allprojects.php">
    <div class="viewAllProjects">
            <p>View all projects
                <span>
                    <img src="/img/arrowRight.svg" alt="">
                </span>
            </p>
    </div>
</a>

<section class="portfolio">
<cms:pages masterpage='pages/projects.php' limit="6" order='asc'>
    <cms:show_repeatable "project">
    <div class="projectHolder">
        <div class="projectImageHolder" style="background-image:url(<cms:show projectimage />); background-size:contain; background-repeat:no-repeat; background-position:top center;">
        <div class="projectOverlay"><cms:show k_page_title /></div>
        <img class="playButton" src="img/play-button.png" alt="Play button" />
        <a href="<cms:show k_page_link />"></a>     
    </div>
</div>
    </cms:show_repeatable>
    </cms:pages>
</section>
</cms:if>

<a href="/pages/allprojects.php">
    <div class="viewAllProjects">
            <p>View all projects
                <span>
                    <img src="img/arrowRight.svg" alt="">
                </span>
            </p>
    </div>
</a>

<hr>

<?php
if (strpos($_SERVER['REQUEST_URI'], "projects.php") !== false){
    COUCH::invoke();
}
?>
Hi,

As stated in the docs, <cms:config_list_view> tag needs to be nested within the <cms:template> block to take effect.

In your code, the <cms:template> block is self-closing and nothing is nested within it.

Hope this helps.
Thanks KK,

I've instigated the code below but to no avail.

Is there something I should put in the <cms:pages masterpage='pages/projects.php' limit="6" order='asc'>?

<?php
if (strpos($_SERVER['REQUEST_URI'], "projects") !== false) {
require_once( '../holoadmin/cms.php' );
echo "<cms:template title='Projects' clonable='1' order='30'>
<cms:config_list_view orderby='weight' order='asc' exclude='default-page'>
<cms:field 'k_selector_checkbox' />
<cms:field 'k_page_title' sortable='0' />
<cms:field 'k_comments_count' />
<cms:field 'k_page_foldertitle' />
<cms:field 'k_up_down' />
<cms:field 'k_actions' />
</cms:config_list_view>'
</cms:template>";
}
?>

Thanks again for any help.

Mark
Where exactly is that listing located, Mark?
I was under the impression, you meant in the admin-panel - for that <cms:config_list_view> is what is required.

If, however (as now appears from your last message), the listing is on the frontend using <cms:pages>, then you only need to set the 'orderby' and 'order' params to match those in the admin-panel e.g.
Code: Select all
<cms:pages masterpage='pages/projects.php' limit="6" orderby='weight' order='asc'>

Does this help?
In case it wasn't clear from my reply, please allow me to add that -

1. Ordering normal cloned pages, as opposed to nested pages, manually (internally translates to their weights) requires the use of <cms:config_list_view> as shown before - that snippet serves to add the up/down arrows in admin-panel listing (that are then used for ordering).

2. Once the pages are ordered manually in the admin-panel, listing them on the front-end using <cms:pages> will additionally require setting the orderby='weight' order='asc' parameters.

So, both the steps would be needed.
7 posts Page 1 of 1