-
Posts
189 -
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,251 profile views
thomas's Achievements
-
thomas started following Create PageArray with delimiter string? , Weird problem with $page->render() , Extending the admin "Save" button and 5 others
-
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()]
-
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
-
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
-
Thanks @rickI saw that. I now label all my templates "product" and use `$this->addTemplates(\Processwire\wire('templates')->find("tags=product"));`
-
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
-
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
-
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
-
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
-
I am trying to use `showif` on a field accompanying an image field. It's supposed to only be present if an image was uploaded. So far, so easy. `image.count>0` does the trick. But when I open the page for editing, the field stays closed, even though an image was uploaded before. What am I missing? Thanks, thomas
-
Ever since I updated Safari to 9.0.3 I'm seeing this strange issue that if you try to select text in a CKEditor field, the page scrolls down for as long as you hold the click. This is pretty annoying and since my editors insist on using Safari (why I don't know) I need to fix this. This doesn't happen on the official CKEditor demo page so I believe it might be something with the plug-in. Has anyone seen this issue? I actually have one page where this doesn't happen but I can't find a difference or any reason what could cause this ... Thanks, thomas
-
Hello Wanze, I'm trying to use your module to send PDF invoices to customers of my store and I was wondering if it was possible to pass an object to the template similar to $template->set() works ...? Thanks, thomas
-
Thanks! So it was no dream after all
-
Hello, I feel like I read somewhere that you can create a PageArray with a delimiter string ie "313|34|23|978" ... like the opposite of (string)PageArray ... I can't find it though ... maybe it was just a dream and I have to iterate ... Can anyone help? Thanks, thomas
-
Check if $user is logged in without renewing cookie
thomas replied to thomas's topic in API & Templates
Hallo Horst, thanks, that was actually quite helpful! My app reads alot of (personal) data on start up and only polls PW when data is edited. That's why I'd like it to log out when it sits idle for a wile. I already thought about using a timestamp in a session so that's want i'll try to do. Thanks, thomas -
I'm building my first AngularJS app on top of Processwire and I was wondering how I could check if the user is still logged in and has the neccessary permissions without actually renewing the cookie lifetime? On manual logout I could pass some session variable but if the session simply runs out (like leaving the browser window open over night) I'd like to periodically check $user and re-route to a log-in page when the session expires, but this seems to renew the cookie ... Can anyone help? thanks, thomas