Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/29/2022 in all areas

  1. @rick messaged me asking for advice about how to use dependent selects in a module config. That is, where the options of one select change depending on what is selected in a another select. I thought others might also find this info useful so I've put together a demonstration module: https://github.com/Toutouwai/DemoDependentSelects The general idea is that the dependent (target) select needs to include all the possible options, and then the options are hidden or shown by JavaScript depending on what is selected in the source select. See the source code for comments.
    11 points
  2. Wow! Thank you! I was hoping for a suggestion where to look, not a complete working example. That is the cool thing about you, @Robin S, you are always above and beyond anyone's request for assistance. Much respect!
    4 points
  3. $sanitizer->pageNameTranslate($page->getUnformatted('title'))
    2 points
  4. It's all hand coded ? The approach is something like this: Start an IntersectionObserver to determine when the image is in the viewport (or close to it) When it's in the viewport I start a requestAnimationFrame loop, turn it off when the IntersecionObserver detects the image left the screen On each tick of the rAF I calculate a new position (get the position relative to the viewport as a %, multiply that by a certain value and assign it to CSS transform: translateY) And as I use StencilJS, I create this behaviour as a web-component, in the end I just have to wrap the image in a <c-image-parallax> block and that's it.
    2 points
  5. Yes, that's possible. Create an autoload module and in the init method set the config options so that it uses different css files for different roles: https://github.com/baumrock/AdminStyleRock/blob/main/AdminStyleRock.module.php#L32-L47 $role = "get users role id"; $style = "/path/to/your/style-$role.less"; $compiled = "/path/to/your/style-$role.css"; PS: Just realized that you might not be able to access the user role in init() so maybe you need to use ready() instead. Hopefully that's not too late in the process but I think it should work.
    1 point
  6. Hi @erikvanberkum It should return current langauge values without any additions to the code, so make sure that you made translations in field configuration.
    1 point
  7. Like @bernhard said, a repeater works well for this. The output in the template could look like this: <ul> <?php foreach($page->repeater_faq as $faq):?> <li> <h2><?=$faq->question?></h2> <p><?=$faq->answer?></p> </li> <?php endforeach;?> </ul> If you want to optimize the FAQ page for Google SEO you could additionally add the content in JSON format (not visible on the page). More Info: https://developers.google.com/search/docs/advanced/structured-data/faqpage This is what I usually use: <script type="application/ld+json"> { "@context": "https://schema.org", "@type": "FAQPage", "mainEntity": [ <?php $items = $page->repeater_faq; $item_count = count($items); foreach($items as $key => $value):?> { "@type": "Question", "name": <?=json_encode($value->question)?>, "acceptedAnswer": { "@type": "Answer", "text": <?=json_encode($value->answer)?> } }<?php if ($key === $item_count - 1){echo "\n";} else {echo ",\n";} ?> <?php endforeach;?> ] } </script>
    1 point
  8. This week's commits are primarily focused on resolving reported issues (via GitHub issue reports). While that doesn't make for exciting reading here, it's an important part of working towards our next master version. Though I am working on various other projects including client websites running in ProcessWire, ongoing updates to Pro modules and development of other ProcessWire modules. One module I've been working on this week (and last week) enables you to export translations for multi-language fields into JSON or CSV files. These files can be read into other translation systems, edited, and then imported back into ProcessWire. So if you need all the content for a site translated from one language into another, it provides a very convenient means of doing so. More details on that one soon. That's all for today but stay tuned and thanks for reading. Have a great weekend.
    1 point
  9. Are you using namespaces? If so then it would need to be (\Exception $e)
    1 point
×
×
  • Create New...