Jump to content

ngrmm

Members
  • Posts

    468
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by ngrmm

  1. @tires I can't help you with the htaccess But you could just use ProtectedMode https://processwire.com/modules/protected-mode/
  2. @kaz beware // hreflang="english" is not valid // it should be hreflang="en" <link rel="alternate" hreflang="en" href="https://domain.local:8890/en/services/" />
  3. this is how I did it // Output a default alternate link for search engines that don't support hreflang echo "<link rel='alternate' hreflang='x-default' href='$page->httpUrl' />"; // Loop through all available languages foreach($languages as $language) { if(!$page->viewable($language)) continue; $url = $page->localHttpUrl($language); $hreflang = $language->name; // Replace "default" with "de" (assumes "de" is the default language) $hreflang = ($hreflang == 'default') ? "de" : $hreflang; // Output the alternate link for the current language echo "<link rel='alternate' hreflang='$hreflang' href='$url' />"; }
  4. I'm not sure if this works via the field in the backend, but you could handle it with a hook. https://processwire.com/api/ref/form-builder-processor/email-form/
  5. I meant something else. You're using FormBuilder, which offers four different options (A, B, C, and D) to embed your form into a template or page. For example, if you use option D, you're implementing custom code, and the rendering is not handled by FormBuilder. In that case, the hook would have no effect.
  6. @bernhard that was it, thanks a lot!
  7. Page is moved after being unpublished via a hook. If you do on the page directly (settings tab) you have to click on the save button. This trigger a reload and everything is fine. But if you unpublish a page via the action button in the page tree view, there is no forced reload. Is there a way to force a refresh of the page tree via JS? $wire->addHookBefore('Pages::save', function($event) { $p = $event->arguments(0); if($p->template == 'funding_item') { // Disable output formatting $p->of(false); $newParent = wire('pages')->get(1234); $p->parent = $newParent; $p->save(); } }); UPDATE: I'm forcing it this way right now. But there should be a way to do it via AJAX as PW page tree is working on default. // config.php $config->scripts->add($config->urls->templates . "/scripts/_admin/pagetree_move.js"); // pagetree_move.js document.addEventListener("DOMContentLoaded", function() { const observer = new MutationObserver((mutationsList, observer) => { const unpublishButtons = document.querySelectorAll('.PageListTemplate_template_name a.PageListActionUnpublish'); unpublishButtons.forEach((btn) => { if (!btn.dataset.listenerAttached) { btn.dataset.listenerAttached = "true"; btn.addEventListener('click', function () { console.log('Unpublish clicked'); setTimeout(() => { location.reload(); }, 1000); }); } }); }); observer.observe(document.body, { childList: true, subtree: true, attributes: true }); });
  8. @kuba go to the Languages Support - Page Names module and scroll down to the section Behavior when page not available in requested language (but is available in default language)
  9. @Roope It seems that it does not work with Chinese characters inside an <a> tag. <a href="mailto:mail@website.com"><span>发送电子邮件</span></a> // error console page/:254 Uncaught URIError: URI malformed at decodeURIComponent (<anonymous>) at emo.decrypt (page/:254:558) at emo.replace (page/:254:382) at emo.init (page/:254:105)
  10. make sure, that the client or someone else does not overwrite the page with an empty one. You never know what clients do! Maybe he has a browser tab open (page with empty fields) from long time ago before you wrote the text and just clicked save. If this happens regularly, you could try to use version control for debug
  11. @Ana this is related to Frontend. Proceswire lets you decide how you want things to be on the frontend. So there is no ready to use solution for this. You could write you own JS, it's not much. Or scripts isotope, mixitup or take a look at htmx
  12. How do I restrict viewing custom admin pages. I followed this tutorial and added a new page. It's also visible in the header in the backend. This is my code and I also created the permission and added to a role. As superuser I'm able to view this custom admin page, but as non-superuser with the permission eventbrite-import you don't see it in the backend header menu <?php namespace ProcessWire; class EventBriteImport extends Process { public static function getModuleinfo() { return [ 'title' => 'Eventbrite', 'summary' => 'Triggers eventbrite import and display an overview', 'author' => 'me', 'version' => '0.1', 'permission' => 'eventbrite-import', 'page' => [ 'name' => 'eventbrite', 'title' => 'Eventbrite', ], ]; } …
  13. @thomas had the same error. AI told me to change this: updateAllowedElementOther(e) { const { dataset: t } = e; (e.type = t.type ?? "text/javascript".poster.forEach((s) => { void 0 !== t[s] && (e[s] = t[s]); })), this.removeUnusedAttributesFromElement(e); } to this updateAllowedElementOther(e) { const { dataset: t } = e; e.type = t.type ?? "text/javascript"; ["src", "async", "defer"].forEach((s) => { if (t[s] !== undefined) e[s] = t[s]; }); this.removeUnusedAttributesFromElement(e); } It's working now. But I'm sure it's not the correct way and @joshua knows how deal with this problem and will update the code!
  14. @taotoo just a guess, try these: template=category >> parent=/blog/posts, categories=parent.id or template=category >> parent=/blog/posts, categories=page.parent.id
  15. it's working for me with the code below Please check for typos. Is you page reference filed name really report? And is it a single or multiple page? $call = $pages->get(1234); $report = $pages->get(4321); $new_report = $pages->clone($report); $new_report->of(false); $new_id = uniqid(); $new_report->title = $new_id; $new_report->name = $new_id; $new_report->save(); $new_report->of(true); $call->of(false); $call->report = $new_report; // $call->report->add($new_report); $call->save(); $call->of(true);
  16. @Frank Vèssiaplease check if your page reference field is accepting the template of the new cloned page.
  17. @Bike what do you actually mean by dropdown field? Which type is it? a page reference field? Maybe your dropdownField is an array and not boolean or a string.
  18. You could use a hook to create those new fields and add them to certain templates.
  19. @robert it seems that this module does not work with the latest PW version Schwerwiegender Fehler: Uncaught TypeError: Cannot access offset of type string on string in site/modules/ProcessTranslatePage/ProcessTranslatePage.module.php:189 #0 site/modules/ProcessTranslatePage/ProcessTranslatePage.module.php(59): ProcessTranslatePage->setLanguages() #1 site/modules/ProcessTranslatePage/ProcessTranslatePage.module.php(41): ProcessTranslatePage->initSettings() #2 wire/core/ModulesLoader.php (168): ProcessTranslatePage->init() #3 wire/core/ModulesLoader.php (100): ModulesLoader->initModule() #4 wire/core/ModulesLoader.php (111): ModulesLoader->triggerInit() #5 wire/core/Modules.php (338): ModulesLoader->triggerInit() #6 wire/core/ProcessWire.php (775): Modules->triggerInit() #7 wire/core/Wire.php (413): ProcessWire->___init() #8 wire/core/WireHooks.php (968): Wire->_callMethod() #9 wire/core/Wire.php (484): WireHooks->runHooks() #10 wire/core/ProcessWire.php (909): Wire->__call() #11 wire/core/ProcessWire.php (665): ProcessWire->__call() #12 wire/core/ProcessWire.php (613): ProcessWire->setStatus() #13 wire/core/ProcessWire.php (315): ProcessWire->load() #14 index.php (52): ProcessWire->__construct() #15 {main} thrown (Zeile 189 in site/modules/ProcessTranslatePage/ProcessTranslatePage.module.php) Diese Fehlermeldung wurde angezeigt wegen: Sie sind als Superuser angemeldet. Fehler wurde protokolliert.
  20. @couturef i doubt that the module is up to date please check the support thread of the module here:
  21. @Charlie W your question ist not directly related to processwire. You would get or find an answer more quickly on stackoverflow. Or just ask chatgpt, claude, … acme/#sliding is correct. Just make sure that you do not have multiple elements with the same id. Then you link <a href='#siding>siding</a> should get you to your target <div id='siding'></div>
  22. @ryan is it also possible to disable a date range via setting like: $wire->addHookBefore('InputfieldDateRange::getSettings', function($e) { $f = $e->object; if($f->name != 'booking_date') return; // // set Christmas until New Years Day to be disabled // $f->disabledDates = [ '2024-12-25 - 2025-01-01' ]; }); UPDATE: right now I'm doing this // // helper function // function getDatesBetween($startDate, $endDate) { $dates = []; $currentDate = strtotime($startDate); $endDate = strtotime($endDate); while ($currentDate <= $endDate) { $dates[] = date("Y-m-d", $currentDate); $currentDate = strtotime("+1 day", $currentDate); } return $dates; } $wire->addHookBefore('InputfieldDateRange::getSettings', function($e) { $f = $e->object; if($f->name != 'booking_date') return; $disabledDates = getDatesBetween("2024-12-25", "2025-01-01"); // // set Christmas until New Years Day to be disabled // $f->disabledDates = $disabledDates; });
  23. @froot so related_tutor or related_movie, is a page field right? Is it a single or multiple page field? If multiple (by default), then you would need to select one from the array. like: …related_tutor->first->template->fields->skills->label and check this https://processwire.com/api/ref/field/get-label/
×
×
  • Create New...