Jump to content

Autofahrn

Members
  • Posts

    328
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by Autofahrn

  1. Even if you delete that variation, as long as you are using the image field, this thumbnail image will be recreated each time you open the page in admin. What's the exact issue with having this thumbnail? If you do not want to see it within a frontend image gallery, just skip it.
  2. You may rename the Save and Publish buttons... ? The first "save" only creates the page in page tree and assigns the template to it. You can not actually enter any content upon page creation, so keeping the page unpublished seems very reasonable to me. Maybe the Save button could be named "Create" to better reflect what happens. At this moment the page really should not be published automatically, since it may contain required fields, where your template code rely on. With the template assigned, you'll have fields to enter content and see the Publish button. After entering the data you press "Publish", which effectively is "Save+Publish" in this case. I don't see an extra step to publish a page after entering its content, since this already is the default. Only in case the selected template does not have additional fields you'll see additional Save+Publish buttons. Are we talking about this situation?
  3. 'pages' and 'links' sound plural to me. If that's the case, you still use Page field ('Page Reference' in UI) but iterate over it. May look like this: foreach($page->page_field_name as $link) echo "<a href='{$link->url}'>{$link->title}</a>";
  4. Welcome to the Forum @spiroue. Only one point to start: If you want to process the phone number from the URL, think about URL Segments. Then you only have a single real page named phone-number which processes the following part of the URL ('12345678' in your example). With that number you may do anything like searching for that number somewhere else. That enables you to simply have a table of phone numbers per store, no need to have one page per number.
  5. Are we talking about dynamically updating the menu on client side (AJAX driven site) or producing different output from your template? In the template code you simply do not output the a tags for the "current" item to make an entry not clickable. Something like: foreach($languages as $lang) { if($user->language == $lang) echo "<li class='ActiveClass'>{$lang->title}</li>"; else echo "<li><a href='...'>{$lang->title}</a></li>"; }
  6. is there a 'not' missing? You still may use a repeater for your purpose, there is no need to output repeater's content in consecutive blocks. Never tried it, but a repeater effectively is a WireArray and should provide the method getIterator(). So in your output code you may fetch the first element whereever you like to place it, fetch the second later etc. If the content of the separators repeat over pages, you may also use a completely different approach and manage those separators as individual pages (with an own template) in some hidden section of your pagetree. On your "content" template you simply place a field of FieldtypePage (named Page Reference) and point to the separator to use. You still need two such fields, one for the header and one for the footer. Downside is, that the separators are managed separately. There are so many options, but I'd still prefer RepeaterMatrix for such purposes. And when I say "for such purposes" I don't mean to only define the separators with a RepeaterMatrix but the complete page layout (including text content, images, rows of blocks etc.. That way you are able to control layout, section order etc. from the GUI and do not need to modify PHP code for each change.
  7. Interesting, when I looked before, there were none. Now some are broken: Maybe something happens right now behind the scenes... ?
  8. You can not determine in .htaccess if a user is logged in. If you want to redirect "anonymous" users to somewhere else, then I'd place that into _init.php. Something like: if(!$user->isLoggedin()) $session->redirect('PlaceUrlHere');
  9. Am I the first to notice that some screenshots in the shop are gone? https://processwire.com/store/pro-fields/repeater-matrix/
  10. Guess this is the result from the lazyload which simply copies the data-srcset into srcset. Did you check the page source (as received from server) or DOM tree in inspector?
  11. Just wrote the same... ? Sadly the ProFields description currently miss screenshots, so its probably little difficult to get an idea about how RepeaterMatrix works. https://processwire.com/store/pro-fields/repeater-matrix/ With the RepeaterMatrix you basically define a sequence of elements producing content for your page. Each element has one or more field(s) containing stuff like images, text or whatsoever. Items may also have a "depth", which could map to div containers, for example. Here are two screenshots how this may look in the backend: : The second one generates this page: https://www.team-tofahrn.de/en/projects/organ-story/
  12. Fields can only be used once per page, this is mainly by design. But your template may have multiple fields from the same fieldtype (like image1 and image2). If you need multiple instance of the same field(s), you may use a repeater (or Table, Multiplier or RepeaterMatrix from the ProFields).
  13. So what is $page actually? Is it a category or subcategory (which does not have children)? As I pointed out, the or operator only must be specified when on a category. You may need to code like this: $pageSelect = "$page"; // page ID as a string if($page->hasChildren()) $pageSelect .= "|{$page->children}"; $selector = "template=product, limit=10, categories=$pageSelect, sort=$sort_results"; So $pageSelect would either look like "1234", if $page refers to a subcategory or "1456|1701|1702|1703" if its a category.
  14. Shouldn't this work with: $selector = "template=product, limit=10, categories={$page}|{$page->children}, sort=$sort_results"; Given that $page is either a category or subcategory then $page->children is either the list of subcategory pages or empty. Maybe the or operator must only exist when children exist (not tested).
  15. I wouldn't even think about such an invitation for performing dangerous things through a regular get request like invoking "any" templatefile. If you wish to generate different output depending on a get parameter you are of course free to do so (there is $input->get() to easily retrieve get parameters). Just call a function or execute another conditional block in your template.
  16. I've finally managed to to remove my 1.5 decades old, all-ugly, frame-based photography site to something more modern. So what looked like this for a much too long time: now present the images much better, has a consistent layout and finally is responsive: The intention of the site is to provide some inspiration for the ambitious photographer and also provides a tips section focusing on some aspects of digital photography. After being idle for too long, I feel new motivation for adding even more tips as time allows. We'll see. https://www.tofahrn-foto.de/en/ Layout is basically pure UiKit and all content (including menu and footer) is managed using my RepeaterFlex as a kind of real world test. The RepeaterFlex is inspired by the commercial RepeaterMatrix fieldtype but uses plugins to define item templates (in case you're interested, there is a small Demo Site for RepeaterFlex including some documentation). The site uses lazy load of images (lazysizes.js) and page transistions (barba.js V1) to obtain a hopefully smooth experience. There also is ProCache running to deliver minimized css and markup. Enjoy.
  17. What about: if($image->width > 9000) $image->size(9000, 0, $defaultOptions); I'd anyway prefer something generic like (You'll probably want to account for landscape and portrait as well): $imgWidth = $image->width; while($imgWidth > 400) // Larger than minimum? { $imgWidth /= 2; // half size (or whatever factor) $image->size($imgWidth, 0, $defaultOptions); } Not sure about the ImageMagick quality setting, but "max" quality of a JPEG normally relates to its (I'll name it) "cluster" size. The higher the quality setting, the smaller the cluster is. This has nothing to do with "keep quality from original", which may be encoded with a lower quality setting, which seems to be the case in your example.
  18. Indeed, sounds complicated. But since you can do anything using the PW API, I don't see a reason why this shouldn't work with a custom solution. But there probably is no module which could be used out-of-the-box.
  19. You'll need a hook, something like this: maybe along with:
  20. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language That field is about the language "the client is able to understand, and which locale variant is preferred". It has nothing to to with the reqion. At least the code should not redetect depending on a decision which does not depend on the redirection. So code is probably something like: if preferredLanguage is not sessionLanguage and installedLanguages(preferredLanguage) exists then redirectSession(preferredLanguage)
  21. I guess you may keep the srcset creation in your function as is with very few changes. Add some output variable at the head of your function, something like this: function responsive_picture($acf_image_array, $media_condition, $type) { $out = ''; Replace each print with $out .= like this: $out .= '<img class="lazyload" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" '; // leave space between attributes $out .= 'data-src="' . esc_html($acf_image_array['sizes'][320]) . '" '; // default image size leave space between attributes Alternatively you can simply define a fallback src via the data-src attribute. $out .= 'alt="' . esc_html($acf_image_array['alt']) . '" '; // leave space between attributes $out .= 'sizes="' . esc_html($media_condition) . '" '; // leave space between attributes $out .= 'data-srcset="' . esc_html($srcset) . '">'; // close img tag here $out .= '</picture>'; End your function with return $out; } What you need to do is either creating the $acf_image_array from the PW image before calling the function (keep its API), or change the function to parse the media conditions and create matching variants as required (given a single image). Either way you'll do something like $imgVariant = $img->size($variantWidth, $variantHeight) for each required size.
  22. Sorry, no idea. Never saw an error like that.
  23. You mean something like this? $content = $page->images; if (count($page->images)) { // the page has one or more images foreach ($page->images as $image => $value) { $content .= $value; $content .= "picture markup to follow.."; } }
  24. I remember falling into the same trap. I didn't modify the generated config.php but simply moved the contents from the unzipped subdirectory one up before I submit the database information.
  25. And the winner is IE11 (if larger numbers would count): True Boolean: Yes: 5000933 No: 4999067 in 4538.500146602597ms Logical: Yes: 10001746 No: 9998254 in 3660.800002048595ms Comparison: Yes: 14998940 No: 15001060 in 3914.8997532723097ms Unrolled: Yes: 19998348 No: 20001652 in 4056.1001404568105ms Floor: Yes: 24999035 No: 25000965 in 5620.100176307227ms should reset Yes&No counts somewhere, right?
×
×
  • Create New...