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

I have folder list view pages

Code: Select all
<cms:pages folder=k_folder_name include_subfolders='1'  masterpage='catalog.php' limit='10' paginate='1' >
</cms:pages>


with a title header tag

Code: Select all
<title><cms:get_custom_field 'site_name' masterpage='globals.php' /> | <cms:if k_folder_title ><cms:show k_folder_title/> - <cms:show k_template_title /><cms:else /><cms:get_custom_field 'catalog_title' masterpage='globals.php' /> </cms:if></title>


When the amount of pages in a folder are, let's say 15, Couch generate nicely two pages but both have the same page title. Is there a way to avoid this ?
I load frameworks and write bugs on top of them, after that I rearrange the code so that it looks like a cool product.
Hi Tom,

As I understand, you wish to have different HTML title for each page in the pagination set.
Please place a <cms:dump /> on the template and you'll see (of others) all the pagination related variables available for use. You can put in a check (<cms:if ..) and use the variable(s) of your choice.

'<cms:show k_current_page />' or '<cms:show k_current_page /> of <cms:show k_total_pages />' could be candidate strings.

Hope this helps.
Hi KK,

<cms:show k_current_page /> would give as result something like 2 ... if this is inside cms:pages tag or not ?

As it happens my header rendered is before my html stuff (like the cms:pages tag). Do you suggest to use the cms:pages tag in the header ?

Thanks again.
I load frameworks and write bugs on top of them, after that I rearrange the code so that it looks like a cool product.
Apologies, Tom. I see the problem now.
Just to be clear, if this is your current code -
Code: Select all
<title><cms:show k_current_page /></title>

<cms:pages .. limit='10' paginate='1' >
    ..
    <cms:show k_current_page />
    ..
</cms:pages>

- the 'k_current_page ' variable becomes available only within the cms:pages block. As the TITLE comes before this variable could be set, as you correctly remarked, we cannot use the variable within the title.

This is a tricky one but can be handled if you are prepared to juggle the code a bit.

The solution is to move the cms:pages block so as to make it execute *before* the title.
Now obviously we do not want the page listing to be outputted before the title so we'll only make the block *execute* but not *output*.

You must have surely seen the cms:capture tag in action before.
We can use it like this -
Code: Select all
<cms:capture into='my_content'>
    <cms:pages masterpage..  paginate='1' >

       ...

        <cms:if k_paginator_required && k_paginated_top >
            <cms:set my_title="Page <cms:show k_current_page /> of <cms:show k_total_pages />" scope='global' />
        </cms:if>
       
        ...

    </cms:pages>
</cms:capture>

<title>hello <cms:show my_title /></title>

..
..
<cms:show my_content />

In the code above we relocate the cms:pages block to make it execute before the title so that we can set the variable named 'my_title' for use within the title. We, however, enclose the block within cms:capture so that its HTML output is buffered within a variable named 'my_content'.

We then show the contents at the right place (i.e after the title).

Hope this helps.
Hi KK,

Yes... this helps me a lot, I can follow your approach, thanks for the trick.
I load frameworks and write bugs on top of them, after that I rearrange the code so that it looks like a cool product.
5 posts Page 1 of 1