-
Posts
357 -
Joined
-
Last visited
Everything posted by Roych
-
Send mail to administrator if there is only 7 children?
Roych replied to Roych's topic in API & Templates
Im trashin pages every day automaticaly with: <?php $theDayBeforeYesterday = strtotime("-1 day"); // get our pages $reallyOldEvents = $pages->find("template=calendar-post, Start_date<=$theDayBeforeYesterday"); foreach($reallyOldEvents as $oldEvent){ $pages->trash($oldEvent); } ?> Maybe this helps here. I still get mail for every trashed item, no matter how many is there. Thank you -
Send mail to administrator if there is only 7 children?
Roych replied to Roych's topic in API & Templates
Thanks for the update π Just noticed it always gives number 1, Right now I have 12 events all together if I add some new ones with older date (just for testing) it deletes them but the message in mail still says "there are only 1 ...." -
Send mail to administrator if there is only 7 children?
Roych replied to Roych's topic in API & Templates
I used the first method not the message option, so not sure how to fix this, thank you. -
Send mail to administrator if there is only 7 children?
Roych replied to Roych's topic in API & Templates
Hi, nice, this one works and sends mails exactly what I need. But is it possible to only get one mail if the number of remaining events is 7or lower, not for every event that goes to trash? maybe something like if ($numberOfItems = 7) { Just thinking here, I tried it and it still sends mails for every event that was put in a trash. And {$numberOfItems} doesn't work in the sent mail, but don't really need it if the mail would come just once when the number is 7. Thank you R -
Hello, I'm working on a restaurant site that deletes (puts in a trash) one children every day (daily menu). And I would like to send mail to administrator (of choice) that he has to add new children when there is only 7 left. As a reminder so that he doesn't forget about adding some new ones. We always show seven daily menus on frontend and we don't want go below this as it would look weird. Everything works great so far, I only need help with the mail sending as I never worked on something like this. Can this be done somehow? (I have FormBuilder, but maybe some hook would be better for something like this.) Im using Templates Daily menu (template=calendar-list) - day 1 (template=calendar-post) - day 2 (template=calendar-post) - ..... Thank you R
-
page reference numbers in front of a title (admin area)?
Roych replied to Roych's topic in API & Templates
Nice, took the first one, so I can have full control. Works perfect. Didn't know about "custom label field option" Will help alot in the future. Thank you very much R -
page reference numbers in front of a title (admin area)?
Roych replied to Roych's topic in API & Templates
hi, well the pages can be sorted added and deleted but because alergens are usualy noted with numbers like #1 are always cereals and #5 are always Crustaceans. So when you add a new dish, it says it contains alergens 1,5,2,14, ... and would be easyer to see the number rather than count and read through all of them. So just static number for each would be ok I guess (I would add the right number to the right alergen). Or by sorting pages, so first is #1 and so on. Hope u understand π Thank you R -
Hello, I was wondering if it's possible to add numbers in front of a title in backend in page reference field: #1 title #2 title #3 title and so on. But only in admin. Would be great if automated when creating a new page. Thank you R
-
Not sure for trashing the events but would something like this work? I need to leave yesterday published but all older ones put in a trash. <?php $preyesterday = strtotime("-2 days"); $ptrashed = $pages->find("template=calendar-post, Start_date>=$preyesterday"); foreach($ptrashed as $ptrash) { if(time($preyesterday) > $ptrash->getUnformatted("Start_date")) { $pages->trash($ptrash); } } ?> or <?php $eventpages = wire("pages")->find("template=calendar-post, include=all"); foreach ($eventpages as $eventpage) { $enddate = $eventpage->Start_date; $currenttime = time("-2 days"); if ($enddate < $currenttime) { $pages->trash($eventpage); } } ?> Thank you R
-
Hello, I need some help with simple restaurant food menu, I'd like to show yesterdays menu and 6 future days (all together 7 days). My problem is that I'm not sure how to show -1 day with all future days. Another problem I have is that I don't need time in my datetime field ("Start_date") the menu should stay there entire day till midnight. But the day starts with 0:00:00 hrs and if I want the past event to go to trash, it goes in the morning not at midnight. (it puts todays event in the trash) Kind a lost here. it should show days like Wednesday (yesterday) | Thursday (today) | Friday | Saturday | Sunday | etc ... I show my "events" with <?php $events = $pages->find("template=calendar-post, Start_date>=today-1, sort=end, limit=7"); ?> <?php if(count($events)): ?> // my event code For dates I also tried with: <?php $today = date('d. m. Y'); $start = date('d. m. Y', $single->getUnformatted('Start_date') . " 00:00:00"); ?> And for trash I use: <?php $ptrashed = $pages->find("template=calendar-post"); foreach($ptrashed as $ptrash) { if(time() > $ptrash->getUnformatted("Start_date")) { $pages->trash($ptrash); } } ?> I'm not good with php so any help appreciated. Thank you very much for helping. R
-
Hello, I'm strugling to create the menu, and somehow can't make it to look the same as original. It somehow works, but no quite right. Not sure what is wrong here. Any help appreciated. I need: <ul class="navbar-nav ms-auto"> <li class="nav-item dropdown"> <span class="nav-link active" data-bs-toggle="dropdown" aria-expanded="false"> Home <i class="ti-angle-down"></i></span> <ul class="dropdown-menu last"> <li class="dropdown-item"><a href="index.html">Home Layout 01</a></li> <li class="dropdown-item"><a href="index2.html">Home Layout 02</a></li> <li class="dropdown-item"><a href="index3.html">Home Layout 03</a></li> <li class="dropdown-item active"><a href="index4.html">Home Layout 04</a></li> <li class="dropdown-item"><a href="index5.html">Home Layout 05</a></li> <li class="dropdown-item"><a href="index6.html">Home Layout 06</a></li> <li class="dropdown-item"><a href="index7.html">Home Layout 07</a></li> </ul> </li> </ul> My code: <?php function buildMenuFromObject($parent = 0, $menu, $first = 0) { if(!is_object($menu)) return; $out = ''; $has_child = false; foreach ($menu as $m) { $newtab = $m->newtab ? " target='_blank'" : ''; // if this menu item is a parent; create the sub-items/child-menu-items if ($m->parentID == $parent) {// if this menu item is a parent; create the inner-items/child-menu-items // if this is the first child if ($has_child === false) { $has_child = true;// This is a parent if ($first == 0){ $out .= "<ul class='navbar-nav ms-auto'>\n"; $first = 1; } else $out .= "\n<ul class='dropdown-menu last'>\n"; } $class = $m->isCurrent ? 'active' : ''; // a menu item $out .= '<li class="nav-item dropdown"><span class="nav-link ' . $class . '" data-bs-toggle="dropdown" aria-expanded="false"><a href="' . $m->url . '">'. $m->title .'</a>'; // if menu item has children if ($m->isParent) { $out .= '<i class="ti-angle-down"></i></span>'; } else $out .= '<li class="nav-item dropdown">' . '</a>'; // call function again to generate nested list for sub-menu items belonging to this menu item. $out .= buildMenuFromObject($m->id, $menu, $first); $out .= "</li>\n"; }// end if parent }// end foreach if ($has_child === true) $out .= "</ul>\n"; return $out; } ################################## $mb = $modules->get('MarkupMenuBuilder');// get Menu Builder $menu = 1031;// pass an ID $options = array('default_title'=> 1, 'default_class'=> 'dropdown-item', 'current_class_level' => 6); /* grab menu items as a WireArray with Menu objects */ $menuItems = $mb->getMenuItems($menu, 2, $options);// called with options and 2nd argument = 2 {return Menu (WireArray object)} ?> <?php // build menu from array (example 1b only) echo buildMenuFromObject(0, $menuItems); ?> Thank you very much R
-
Exactly what I neded it works great now thanks for helping π yes the url to the file is in js so not sure how to call it outside of the foreach for each link (if u know what I mean). With the changed ID (above) it is now working great. Not sure if it is the best way but, no problems so far. R
-
Hello, I'm having some problems with repeater and PDF PageFlip. I'm using THIS script. I have "Files" field (for single PDF) and "image" field (for first cover preview on a shelf) in repeater and all works great, if I add only one PDF to repeater. When I add another repeater item, second one doesn't work. Not sure what I'm doing wrong. It looks normal on a shelf but does not open a pageflip PDF animation. My code: <div class="bookshelf"> <div class="covers"> <?php foreach ($item->flipbook_repeater as $book) :?> <?php $link = $book->pdf_datoteka->first->url;?> <script type="text/javascript"> $(document).ready(function () { $("#container").flipBook({ pdfUrl:"<?=$link;?>", responsiveView: true, lightBox:true }); }) </script> <div id="container" class="thumb book-<?=$sanitizer->name($book->single_image->filename);?>"><img src="<?=$book->single_image->url;?>"></div> <?php endforeach ;?> </div> <img class="shelf-img" src="https://www.my-site.com/site/templates/assets/plugins/flipquery/deploy/images/shelf_wood.png"> </div> I hope you understand what I mean here. Thank you in adwance R
-
Group posts by day of the week? "Datetime" field (mon, tue, ...)
Roych replied to Roych's topic in API & Templates
lol, you are the best, thx again π -
Group posts by day of the week? "Datetime" field (mon, tue, ...)
Roych replied to Roych's topic in API & Templates
How did you know it is Slovene language, lol π R -
Group posts by day of the week? "Datetime" field (mon, tue, ...)
Roych replied to Roych's topic in API & Templates
OMG, thank you very much it works great π also the count numbers! π Exactly what I needed. I need to save this for further use .. Thank you very much for help π Much appreciated π R -
Group posts by day of the week? "Datetime" field (mon, tue, ...)
Roych replied to Roych's topic in API & Templates
I tried the above but not working as it should, the events are messed up again. How would I do this? Sorry and thank you for helping, but would really like this one to work. π -
Group posts by day of the week? "Datetime" field (mon, tue, ...)
Roych replied to Roych's topic in API & Templates
Yes, it's working great, only thing is that the days are now only in english. I have multilanguage site. Tried "strftime("%A", strtotime($event->Start_date))" but ofc. it's not working. The days are in the right language but events are messed up as before. Any ideas? Thank you R -
Group posts by day of the week? "Datetime" field (mon, tue, ...)
Roych replied to Roych's topic in API & Templates
hey, sorry for the formating, i did it so it doesn't look to much for the reader. "Start_date" is my datetime field that states the start of the event. $datetime was actualy some part of the code I found on the forum for showing the name of the day. I'm not a coder so maybe I'm completely wrong here. Not 100% sure what I'm doing... π That is why I need some help with this. π thank you R -
Group posts by day of the week? "Datetime" field (mon, tue, ...)
Roych replied to Roych's topic in API & Templates
Somehow got it grouped by day but not quite working yet. It shows events somehow mixed up not sure why. My code: any help appreciated thank you R -
Help - Suggestions on reusing a background image across a site.
Roych replied to Greg Lumley's topic in General Support
Hey, You could create settings page and make changes to all the pages at once. Something like admin settings. Read more here: https://processwire.com/talk/topic/17471-change-css-and-images-through-admin-custom-admin-page/?do=findComment&comment=153511 -
Hello, I'm having some problems grouping tabbed posts by day. So clikcking on expl. monday would show all posts starting on monday. I have datetime field "Date_start" added in "my calendar-post" template. It should look like this But now shows all the days so if I have 5 events starting on MONDAY it shows 5 MON in tabs. Like: Not sure how to group these by Start_date. My code now: And original html: Any help appreciated (I'm not a coder) ? Thank you R