Jump to content

Recently Updated Topics

Showing topics posted in for the last 7 days.

This stream auto-updates

  1. Today
  2. ProcessWire: processwire-master_3.0.229 (and earlier versions) TextformatterAccordion: TextformatterAccordion-master_1.1.1 used inside InputfieldCKEditor First issue (solved): When using the originally downloaded TextformatterAccordion (v.1.1.1), I experienced a message on top of the outputted page: Notice: Array to string conversion in E:\UniServerZ\www\processwire-master\site\assets\cache\FileCompiler\site\modules\TextformatterAccordion\TextformatterAccordion.module on line 59 The line 59 is: if(empty($$accordion[0])) array_shift($accordion); I recognized a doubled '$$' before the variable 'accordion[0]', which is an operator known as "variable of variable"; but in my system I've debugged it, and it isn't a "variable of variable", it's only an array item containing text. After I removed one of the '$' operators, the line 59 changed into: if(empty($accordion[0])) array_shift($accordion); then the 'Notice' (see above) disappears and Accordion is working well :-). Second issue (solved): When there are several paragraphs in front of the Accordion part, is happens (regulary), that the last - neutral - paragraph of them is seen as (first) Accordion-item and is formatted like: Untitled Item Lorem ipsum... After inserting an extra check at the beginning of the 'foreach'-loop (lines marked with "ESB") of ...\www\processwire-master\site\modules\TextformatterAccordion\TextformatterAccordion.module ... foreach($accordion as $k => $v) { $pos = strpos($v, "~~~\t"); if ($pos === false){ // no accordion items in this block // ESB continue; // ESB } // ESB $title = trim(substr($v, 0, $pos)); ... , also this part of Accordion is working well. I hope, my tips are helping other users of TextformatterAccordion.
  3. Hi @ngrmm Thank you so much. Your information and reference link helped to me. it is worked perfectly.
  4. iank

    Dynamic CSS

    The TailwindCSS JIT compiler scans the source code rather than the html output, so it's looking for full class names in your PHP code. Hence you could do something like this: <?php namespace Processwire; $bg = $page->bgSetting === "success" ? "bg-green-500" : "bg-red-500"; ?> <div class="mt-4 max-w-md <?= $bg ?>"> Lorem ipsum dolor sit amet consectetur adipisicing </div> Or you could simply fake safelisting the expected values, e.g. in a comment if you just have a few you want to make available in a template: <?php namespace Processwire; $bg = $page->bgSetting === "success" ? "green-500" : "red-500"; /** safelist values: bg-red-500 bg-green-500 bg-blue-500 */ ?> <div class="mt-4 max-w-md bg-<?= $bg ?>"> Lorem ipsum dolor sit amet consectetur adipisicing </div> As long as the full string of the class name is in the code, it will get compiled by TW (use spaces between if you're using this method though, as if you were adding classes directly). (Of course there's also Tailwind's safelist setting in the tailwind.config file: https://tailwindcss.com/docs/content-configuration#safelisting-classes) Ian.
  5. I got it working. It doesn't count by default, my bad.
  6. Sure! In your js: window.addEventListener("load", () => { const headers = new Headers({"X-Requested-With": "XMLHttpRequest"}); // needed for $config->ajax to work const links = document.querySelectorAll("a.ajax"); const main = document.querySelector("main"); for(let i = 0; i < links.length; i++) { links[i].addEventListener("click", async (e) => { e.preventDefault(); loadPage(e.currentTarget.href); }); } async function loadPage(url, options) { const page = await fetch(url, { headers }); main.innerHTML = await page.text(); } }); And in your php: <?php namespace ProcessWire; ?> <?php if(!$config->ajax): ?> <main pw-id="main" pw-append> <?php endif; ?> <article><!-- Your content --></article> <?php if(!$config->ajax): ?> </main> <?php endif; ?> <?php if($config->ajax) exit; When opening the page directly it will go the usual route, outputting your content within <main> but if requested with ajax then it will only send the content and exit() so no other file is appended (_main.php in my case).
  7. I will give it a try. In the mean time i found out, that there are some configuration options in configure -> modules -> AdminThemeUiKit Adding a global font-size there would be a great option.
  8. Why not simply adding a field with default text to the template, which you can overwrite on pages when needed. Then you just display the text of that field.
  9. It's working reliably on a few sites I've tested on but what you're saying makes sense. So you could add the button with PHP in a hook and not in the JS as demonstrated below. I also had a thought that Page Edit might be opened in a modal in some other circumstances (I think ListerPro has an option for this) where the "Save + Close" button wouldn't work or wouldn't be wanted. So I've updated the code in the first post and in the code below so that a "quick_edit" URL parameter is added for identification purposes. admin-custom.js $(document).ready(function() { const $body = $('body'); const is_modal = $body.hasClass('modal') || $body.hasClass('pw-iframe'); if($body.hasClass('ProcessPageList') && !is_modal) { $(document).on('ajaxComplete', function() { const $link = $('.PageListActionEdit a:not([data-autoclose])'); $link.attr('data-autoclose', '#save-and-close').attr('href', $link.attr('href') + '&quick_edit=1'); }); } }); Additional hook for /site/ready.php $wire->addHookAfter('ProcessPageEdit::buildForm', function(HookEvent $event) { /* @var InputfieldWrapper $form */ $form = $event->return; // Return if Page Edit is not in a modal window if(!$event->wire()->config->modal) return; // Return if quick_edit GET parameter is not present if(!$this->wire()->input->get('quick_edit')) return; $save_button = $form->getChildByName('submit_save'); if(!$save_button) return; /** @var InputfieldSubmit $f */ $f = $event->wire()->modules->get('InputfieldSubmit'); $f->id = 'save-and-close'; $f->name = 'submit_save'; $f->value = 'Save'; $f->text = 'Save + Close'; $f->addClass('uk-hidden', 'wrapClass'); $form->insertAfter($f, $save_button); });
  10. Yesterday
  11. Yes, that's correct; I have even removed all template code and replaced it with basic HTML, including the edit php and got the same result. Works on all pages apart from home or ID 1
  12. The four websites do the same thing, search for companies in a specific regions. The search function based on Ryan's skyscraper profile. I use multisite Option #1 because I wanted the four sites data could be modified with one login. I tried Option #2 with multisite module but the search function didn't work in child pages. Now what I want that switching the companies active or inactive by certain url or sites.
  13. Just to add another solution to the original question, this is how I hide not editable pages in admin tree: $this->addHookAfter('Page::listable', isPageListable(...)); function isPageListable(HookEvent $event): void { if ($event->page->path == "/") $event->return = true; else $event->return = wire()->user->hasPermission("page-edit", $event->page); }
  14. Symptoms: as title says, just a blank page, no content, but successful http response. Nothing logged in any of PW's log files, or in php's error log. Cleared caches, still same problem. Other pages using same template all work fine. Page loadable with pages(1234) but *not* loadable with pages('/path/name-of-page') - the latter gets null page object. Workaround: I changed the page's name, saved, then changed it back again, and it seems to work. Possible(?) confounding factors These news pages live under /news/ however I wanted the URLs to include the published date, like /news/2024-02-21/some-page It is being accessed via URL hook on /news/[0-9-]{10}/(title[^/]+) with $event->pages->get("/news/$event->title"); The page class overrides the `path()` function which contains `return '/news/' . date('Y-m-d', $this->published) . '/' . $this->name . '/';` This has worked fine for all the other pages. Any ideas what might have happened? What could cause pages() to fail to load by page path for this page? Possible asides: I'm not 100% on how to use different urls for pages, but what I have seems/ed to work; for example the template is configured not to use trailing slash, but I found I needed one returned by path(). pages('news/the-page') (without the date) loads the page. So I think path() is only used for rendering. It didn't look like the date-prefix is persisted in the db. EDIT: page_path table When it was broken, I did a mysqldump. And after it was fixed I repeated. I then used neovim to diff the dumps (mmm, fun). Here's what I found. I believe the key difference is in the pages_paths table, where the broken version had 'news/1970-01-01/the-page' and the working version had 'news/2024-02-21/the-page'. My hunch is that something populated the pages_paths table before the page was published, thereby getting the epoch date. So I need to understand the relationship between a class's path() function, and loading with pages($path).
  15. Last week
  16. Looking forward to it! And good luck 👊
  17. I think you’ll find that you can only use “or” when you are referencing the same field.
  18. Nevermind @mayks! I hope it works as expected, because I do not use Postmark and therefore I have only tested the base function (sending process). Please take care that only 1 external mail module is installed, otherwise you will run into problems, but this is not a module related issue, it is an PW issue. In this case PW takes always the first external module in line and ignores all others (independent of you settings inside this module config).
  19. Cross reference: https://github.com/processwire/processwire-issues/issues/1882
  20. Hi @Kiwi Chris. Can you please tell me how to make the @kixemodule to work? How to make the language hookable?
  21. @Stefanowitsch in the 'Input' tab of the field settings, there is a 'Custom settings JSON' area. You can put it in the 'JSON text' field, or if you need to reuse it, create a file on your server add the above to the file and point to it using the 'JSON file' option.
  22. Hi @bernhard, I discovered some more information which might help with troubleshooting. I came across this post which seemed to be related: https://processwire.com/talk/topic/29225-solved-show-this-field-only-if-doesnt-seem-to-work/. As mentioned in that post, if I use Alfred on the front end, or choose "Edit in new window" from the admin side, the changed information does indeed get saved. Only when editing the blocks in the admin in 'repeater mode' does the 'showIf' information not get saved. I hope that points you in the right direction (and for now I have a workaround!) Thx, Ian.
  1. Load more activity
  • Create New...