Jump to content

thomas

Members
  • Posts

    196
  • Joined

  • Last visited

  • Days Won

    1

thomas last won the day on August 23 2012

thomas had the most liked content!

Profile Information

  • Gender
    Male
  • Location
    Köln, Germany

Recent Profile Visitors

7,468 profile views

thomas's Achievements

Sr. Member

Sr. Member (5/6)

49

Reputation

1

Community Answers

  1. Hi everyone, I have a site which uses a bunch of images per page and now I am about to change the template. Problem is that the first call of those pages takes forever since it creates all image variants. Is there a method to iterate over all those pages and create the images or would I have to create a hook for that? Problem is that the actual size of those images is calculated individually in the template so I would either have to duplicate the logic in this hook or parse the templates which I wouldn't know how ... Anyone got an idea? Thanks!
  2. Hi, I want to regex-replace terms with are stored in a simple text filed within a TinyMCE textarea value. Now I found that TinyMCE seems to encode entities differently than $sanitizer->entities() does. German "Umlaute" öäüÜÖÄ are encoded, but $sanitizer encodes quotes while TinyMCE doesn't. Is there a way to match the two encodings for reliable regex-replaces? Thanks $text = preg_replace("/(^|\s|>)".wire("sanitizer")->entities($member->title)."(\s|,|\.)/",'${1}<a href="'.$member->url.'">'.$member->title.'</a>${2}',$text); ^^ This successfully replaces names with umlauts like "Günter" but fails on people with nicknames like Jake "The Snake" 😉
  3. Hi @BrendonKoz, thanks for reply! I tried exactly the same syntax but unfortunately that didn't work. I am working on a full text searchable archive of old special interest magazines where I just need an image per page, a large text field for the OCR'd text and maybe some tags. Meanwhile I stumbled upon the amazing plugin "RepeaterImages" by @Robin S which looks like it might just solve my problem 🙂
  4. Hi, I was wondering if it was possible to search in the custom field of multiple images? I am not really sure what I would expect for a result but I guess I am looking for a way to search for images by the description in a custom text field (it needs to hold a lot of text) and deep link to that very image. A quick test showed no result but maybe I am missing something? (I know a page reference would obviously be the better choice here but I kinda want/need the thumbnail display and visual sortability of the multiple image field) Thanks
  5. Thanks! I changed it to this and added the Javascript src to my package. Works fine but isn't really the proper way to use a ProcessWire Module I suppose. Let's hope @joshua fixes this 🙂 updateAllowedElementOther(el) { const { dataset } = el; el.type = dataset.type ?? "text/javascript"; ["src", "srcset", "srcdoc", "poster"].forEach((k) => { if (dataset[k] !== undefined) { el[k] = dataset[k]; } }); this.removeUnusedAttributesFromElement(el); }
  6. Hi @joshua, I am getting the following error while trying to implement cookie consent for a Youtube iFrame: Uncaught TypeError: "text/javascript".poster is undefined What am I doing wrong? I tried both Ryan's TextFormatterVideoEmbed and manually adding all the attributes. All works fine but the src of the iframe is never resolved which I guess is due to the error above. Any help is appreciated thanks Edit: I am pretty sure this is caused by an error/missing semicolon in the PrivacyWire JS. Not sure how this works for anyone??
  7. Hello, please excuse if this has been discussed before. I was wondering if I can sort a pages array by the admin sort order of items in a pages field? Explanation: I have several pages which all have one category attached to it (in a single item pages field). These categories are sorted in a specific way in the backend. I would now like to sort the pages so the ones from the first category show up first etc. I would really like to avoid splitting things up and iterating over categories as well. Second option might be to add 1, 2, 3 or something to the category names and later strip it for display but I was wondering if there is a more ProcessWire-y way of doing this 🙂 This is what didn't work: $pages->find("template=members,sort=kategorie.sort,sort=title); * EDIT * It does work! Sorry! (Ican't find an option to delete this post ...) Thanks thomas
  8. Hi, I'm fighting with a weird problem here. I'm trying to build a mass mailer app with personalized HTML emails. The workflow is as follows: foreach($recipients as $to) { $this->wire->set('recipient_email', $to->email); $htmlBody = $nl->render(); $key = $sanitizer->pageName($to->email.$nl->id.time()); $cache->get($key); $cache->save($htmlBody); $sendArray[] = ['to'=>$to->email,'cache_key'=>$key]; } So the personalized HTML is written into a MarkupCache and the key written to an array. In the next step I send the cached HTML to each of the recipients. The Newsletter template itself has an "articles" Pagefield which references articles included in the newsletter. I use $first = $page->articles->shift(); for the first article and then iterate over the rest. When simply displaying the Newsletter Page via it's url everything works perfect. Now when using $page->render(); the $first PageObject returns errors ("Trying to get property of non-object") I tried explicitly setting output formatting (always on), but that doesn't help. If I remove the whole $first set, everything works fine. My only guess is that this has to do with $page->render(). Is there anything I need to know? Thanks, thomas [Turns out this was a problem with the foreach loop using render(). The error always occured after the 6th iteration. I now switched to a single render() and replace the dynamic parts using preg_replace_callback()]
  9. I would like to extend the Admin Save button with another SaveAction but can't figure it out: $this->addHookAfter("ProcessPageEdit::buildForm", $this, "editForm"); public function editForm(\Processwire\HookEvent $form) { $target = $form->get('submit_save'); $target->addActionValue('test','Test',''); $form->return = $form; } This gives me another small dropdown button with a single option. I only managed to add another button to the form (not quite as elegant but would do the job) but my question is if it is possible to use ProcessPageEdits processSave() method and add to it? I need a button that would save the page, add a message and return to a custom URL in the admin. Thanks! thomas
  10. Hi, I was wondering if there was an fast & easy method to find out if a logged in user is allowed to duplicate a given page (or create a page with the same template & parent). This should take into account the template settings and user permissions. Is there? Thanks, thomas
  11. Thanks @rickI saw that. I now label all my templates "product" and use `$this->addTemplates(\Processwire\wire('templates')->find("tags=product"));`
  12. Hi, I want to extend PagesType to get a new `Product $products` variable in the API. Problem is, I have about a million (well, about 50) different templates for the products so `addTemplates()` can be difficult. Without a template, `pagesType` throws notices (`Trying to get property of non-object in wire/core/PagesType.php on line 161`). Is there a way to extend `pagesType` without specifing templates or by specifying a template group? Thanks, thomas
  13. Strange update: $pdf->save(); shows the images, but $pdf->download(); doesn't. Not sure what's going on here but I can work around that. Thanks, thomas
  14. Hi @Wanze, i tried it all: <img src="<?=$mandant->teaserbild->first()->height('100')->url;?>" width="<?=$mandant->teaserbild->first()->height('100')->width;?>" height="100" alt="logo" /> // AND <img src="<?=$mandant->teaserbild->first()->height('100')->httpUrl;?>" width="<?=$mandant->teaserbild->first()->height('100')->width;?>" height="100" alt="logo" /> // AND ALSO $imagedata = file_get_contents($mandant->teaserbild->first()->height('100')->filename); $base64Img = "data:image/png;base64," . base64_encode($imagedata); <img src="<?=$base64Img;?>" width="<?=$mandant->teaserbild->first()->height('100')->width;?>" height="100" alt="logo" /> but nothing works. How do I enable debug mode (showImageErrors) for the pdf module? Thanks, thomas
  15. Hello @Wanze and everyone else, i'm trying to get pages2pdf with @apeisas Padloper. They way I want to use it is: $t = $this->modules->get("PadRender")->getPadTemplate("invoice.php"); # this simply returns a TemplateFile $t->set("order", $order); $pdf = $this->modules->get("WirePDF"); $pdf->pageOrientation = 'P'; $pdf->pageFormat = 'A4'; $pdf->markupMain = $t->render(); $pdf->save($this->config->paths->assets.'/pdf/'.$order->rechnungsnummer.'.pdf'); I'm having problems with the images in the template. Only a red "x" is displayed. I tried full httpUrl and even including the base64 data. No success. Can anyone help out? Thanks, thomas
×
×
  • Create New...