Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Hi! After learning about the new repeatable-Feature in couch 3, I changed the couch-integration completely in one of my sites. I did this in files named, for example, index_new.php.
I then entered the content in couch. Now I wanted to swap the old files with the new ones. This doesn't seem to work, even though the template-names are the same. Is there any way to work around this or will I have to enter all the data again?
Hi Tobi,

Difficult to say really as I don't exactly know what has changed between the two versions.
Would it be possible for you to attach or PM me both the versions of the template?
OK, now I get exactly what the problem is -
1. You have an existing template (say named 'index.php') with its own set of editable regions defined (and maybe a number of cloned pages).

2. You wish to try out structuring index.php using a new set of editable regions but since it is only a tentative decision now, you create a new template (say named 'index_new.php'), define a new set of editable regions for it (and maybe create clonable pages from the new template).

3. The new arrangement suits you. Now you want 'index_new.php' to become 'index.php' with the new set of editable regions with the new data (and maybe new set of cloned pages) now appearing as if they belong to 'index.php' and not 'index_new.php'.

If you simply rename 'index_new.php' to 'index.php' (as you are doing now), this is what is going to happen - Couch will think the old 'index.php' has changed and will show in admin panel that the older editable regions have been removed and new created (the new will not show any data as they are considered new). If you choose to permanently delete the older editable regions, all old data will be removed and the new regions will remain empty.
This is not what you want.

To make 'index_new.php' seamlessly become 'index.php' will require direct manipulation (albeit very minor) of the database itself.
Take a backup of the database first!
1.To begin with, rename 'index.php' template to 'index_old.php' and rename 'index_new.php' to 'index.php'.

2. Now access your database (using phpMyAdmin or any other DB manager that you have) and browse the 'couch_templates' table.
Each of the template that your site consists of will have a record for itself in this table.
We'll be interested only in the 'name' column. Find the record displaying 'index.php' in the 'name' column (this is our old 'index.php' which has now become 'index_old.php'). Change the value of the name from 'index.php' to 'index_old.php'.
Similarly find the record showing 'index_new.php'. Modify the name to make it 'index.php'.

And that should do it.
Refresh the admin-panel so that the left sidebar should now show the modified names of the templates.
Now when you access 'index.php' in admin or the frontend, you should see the new template with all the new data intact - effectively completely replacing the older template.

One last point - the older template (now known as 'index_old.php' to Couch) still remains (along with its data and possibly cloned pages).
To remove it completely from the system, follow the usual method. Delete the 'index_old.php' file. In the admin-panel when you access it Couch will sense that the template is gone and will prompt you to remove it (and its pages, if any) completely.

So, as you can see, it will take a bit of work to replace one template's data with another one. This technique can come in handy if there is too much data to be recreated.
If you have only a little data, it'd be better to simply rename the template and add all the data anew.

Hope this helps.
I've said it before and I'll say it again: best support ever. Thanks so much. You got and solved the problem even though I wasn't even able to describe it properly. Plus couch is just a fantastic product.
4 posts Page 1 of 1

Who is online

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

Users browsing this forum: No registered users and 3 guests