Jump to content

OpenBayou

Members
  • Posts

    85
  • Joined

  • Last visited

Everything posted by OpenBayou

  1. <picture:nth-child(n+6)> <source srcset="<?php echo $child->post_image->first()->size(100,0,['quality' => 80])->url;?>" media="(max-width: 599px)"> <source srcset="<?php echo $child->post_image->first()->size(200,0,['quality' => 80])->url;?>" media="(max-width: 767px)"> <source srcset="<?php echo $child->post_image->first()->size(400,0,['quality' => 80])->url;?>"> <!-- fallback --> <img srcset="<?php echo $child->post_image->first()->size(400,0,['quality' => 80])->url;?>"> </picture> Don't really have anything so this is what I've done so far.
  2. @diogo Can you please provide an example? This is new to me.
  3. Well, this isn't working so I'm starting to work on plan B. I know that php files can't be loaded but can templates be loaded based on screen size?
  4. Is it possible to do :nth-child(n+6) on a picture element? Or do I have to do CSS? <picture> <source srcset="url to img" media="(max-width: 599px)"> <source srcset="url to img" media="(max-width: 767px)"> <source srcset="url to img"> <!-- fallback --> <img srcset="url to img"> </picture>
  5. Opps! Needed to have the #load before the javascript. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <div id="load"></div> <script language=javascript> if (screen.width >= 720 ) $('#load').load("load.php"); </script> The above would load the file load.php, even if the screen is less than 720. The below code fixes the problem: <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <div id="load"></div> <script language=javascript> (function () { var viewportWidth = $(window).width(); if (viewportWidth > 1400) { $('#load').load('load.php'); } else { $('#load').load('load2.php'); } }()); </script>
  6. What about load a php file based on screen size? I'm trying this but it doesn't work. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script language=javascript> if (screen.width >= 720 ) $('#load').load("load.php"); </script> <div id="load"></div> The 'load.php' is in the same folder as the code.
  7. What's the best way to do a responsive foreach on the index? I want to limit number of posts based on the screen width. Any suggestions?
  8. FIXED IT! Changed echo "<li>$key"; to echo $pages->get($key)->title; And it displays the title of the show. Thanks everyone for helping and understanding me. This is the final question as the project I've been working on is now complete. I'll post what I did sometime next month. Thanks again!
  9. Well, no matter what I do, everything is in integers. Back to the drawing board. Thanks for the help and understanding.
  10. 'podcast_shows' is a field that uses the page option that's set to Single Page or boolean false. It gets childpages from 'Podcast'
  11. Ok, I have TracyDebugger on, have no idea what I'm looking at. Did a var dump on $key and all I got was int(1155). When do '$p->podcast_shows->title' I get internal errors. I'm sorry if I'm not making any sense. I'm not used to ProcessWire, I'm used to WordPress and I though it would be great idea to diversify my portfolio using different CMSs. I had a deadline on this last Friday and I'm working on little sleep and I can't think properly. And I never done something this complex like grouping posts and I'm not a good programmer, all I do is search for my problem and see if someone has the same the same problem and hope there's a solution. If there is, I try my best to get it working that satisfies what I need to accomplish.
  12. Don't know where to go next. Still need help. Tried '$p->podcast_shows->title' that didn't work. Tried '$pages->find("has_parent=/promos/")->title' and that didn't work as well.
  13. https://processwire.com/talk/topic/2047-group-by/#comment-19162 Got it somewhat working. <?php $pa = $pages->find("has_parent=/promos/"); $groups = array(); foreach($pa as $p) $groups["$p->podcast_shows"][] = $p->id;?> <?php echo "<ul>"; foreach($groups as $key => $gr){ $count = count($gr); echo "<li>$key"; if($count){ echo "<ul>"; foreach($gr as $key => $pid){ $r = $pages->get($pid); echo "<a href='$r->url'>$r->title</a>"; } echo "</ul>"; } echo "</li>"; } echo "</ul>";?> The problem is this line echo "<li>$key"; It shows the page ID and I need to show the title. I tried '$key->title' and that didn't work.
  14. Is it possible to group pages by a field? For example: show all pages in a group that were written by a date. Like the following: Today - page A - page B Yesterday - page C - page D Thanks again for the help.
  15. Solved it. Went the simpler route and created a hidden page and used the field to select those pages. Thanks for the help. One problem: the page is called 'podcast' and a field called 'podcast_shows' that lists pages from the 'podcast' page. How do I show the selected title from the field? '<?php echo $page->podcast_shows?>' shows the page ID. '<?php echo $page->podcast_shows->title?>' shows nothing.
  16. Have no idea what ready.php is. All I've done was change the field to page, did 'custom PHP code to find selectable pages'. <?php $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->name == 'podcast_shows_child') { $page = $event->arguments('page'); $event->return = $page->children->podcast_show; } });?>
  17. I got it to show up on the back-end editor but it doesn't show the title. The field above is called 'podcast_shows_child' and this is on a child page. The above field is on the parent page that's a repeater called 'podcast show' and the two fields are an image and a text field. The image field is called 'podcast_show_image' and the text field is called 'podcast_show_name' Thanks for the help. I tried doing it myself but I've been working on this site for four days and I'm not thinking properly. P.S. This is the tree
  18. Forgot to mention because I was sleep-deprived when I wrote the question, this is on the back-end on the Admin.
  19. One more item: How do you do 'foreach'? <?php $deals_item = $pages->get("deals_show_on_endorse=$page->id");?> <?php foreach($deals_item as $deal_item) : ?> <?php echo $deals_item->title;?> <?php endforeach; ?> The above code just shows the title of endorsement page.
  20. I have a page called 'Podcasts ADs' with a field called 'podcast_show' that a repeater with a text field and an image uploader. Is there a way for the child pages in 'Podcasts ADs' to select data from those fields in the parent in the admin panel in the back-end? Example: If I enter in a show name called 'Show' in the text, I can select 'Show' in the child pages. Thanks.
  21. Thanks for the help but it didn't work. Didn't show anything. Now I've gotten some sleep, I will try again (with visuals) in case my previous question was confusing. I have three pages: recommendations, deals and endorsements. I'm looking for a way to show a page from deals on endorsements only when selected. In this example, show the '25% off until the end of the month' under deals on wpengine on endorsements. The field is called 'deals_show_on_endorse' Thanks for the help and I hope this clears up any confusions.
  22. This is probably a complex question so forgive me if this question doesn't sound great. I have three pages called deals,endorsements and recommendations. I have a field called 'show_on_endorsements' that searches for child pages on endorsements. How do I show fields like title, etc from deals on endorsements only when 'show_on_endorsements' is selected? Example: Home - Deals - - sub-page 1 - - sub-page 2 - Endorsements - - sub-page 1 - Recommendations - - sub-page 1 - - sub-page 2 If I create a page under Deals, I want that page to be shown on Endorsements/Sub-page 1 but only if 'show_on_endorsements' has selected that page. Thanks and I hope I made sense.
×
×
  • Create New...