Jump to content

Migu

Members
  • Posts

    15
  • Joined

  • Last visited

About Migu

  • Birthday 09/26/1969

Profile Information

  • Gender
    Male
  • Location
    Switzerland
  • Interests
    Processwire, PHP, Javascript, Angular

Recent Profile Visitors

6,749 profile views

Migu's Achievements

Jr. Member

Jr. Member (3/6)

7

Reputation

  1. Hello, When I use setFieldContextArray on a Repeater field via the API, I get the following error when trying to open the Repeater field: Sizzle.error - JqueryCore.js:1:18925 Error: Syntax error, unrecognized expression: {"error":true,"message":"Field mediacljm1 is not saveable because it is in a specific context"} Does anyone know why this happens? Thanks! $fieldgroup->setFieldContextArray($field->id, [ 'position' => $data['position'], 'colsize' => $data['colsize'], 'typ' => $data['typ'], ]); $fieldgroup->saveContext();
  2. Hello, As soon as I try to add a RepeaterField inside another RepeaterField, I receive the warning message: "Undefined array key 'fields_id'" in ...\wire\core\WireSaveableItemsLookup.php:115. After refreshing the page, the message disappears. However, when I add a text field to a RepeaterField, I do not encounter this issue. Below, you can see the function I am using. Can anyone tell me what I am doing wrong? Thanks! Miguel protected function createRepeaterField($repeaterName, $repeaterFields, $repeaterLabel , $repeaterTags='') { // Create Field $f = new Field(); $f->type = wire('modules')->get("FieldtypeRepeater"); $f->name = $repeaterName; $f->label = $repeaterLabel; $f->tags = $repeaterTags; $f->save(); //Create fieldgroup $repeaterFg = new Fieldgroup(); $repeaterFg->name = "repeater_$repeaterName"; $repeaterFg->save(); // Erst speichern! //Add fields to fieldgroup foreach($repeaterFields as $field) { $repeaterFg->append(wire('fields')->get($field)); } $repeaterFg->save(); //Create template $repeaterT = new Template(); $repeaterT->name = "repeater_$repeaterName"; $repeaterT->fieldgroup = $repeaterFg; $repeaterT->save(); //Setup page for the repeater $repeaterPage = "for-field-{$f->id}"; $f->parent_id = wire('pages')->get("name=$repeaterPage")->id; $f->template_id = $repeaterT->id; //Now, add the fields directly to the repeater field foreach($repeaterFields as $field) { $repeaterFieldIds[] = wire('fields')->get($field)->id; } $f->repeaterFields = $repeaterFieldIds; $f->save(); return $f; }
  3. Thank you very much for your answer. I have understood it now, I had the template with grid and the template file is grid-template if I now use GridPage then it works. Thank you very much for your quick answer ?
  4. If I specify an alternate template file, the custom page class does not work, an exception appears "Method Page::getTest does not exist or is not callable in this context" what can I do? Thanks for your help.
  5. The child pages did not have a custom page class but now I have created one and it works. Thanks a lot for your help Regards from Switzerland
  6. Hello, I have Exception error in custom classes pages by foreach loop $child->overviewImages(4) but not when i call $page->getTest() it working Why ? Can someone help me ? Thank Regards User Error Exception: Method Page::overviewImages does not exist or is not callable in this context (in C:\dev\source\valtruffes\wire\core\Wire.php line 564) namespace ProcessWire; use RockMigrations\MagicPage; class OverviewPage extends Page { use MagicPage; public function init() { bd('init overview page'); } public function getTest() { echo "TEST"; } public function overviewImages($grid) { if ($grid == 12) { $image = $this->images->shuffle()->first()->size(1280, 400); } elseif ($grid == 6) { $image = $this->images->shuffle()->first()->size(640, 300); } else { $image = $this->images->shuffle()->first()->size(320, 200); } return $image->url; } } <?php $page->getTest() ?> <?php foreach($page->children() as $child):?> <div class="col-sm-4 wow fadeIn" data-wow-delay="0.2s"> <div class="icon-box-1 match-height mb30"> <?php if($child->images->eq(0) != null):?> <div class="box-images-<?=$child->id?>"> <img class="img-responsive" src="<?=$child->overviewImages(4)?>"> </div> <?php endif; ?> <div class="content-area"> <h3 class="title"><?=$child->title?></h3> <?php if($child->content != ''): ?> <div class="content"><?=substr($child->content, 0, 100)?>'...' <?php endif; ?> <p class="mt30"> <a href="<?=$child->url?>" class="btn btn-primary btn-theme page-scroll"><?=__('Plus d\'info')?></a> </p> </div> </div> </div> </div> <?php endforeach; ?>
  7. Sorry, just solved it, I had two consecutive Ajax request, hence the duplicate entries.
  8. As a note, in the Tracy debugger it works but as soon as I make an ajax call there is a duplicate entry.
  9. Hello, I have a problem when saving repeater. When I do the following I always have a duplicate entry. $notification = $user->notifications->getNew(); $notification->messageid = $arr_data['messageid']; $notification->notificationid = $arr_data['notificationid']; $notification->users = $arr_data['userid']; $notification->date = time(); $notification->save(); $user->notifications->add($notification); $user->save(); What am I doing wrong? Thanks for feedback
  10. Have just ugraded to the latest version with PHP 8.16! Went everything smoothly ! Thanks a lot Ryan and the other contributors ! PW is the best CMS !!!
  11. Wow, great website ! Congratulations !!?
  12. Thank you very much for the answers ! ?
  13. hello, I'm pretty new to processwire but what I've done so far is really great! What I do not quite understand yet, how can I make many to many relationships. Thanks for an answer.
×
×
  • Create New...