Forum for discussing general topics related to Couch.
4 posts Page 1 of 1
1. Using the <cms:pages> tag
Code: Select all
<cms:pages masterpage='blog.php' limit='4' start_on=k_month stop_before=k_next_month>
<a href="<cms:show k_page_link />"><cms:show k_page_title /></a> -
<i><cms:date k_page_date /></i>
</cms:pages>

I need to list four articles that were published in the same month as the article. The code above just lists the four most recent articles.

2. How do I prevent getting a 403 error
'You don't have permission to access... on this server. ' when placing <iframe> in any admin panel text region even with no_xss_check='1' present.

A quick reply would be appreciated.

Thanks
Replying to your first question -
In your code you are using 'k_month' and 'k_next_month' to set the time-period of the displayed pages.
Unfortunately, no such variables exist.

The only variable we have would be the 'k_page_date' that shows the publish-date of the page being viewed.
So, we need to use this variable to calculate the start_on and stop_before dates.

We'll require using PHP to do so -
Code: Select all
<cms:php>
    global $CTX;
   
    // First day of the month the page is published in
    $ts_start_on = @strtotime( "first day of this month", @strtotime('<cms:show k_page_date />') );
   
    // First day of next month
    $ts_stop_before = @strtotime( "first day of next month", $ts_start_on );
   
    // set as Couch variables for use in code ahead
    $CTX->set( 'my_start_on', @date( 'Y-m-d', $ts_start_on ), 'global' );
    $CTX->set( 'my_stop_before', @date( 'Y-m-d', $ts_stop_before ), 'global' );
</cms:php>

The code above assumes that you are using it in a 'page_view' (else there will no 'k_page_date' to work with.
It sets two variables - 'my_start_on' and 'my_stop_before' that you can now use in the cms:pages.

As for the second problem you mentioned (403 error) - I am sorry but I won't be able to help much with that. Clearly it is a server-side permission issue and is not Couch specific.

Hope this helps.
As for the second problem you mentioned (403 error) - I am sorry but I won't be able to help much with that. Clearly it is a server-side permission issue and is not Couch specific.


Is it a permissions error?
Is it a permissions error?
So it seems.
4 posts Page 1 of 1