Important announcements from CouchCMS team
32 posts Page 3 of 4
A while back you posted a module for ratings and polls. I'm curios if a user could mark "x" number of stars for a cloned page and save it, then re-rate the page later. The goal is to have these pages appear in their profile as pages they've rated.
how to make route filter for folders?
I use filters='page_exists' for pages and it works very well - performed redirekt to page 404, but how to make this for folder?

@orbital, are you trying to create/edit/delete folders from the front-end?
create/edit/delete folders from the front-end - no

In this moment when you try to open a nonexistent folder displays a blank page now - I must say that this is not a big problem yet :D
@orbital, not sure about your use-case but perhaps you'll find the <cms:folder_exists /> tag useful.
It supports three parameters -
a. masterpage
b. name
c. id
where the last two can be used to specify which folder you are trying to verify the existence of.

Hope it helps.
Thank you very much KK :)
But I have another very interesting question!

I have folder view in my index.phpclonable template.
Here there is pages tag for products, but the products are many and need to do pagination. But then there is the following link:

Of course this is no longer working.
Could there be a decision this situation - i.e. have paging with custom routing?
Could there be a decision this situation - i.e. have paging with custom routing?

Yes. Please set the 'base_link' parameter of cms:pages to the list-view URL and that should output the correct links for the pagination crumbs. Example -
Code: Select all
   base_link="<cms:route_link 'list_view' />"

Please let me know if it helped.
Thanks a lot KK :D
I'm using custom routes, but all the links within the admin panel (when I want to view the actual page) have the "old", non pretty-url-enabled URL, like: - this is of course not a working URL any more.

Something I missed here? Or can I change things now with Couch 2.0? (couldn't find anything though within theme\_system\ where I can change the actions though...)
can I change things now with Couch 2.0?

There are two places where we'll need to change the 'view' links - the listing page (magnifying glass icon) and the edit page.

Please place the following in your kfunctions.php file -
Code: Select all
// This is for the listing page
$FUNCS->add_event_listener( 'alter_render_vars_list_row', 'my_alter_view_link' );
function my_alter_view_link(){
    global $CTX, $FUNCS;

    $masterpage = 'your-template.php'; // change this to set the masterpage you are interested in

    $route = $FUNCS->current_route;
    if( $route->module!='pages' || $route->masterpage!=$masterpage ) return;

    // set the mew view link
    $page_id  = $CTX->get('k_page_id');
    $view_link = K_SITE_URL . $masterpage .'?p='. $page_id . '&test=123';
    $CTX->set( 'k_view_link', $view_link );

// This is for the edit page
$FUNCS->add_event_listener( 'alter_pages_form_page_actions', 'my_alter_view_link_in_form' );
function my_alter_view_link_in_form( &$arr_actions ){
    global $FUNCS, $PAGE;

    $masterpage = 'your-template.php'; // change this to set the masterpage you are interested in

    $route = $FUNCS->current_route;
    if( $route->module!='pages' || $route->masterpage!=$masterpage ) return;

    if( array_key_exists('btn_view', $arr_actions) ){
        $view_link = K_SITE_URL . $PAGE->tpl_name . '?p=' . $PAGE->id . '&test=123';
        $arr_actions['btn_view']['href'] = $view_link; // set your custom URL here

Make sure to replace the two instances of 'your-template.php' above with the name of your template that needs the new links.

Now in the listing pages of that template, you'll notice that the link shown by the magnifying glass has an additional '&test=123' appended to it.
You'll notice the same behaviour in the 'View page' button on the edit screen.

This, of course, is not what you asked for but my intention in giving you this code is to demonstrate how and where we can modify the view-link.

Instead of adding the silly test=123 as we did above we can now set any link of our choice here and it will reflect in the admin listing.

I think you'll be able to craft the correct links matching your routes at this point.
For the list page, you'll find the entire 'page' in context here so you can get your field's values from $CTX (like the same above does for k_page_id). For the edit page, we of course have the $PAGE object.

Hope it helps.
32 posts Page 3 of 4