Jump to content

Roych

Members
  • Posts

    383
  • Joined

  • Last visited

Everything posted by Roych

  1. 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
  2. Nice, it works great. Now only the datetime and putting in the trash. Defining the $yesterday simple. Thank you very much ;)
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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. 😉
  9. 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
  10. 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
  11. 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
  12. 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
  13. 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
  14. Hello, where is this option, I somehow can't find it? Thank you. ? Forget it I found it, thx ?
  15. Oh, yes it's working now. That simple, I thought I'ts gonna take a lot more to fix this with a lot more trouble. ? Thank you very much, really appreciated ? R
  16. Sure: I also tried module refresh with no luck. ? R
  17. I didn't change any settings yet, cause I couldn't acces the user settings yet. But I tried on those users that work, and the date is saved as you described above. 2022-08-24 00:00:00
  18. Any idea how to fix this? Thank you ? R
  19. Hello I tried to change some of the user setings when suddenly ?. I'm getting weird error when clicking on some of the users. Some of them are working fine but on some I get this error. I have Login Scheduler installed! Not sure how to fix this .. My PHP is v7.4 ... Any help appreciated. R
  20. Hello, Not sure if I'm missing something, but the PASTE option stays there forever. Is it possible to clear this when pasted? It gets annoying to se it there when I pasted an item 3 weeks ago. ? Thank you R
  21. Hello, I've been having problems with implementing my menu in my template. Not sure how to continue here, it's not working as it should. First parent looks ok, but all submenus are not. Is this even possible with this approach? My HTML code looks like this: What I managed to do: Any help appreciated. R
  22. thank you for help, it was working half of the way, but then I decided to add a checkbox to define page as full screen so now I have full control over each article. Tank you very much R
  23. thank you for anwser I's not working as it should. I'll try to be more clear what I need. My tree menu looks like this: (messy I know) Articles (all below have "basic-page" template) - Page (should have sidebar with siblings) - Page (should have sidebar with siblings and children) -- Page (should have sidebar with siblings) -- Page (should have sidebar with siblings and children) --- Page (should have sidebar with siblings) --- Page (should have sidebar with siblings and children) ---- Page (should be full width) Page (should be full width) Page ( should be full width) Page ( should have sidebar with siblings or children) - Page (should be full width) So if there is page a page on it's own it should also be without sidebar. I hope you understand what I need. Thank you very much R
×
×
  • Create New...