Jump to content

jmclosas

Members
  • Posts

    10
  • Joined

  • Last visited

Everything posted by jmclosas

  1. 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
  2. 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; ?>
  3. Sorry, just solved it, I had two consecutive Ajax request, hence the duplicate entries.
  4. As a note, in the Tracy debugger it works but as soon as I make an ajax call there is a duplicate entry.
  5. 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
  6. 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 !!!
  7. Wow, great website ! Congratulations !!?
  8. 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...