Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
Hi,

On my site I have a portfolio, I am wondering if it is possible to add a link to the next portfolio item when viewing a portfolio item in page-view? Don't know if I am explaining correctly, I just want to link all the portfolio items together a bit better so people dont have to go back to the list view to see the next item. I'd like to put two arrows on either side of the page that links to the next and previous items in the same template.

Does that make sense?
Hi Datsun,

The problem (and also some possible solutions) of showing next and prev links has been discussed here -
viewtopic.php?f=2&t=21

You can also try the following if it suits you -
viewtopic.php?f=4&t=7087

Finally, and I think this will suit you best, you can declare the portfolio template as having nestable pages
Code: Select all
<cms:template clonable='1' nested_pages='1'> .. </cms:template>

This will give you the ability to manually set the order of the portfolio items and (more pertinent to your question) also provides variables that provide links to the next and prev pages (use cms:dump on the page to see all the variables that provide this info).
Please see http://www.couchcms.com/docs/tags-refer ... pages.html for more info.

Hope this helps.
Awesome, I think that should work. I haven't used nested-pages yet, but I will give it a go later on tonight.

My portfolio isn't really that advanced, I'm not using folders, search or anything that can limit the number of cloned pages that is seen.
Hi, just read these posts with interest. I haven't used nested pages yet either. I'm thinking the scenario Datsun described I would have set paginate='1' on the cloned pages and created a string of linked items that way. I know Couch allows lots of ways to skin a cat - is this as valid or flexible or correct as using nested pages?
Hi Potato,

As stated in the docs, nested pages can be used in-lieu of normal cloned pages for sections that are not likely to have thousands of cloned pages (having hundreds of pages is perfectly alright).
Most portfolio sections, sliders etc. will fit the bill.

Using nested-pages gives the additional benefit of having the ability to easily change the display order of pages (using up/down arrows in admin) and also having the next and prev links that are the topic of this thread.

In list-view, this is how cms:nested_pages tag can be used instead of our regular cms:pages tag to create paginated listing (the pagination part is exactly the same as that used with cms:pages)-
Code: Select all
<cms:nested_pages masterpage='index.php' include_custom_fields='1'  paginate='1' limit='5' >
    <cms:if k_paginated_top>
        <cms:if k_paginator_required >
            Page <cms:show k_current_page /> of <cms:show k_total_pages /><br>
        </cms:if>
        <cms:show k_total_records /> records Found.
        Displaying: <cms:show k_record_from />-<cms:show k_record_to />
        <br /><hr />
    </cms:if>

    <!-- Values of all fields defined in the nested-pages are available here -->
    <a href="<cms:show k_nestedpage_link />"><cms:show k_nestedpage_title /></a><br />

    <cms:paginator />
     
</cms:nested_pages>

or
Code: Select all
<cms:nested_pages masterpage='index.php' include_custom_fields='1'  paginate='1' limit='5' >
    <cms:if k_paginated_top>
        <cms:if k_paginator_required >
            Page <cms:show k_current_page /> of <cms:show k_total_pages /><br>
        </cms:if>
        <cms:show k_total_records /> records Found.
        Displaying: <cms:show k_record_from />-<cms:show k_record_to />
        <br /><hr />
    </cms:if>

    <!-- Values of all fields defined in the nested-pages are available here -->
    <a href="<cms:show k_nestedpage_link />"><cms:show k_nestedpage_title /></a><br />

    <cms:if k_paginated_bottom >
        <cms:if k_paginate_link_prev >
            <a href="<cms:show k_paginate_link_prev />">prev</a>
        </cms:if>
        <cms:if k_paginate_link_next >
            <a href="<cms:show k_paginate_link_next />">next</a>
        </cms:if>
    </cms:if>
     
</cms:nested_pages>

Datsun actually meant creating the next and prev links within a page-view
This is how it can be done -
Code: Select all
<cms:if k_prev_nestedpage_link >
    <a href="<cms:show k_prev_nestedpage_link />">&laquo; <cms:show k_prev_nestedpage_title /></a>
</cms:if>
<cms:if k_next_nestedpage_link >
    <a href="<cms:show k_next_nestedpage_link />"><cms:show k_next_nestedpage_title /> &raquo;</a>
</cms:if>

Hope this helps.
5 posts Page 1 of 1