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

I wonder, why is the code below not doing what I want..I want to simply show a button only on a specific nested page, and this code is not working, I get the button displayed on all nested pages:

Code: Select all
<cms:nested_pages masterpage='index.php'>
           <cms:if k_nestedpage_name='statuten'>
             <div class="button hide-for-print" onclick="myFunction()">Seite ausdrucken</div>
             <cms:else/>
             <div class=""></div>
           </cms:if>
</cms:nested_pages>


I would appreciate help...
Thanks
Tanja
Hi Tanja,

The <cms:nested_pages> tag, as I am sure you know, loops through *all* pages of the specified masterpage.
Your code, therefore, loops through the pages and when it comes across the 'statuten' page, it outputs the button.

So the code is working as expected.
What you have is a 'logical' error -
No matter where you have placed the snippet, the <cms:nested_pages> will *always* find the 'statuten' page because, as I mentioned, it loops through all the pages.

So. suppose you only have two nested-pages - one named 'abc' and the other 'statuten'.
Whichever of the two you visit, the <cms:nested_pages> tag loops through both and when it comes to the 'statuten' page it outputs the button. You therefore end up having the button on the page-views of both the pages.

The code that you need is this -
Code: Select all
<cms:if k_page_name='statuten'>
    <div class="button hide-for-print" onclick="myFunction()">Seite ausdrucken</div>
<cms:else/>
    <div class=""></div>
</cms:if>

As you can see, we don't need the loop. We are already in the page-view so we just check if the current page is 'statuten' and do the needful.

Hope this helps.
Thanks KK!
Thanks for clarification!!! :oops:

I would please have another question about admin area, I post tow screenshots.
I unpublished some pages but the sign, that they are unpublished, is not showing...
One clonable template shows all right (first screen shot)
unpublished1.jpeg
here unpublished pages are marked
unpublished1.jpeg (22.11 KiB) Viewed 215 times


and another do not show that sign, although two of pages are unpublished..
unpublished2.jpeg
and here not
unpublished2.jpeg (12.08 KiB) Viewed 215 times


Thanks in advance!!!!!!
Tanja
Tanja, for nested-pages (as opposed to normal cloned pages), instead of 'publish/unpublish' we have 'active/inactive'.
'Inactive' pages are shown with a strikethrough line in their titles e.g. as in the second and third pages below -
Untitled-1.png
Untitled-1.png (3.2 KiB) Viewed 213 times

Hope that answers the query.
HI KK,

thanks!!
Well this is happening not in the nested pages part of the admin, but in the stand alone templates. And it works for one template, but not for the other two...I thought it could be a back end issue, but could be that I am very wrong too...

Thanks in advance!
Tanja
Ok, I get it now.

The unpublished status is not showing up because you are using <cms:config_list_view> to customize the columns shown in the listing and the 'k_page_date' field (that, along with the publish date, also shows the unpublished status) is not in the list.

The easiest solution would be to simply add that field to <cms:config_list_view> like this -
Code: Select all
<cms:config_list_view orderby='weight' order='asc'>
    <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_page_date' />
    <cms:field 'k_up_down' />
    <cms:field 'k_actions' />
</cms:config_list_view>

However, I think that since you are using the 'up-down' buttons for manual sorting, you'd probably not want to show the publish-dates for all the pages and show only the 'unpublished' label where applicable. We can do that as follows -
Code: Select all
<cms:config_list_view orderby='weight' order='asc'>
    <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_page_date' sortable='0' header=''>
        <cms:if k_page_date='0000-00-00 00:00:00'>
            <span class="label label-error"><cms:localize 'unpublished' /></span>
        </cms:if>
    </cms:field>
    <cms:field 'k_up_down' />
    <cms:field 'k_actions' />
</cms:config_list_view>

Make sure to visit the modified template as super-admin for the changes to be persisted.

Hope this helps.
HI KK,

thanks a lot for taking a look! Yes that helps a lot, as well as your previous post!!!!!

And, it's never too much to say - thanks for great and actually intuitive Couch language!!!! I enjoy to work whit it whenever I have a chance!!!!

Tanja
You are always welcome :)
And thanks for the kind words.
8 posts Page 1 of 1

Who is online

In total there are 3 users online :: 1 registered, 0 hidden and 2 guests
(based on users active over the past 5 minutes)

Users browsing this forum: larin555 and 2 guests

cron