Problems, need help? Have a tip or advice? Post it here.
6 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.
KK, this is a very old thread, but seems the bet place to add a question.

Similar situation to the above, but the new approach also had a different 'template title'. The old file had:
Code: Select all
<cms:template title='Links' clonable='1' icon='link-intact' order='5' >

and the new one has
Code: Select all
<cms:template title='New Links' clonable='1' icon='link-intact' order='5' >

After going through the process to change filenames, as in the thread above, everything works, but the admin panel, of course, still has the name 'New links' for the template.

What is the process to change a template title without breaking everything?
@daldred, changing the 'title' has none of the issues discussed in this thread.

Once the new template has replaced the old one, simply change the title (in <cms:template> tag) to whatever you like and visit the template as super-admin - that should make the change to show up in the admin panel.

Hope this helps.
6 posts Page 1 of 1

Who is online

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

Users browsing this forum: Google [Bot] and 10 guests