Jump to content

Recommended Posts

Posted
Hello, I have problems with repeaters. I tried to delete or modify an item from a repeater. But when the page reloads, it appears again. I was also trying to add a new article having the same result. 

Can anyone help me? 

Please 

Posted

Hi Rodwyn,

Welcome to PW forum :) Hopefully the example below help you out:

Deleting
$page->of(false);
$itemToRemove = $page->Body_Repeater->eq(0);
$page->Body_Repeater->remove($itemToRemove);
$page->save();
Editing
$itemToEdit = $page->Body_Repeater->eq(0);
$itemToEdit->of(false);
$itemToEdit->body = "My new content";
$itemToEdit->save();

Things you need to remember with Repeater is that Repeater Item is an actual page in processwire but being hidden in the tree and obviously Repeater field is an array of pages (wirearray). For documentation please refer to this page: https://processwire.com/api/arrays/

Hope this helps :)

  • Like 4
Posted
Thanks peterfoeng.
 
Maybe my problem is in the CMS. 
 
Attached a couple of pictures that illustrate my problem. 
 
borrar_1.png
 
 
borrar_2.png
 
I have a repeater called 'Persona', contains two photographs and two text fields. 
I try to delete the item Persona # 98, I click the trash button and then click the Save button. 
When charge the page, this appears again 
 
What I can do?
Posted

What version of PW are you running. There was another recent post about deletion of repeaters via the admin and it turned out to be a very old PW version?

Posted

Hi Adrian
 

I'm using version 2.3.0 
Do you think that's the problem?

Exactly Horst.

Do you think that's the problem?

  • Like 1
Posted

OK Thanks Adrian.

Now the questions are:

How can I upgrade PW?

If I upgrade PW, Can I lose my data?

I appreciate the time you took to help me

Posted
Hi kongondo.
Hi adrian.
 
I've read these links, 
I'll update but first PW 
I want to make a backup of the database. 
Does anyone know how I can access the management system databases?
Posted

Does it show this every time or only once or only sometimes?

"2006 MySQL Server has gone away" can have different reasons. As it states there, it is a "General Error", not a specific. One reason can be that the MySQL server is very busy (shared host?) and you run into a timeout.

Another reason could be that a previously used connection was lost and it couldn't be re-established. This was the behave with the PDO-class in the past, but this was fixed in early march this year. Which PW version have you installed now? If you use 2.4.0 (stable) you have this bug. Then you should go to the dev-branch and get the WireDatabasePDO.php file and copy this over your existing file from 2.4.0: wire/core/WireDatabasePDO.php

If you have installed the latest dev branch allready, it has another reason. :(

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...