Jump to content

Roych

Members
  • Posts

    352
  • Joined

  • Last visited

Posts posted by Roych

  1. 15 minutes ago, BitPoet said:

    Are these numbers to be static, i.e. does a page always have to have the same number in front? Can the pages in question be deleted or resorted, and what happens to the numbers then?

    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

  2. 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

  3. 2 hours ago, wbmnfktr said:
    // define yesterday
    $yesterday = strtotime("-1 day");
    // make $yesterday match the saved date format
    // in this case: dd.mm.yyyy
    $yesterdayForSelector = date('d.m.Y', $yesterday);
    // get our pages
    $events = $pages->find("template=template, limit=7, date>=$yesterdayForSelector");

    Nice, it works great. Now only the datetime and putting in the trash. Defining the $yesterday simple. 

    Thank you very much ;)

    • Like 1
  4. 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

  5. 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

  6. 1 hour ago, gebeer said:
    <?= $book->id ?>

    Exactly what I neded it works great now thanks for helping 😉

     

    21 minutes ago, Gideon So said:

    You add the JS script within the foreach loop.

    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

    • Like 1
  7. 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

  8. 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

     

  9. Somehow got it grouped by day but not quite working yet. It shows events somehow mixed up not sure why.

    My code:

    Spoiler

    <?php
    $events = $pages->find('template=calendar-post');
    $grouped = [];
    foreach ($events as $event) {
        $dayname = $datetime->date('%A', $event->Start_date);
        if (isset($grouped[$dayname])) {
            $grouped[$dayname][] = $event;
        } else {
            $grouped[$dayname] = [$event];
        }
    }
    ?>  

     

                 <div class="tabs movies">
                        <ul>
                        <!-- Events by day START -->
                        
                            <?php foreach ($grouped as $dayname => $eventsingle): ?>
                                <li>
                                    <a href="#<?= $dayname ?>"><?= $dayname ?></a>
                                </li>
                            <?php endforeach;?>
                            
                            <!-- Events by day END -->

                            <li class="date"><span>Wednesday, 8 March</span>
                            </li>
                        </ul>
                        <!-- Events by day END -->

                        
                        <?php foreach ($grouped as $dayname => $eventsingle): ?>
                        <div id="<?= $dayname ?>">
                        

                            <!-- EVENT START -->
                            
                            <?php foreach ($eventsingle as $p): ?>
                            
                            <div class="row movie-tabs">
                                <div class="col-md-2 col-sm-3">
                                    <a href="<?=$p->url?>"><img alt="Movie title" src="<?php echo $config->urls->templates?>assets/images/movie-6.jpg"></a>
                                </div>
                                <div class="col-md-10 col-sm-9">
                                    <span class="title">Action, Adventure, Fantasy</span>

                                    <h3 class="no-underline"><?=$p->title?></h3>

                                    <?=$sanitizer->truncate($p->body, 150);?>
                                    
                                    <p><a class="arrow-button" href="<?=$p->url?>">Beri več</a></p>
                                    <div class="row">
                                        <div class="col-md-8 col-sm-9">
                                            <hr class="space-10">
                                            <span class="viewing-times"><i class="material-icons">access_time</i> Viewing times</span> <span class="time past">14:45</span> <span class="time">18:30</span> <span class="time">20:30</span> <span class="time">24:45</span>
                                        </div>


                                        <div class="col-md-4 col-sm-3 running-time">
                                            <hr class="space-10">
                                            105 mins <span class="certificate">15</span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <?php endforeach ;?>
                            <!-- EVENT END --> 

                        </div>
                        <!-- Events by day END -->
                        <?php endforeach ;?>

                    </div>

    any help appreciated

    thank you

    R

  10. 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

    Events.thumb.jpg.2f831a75b5ca569285f3dddef65926cb.jpg

     

    But now shows all the days so if I have 5 events starting on MONDAY it shows 5 MON in tabs. Like:

    Events_wrong.thumb.jpg.ff3e1b471bd004788503cec37e7d7958.jpg

    Not sure how to group these by Start_date.

    My code now:

    Spoiler

                    <div class="tabs movies">
                        <ul>
                        <!-- Events by day START -->
                        
                            <?php foreach($pages->get(1029)->children() as $child) :?>
                                <li><a href="#<?=strftime("%A", strtotime($child->Start_date));?>"><?=strftime("%A", strtotime($child->Start_date));?></a></li>
                            <?php endforeach;?>
                            
                            <!-- Events by day END -->

                            <li class="date"><span>Wednesday, 8 March</span></li>
                        </ul>
                        <!-- Events by day END -->

                        
                        <?php $days = $pages->find('template=calendar-post, start=0'); ?>
                                                
                        <?php foreach($days as $dnevi): ?>
                        <div id="<?php echo strftime("%A", strtotime($dnevi->Start_date)); ?>">

                            <!-- EVENT START -->
                            
                            <?php $events = $pages->find('template=calendar-post, Start_date|End_date>=today, sort=Start_date, start=0, limit=15'); ?>
                            <?php foreach($events as $single): ?>
                            
                            <div class="row movie-tabs">
                                <div class="col-md-2 col-sm-3">
                                    <a href="<?=$single->url?>"><img alt="Movie title" src="<?php echo $config->urls->templates?>assets/images/movie-6.jpg"></a>
                                </div>


                                <div class="col-md-10 col-sm-9">
                                    <span class="title">Action, Adventure, Fantasy</span>

                                    <h3 class="no-underline"><?=$single->title?></h3>

                                    <?=$sanitizer->truncate($single->body, 150);?>
                                    
                                    <p><a class="arrow-button" href="<?=$single->url?>">Beri več</a></p>
                                    <div class="row">
                                        <div class="col-md-8 col-sm-9">
                                            <hr class="space-10">
                                            <span class="viewing-times"><i class="material-icons">access_time</i> Viewing times</span> <span class="time past">14:45</span> <span class="time">18:30</span>                                                        <span class="time">20:30</span> <span class="time">24:45</span>
                                        </div>
                                        <div class="col-md-4 col-sm-3 running-time">
                                            <hr class="space-10">
                                            105 mins <span class="certificate">15</span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <?php endforeach ;?>
                            <!-- EVENT END -->

                        </div>
    <?php endforeach ;?>

                    </div>

    And original html:

    Spoiler

                        <div class="tabs movies">
                            <ul>
                                <li><a href="#mon">Mon</a></li>
                                <li<a href="#tue">Tue</a></li>
                                <li><a href="#wed">Today</a></li>
                                <li><a href="#thu">Thu</a></li>
                                <li><a href="#fri">Fri</a></li>
                                <li><a href="#sat">Sat</a></li>
                                <li><a href="#sun">Sun</a></li>

                                <li class="date"><span>Wednesday, 8 March</span></li>
                            </ul>

                            

                            <div id="mon">
                                <div class="row movie-tabs">
                                    <div class="col-md-2 col-sm-3">
                                        <a href="single-movie.html"><img alt="Movie title" src="images/movie-6.jpg"></a>
                                    </div>


                                    <div class="col-md-10 col-sm-9">
                                        <span class="title">Action, Adventure, Fantasy</span>

                                        <h3 class="no-underline">End of an era</h3>
                                        <p>European mercenaries searching for black powder become embroiled in the defense of End of an era of China against a horde of monstrous creatures.</p>
                                        <p><a class="arrow-button" href="news-single.html">Full synopsis</a>
                                        </p>
                                        <div class="row">
                                            <div class="col-md-8 col-sm-9">
                                                <hr class="space-10">
                                                <span class="viewing-times"><i class="material-icons">access_time</i> Viewing times</span> <span class="time past">14:45</span> <span class="time">18:30</span> <span class="time">20:30</span> <span class="time">24:45</span>
                                            </div>
                                            <div class="col-md-4 col-sm-3 running-time">
                                                <hr class="space-10">
                                                105 mins <span class="certificate">15</span>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                            </div>


                            <div id="tue">
                                <div class="row movie-tabs">
                                    <div class="col-md-2 col-sm-3">
                                        <a href="single-movie.html"><img alt="Movie title" src="images/movie-7.jpg"></a>
                                    </div>


                                    <div class="col-md-10 col-sm-9">
                                        <span class="title">Drama</span>

                                        <h3 class="no-underline">As she sleeps</h3>


                                        <p>A chronicle of the childhood, adolescence and burgeoning adulthood of a young black man growing up in a rough neighborhood of Miami.</p>


                                        <p><a class="arrow-button" href="news-single.html">Full synopsis</a>
                                        </p>


                                        <div class="row">
                                            <div class="col-md-8 col-sm-9">
                                                <hr class="space-10">
                                                <span class="viewing-times"><i class="material-icons">access_time</i> Viewing times</span> <span class="time past">11:00</span> <span class="time past">14:30</span> <span class="time">20:00</span> <span class="time">21:15</span>
                                            </div>


                                            <div class="col-md-4 col-sm-3 running-time">
                                                <hr class="space-10">
                                                117 mins <span class="certificate">U</span>
                                            </div>
                                        </div>
                                    </div>
                                </div>

    etc .....
                        </div>

     

    Any help appreciated (I'm not a coder) ?

    Thank you

    R

  11. On 8/26/2022 at 11:15 AM, AndZyk said:

    @Roych

    You can clear the copy/paste memory in the select options, but yeah I think the memory could clear itself after for example loggin out.

    I think no one needs something forever in the memory. ?

    Hello, where is this option, I somehow can't find it? Thank you. ?

    Forget it I found it, thx ?

    • Like 2
  12. 6 minutes ago, flydev ?? said:

    Ok, then to fix the error, in `ProcessLoginHistory` date format setting, put :  Y-m-d H:i:s

    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

    • Like 1
  13. 4 minutes ago, flydev ?? said:

    @Roych How did you changed the settings ? By hands or using the date picker ?

     

    Anyway, you can check if a weird date got saved in the module tables in the database.

    Open your database tool like `PHPMyAdmin` and check the following two tables :

    • field_user_login_enabled_from
    • field_user_login_enabled_until

    The values should be something like :  2022-08-23 00:00:00

    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

  14. 20 minutes ago, zoeck said:

    Looks like your $login_date variable is wrong.

    Line 499 date_create($login_date) returns false (date_create: "Procedural style returns false on failure.")
    That's why you can't use format on $date_diff ? 

    Any idea how to fix this? Thank you ?

    R

×
×
  • Create New...