Forum for discussing general topics related to Couch.
8 posts Page 1 of 1
I found this addon viewtopic.php?f=8&t=11545 which looks a really good feature so thought would try it on the demo couchcms site I made ages ago but it's not working for some reason, I don't see the Copy to New and Add new buttons on the page I made called copy-page.php

I followed the instructions on the link and activated it and put copy-page.php in the copy-to-new/config.php file and also visited the page while logged in as super admin. Not sure what I have missed

All I see when visit the page in the admin side is advanced settings at the top right and the page title input field and the editable regions to add/edit text
Could you please let us know the version of Couch in use?
Sorry yeah it's 2.2
Well, the addon should work well with v2.2.
That said, I noticed you mentioned -
I don't see the Copy to New and Add new buttons on the page

Now, the "Add New" button appears by default for all template (i.e. has nothing to do with the addon in question).
If it is not showing up, perhaps some other code (maybe in your kfunctions.php file) is at work?
Please check.

Also try disabling the addon and see if the "Add New" button shows up.
I checked the kfunctions.php code inside the addons folder and has the following in it

Code: Select all
<?php
if ( !defined('K_COUCH_DIR') ) die(); // cannot be loaded directly

require_once( K_COUCH_DIR.'addons/cart/cart.php' );
require_once( K_COUCH_DIR.'addons/cart/session.php' );
require_once( K_COUCH_DIR.'addons/data-bound-form/data-bound-form.php' );
require_once( K_COUCH_DIR.'addons/recaptcha/recaptcha.php' );
require_once( K_COUCH_DIR.'addons/simple-access-control/simple-access-control.php' );
//require_once( K_COUCH_DIR.'addons/inline/inline.php' );
//require_once( K_COUCH_DIR.'addons/extended/extended-folders.php' );
//require_once( K_COUCH_DIR.'addons/extended/extended-comments.php' );
require_once( K_COUCH_DIR.'addons/extended/extended-users.php' );
//require_once( K_COUCH_DIR.'addons/routes/routes.php' );
//require_once( K_COUCH_DIR.'addons/jcropthumb/jcropthumb.php' );
require_once( K_COUCH_DIR.'addons/copy-to-new/copy-to-new.php' );

class MyEvent{
    function start_date( $field ){
        global $FUNCS;
       
        $start_date = trim($field->get_data());
        if( !preg_match('/(?:19|20)\d\d-(?:0[1-9]|1[012])-(?:0[1-9]|[12][0-9]|3[01])/', $start_date ) ){
            return KFuncs::raise_error( "Incorrect date format" );
        }
       
        // Set publish_date to value of this field
        $f = &$field->siblings[3];
        $publish_date = trim( $f->get_data() );
        if( $publish_date != '0000-00-00 00:00:00' ){
            $start_date = $FUNCS->make_date( $start_date );
            if( $publish_date != $start_date ){
                $f->store_posted_changes( $start_date );
            }
        }
        unset( $f );
       
        return true;
    }
}


I commented the copy add on line out so should of disabled it but still the same, below is the copy-page.php code if it helps

Code: Select all
<?php require_once( 'cms/cms.php' ); ?>

<cms:template title='Copy Page' order='13'>

<cms:editable name='first_column_section' label='First Column Section' type='group' collapsed='1' order='1' />
<cms:editable type='richtext' toolbar='full' name='first_column_text' label='First Column Text' group='first_column_section' />
   
<cms:editable name='second_column_section' label='Second Column Section' type='group' collapsed='1' order='2' />
<cms:editable type='richtext' toolbar='full' name='second_column_text' label='Second Column Text' group='second_column_section' />
   
<cms:editable name='third_column_section' label='Third Column Section' type='group' collapsed='1' order='3' />
<cms:editable type='richtext' toolbar='full' name='third_column_text' label='Third Column Text' group='third_column_section' />
   
</cms:template>

<!DOCTYPE html>
<html lang="en">

  <head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">

   <title><cms:editable name='page_title' label='Page Title' type='text' order='-1'/></title>
     
      <link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet dns-prefetch" type="text/css">
     
    <!-- Bootstrap core CSS -->
    <link rel="stylesheet" href="https://www.domain.co.uk/sites/cmsdemo/css/styles.css" type="text/css" />

    <!-- Custom styles for this template -->
    <link rel="stylesheet" href="https://www.domain.co.uk/sites/cmsdemo/css/heroic-features.php?v=<cms:show k_page_modification_date />" type="text/css" />

   <link href="css/bootstrap-4-hover-navbar.css" rel="stylesheet">

  </head>

  <body>

    <cms:embed 'menu.html' />

    <div class="container">

      <div class="row my-4">
          <div class="col-lg-4">
          <cms:show first_column_text/>
          </div>
          <div class="col-lg-4">
          <cms:show second_column_text/>
          </div>
          <div class="col-lg-4">
          <cms:show third_column_text/>
          </div>
      </div>
     
    </div>
    <!-- /.container -->

    <!-- Footer -->
    <footer class="py-5 bg-dark">
      <div class="container">
        <p class="m-0 text-center text-white">Copyright &copy; Your Website 2018</p>
        <br>
        <cms:embed 'socialmedia.html' />
      </div>
      <!-- /.container -->
    </footer>

    <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>

        <script src="js/bootstrap-4-hover-navbar.js"></script>

  </body>

</html>
<?php COUCH::invoke(); ?>
Thanks.

Code: Select all
<cms:template title='Copy Page' order='13'>

As can be seen from your code above, the template is non-clonable.
The 'copy' (and also the 'add') facility will work only with clonable templates (because, of course, then there would be pages to subject to these actions).

Please make the template clonable and you should be able to see the addon in action.
Ahh stupid me, I forgot about the clonable code, I added it in and see the add new button in top right and if go into the page edit itself I now see copy to new and the add new button in the top right

Thank you KK, 100% helpful and amazing support and replies as always
You are welcome :)
8 posts Page 1 of 1
cron