-
Posts
1,070 -
Joined
-
Last visited
-
Days Won
16
Everything posted by dotnetic
-
That's true. Sadly I am a performance junky and interested in new and shiny things, and so I try out almost everything. Another hint: Use bun instead of npm for installing npm modules. It is sooooo much faster. It can do much more, but I use it just as a npm replacement for now.
-
Hi @gebeer. Using webpack nowadays feels a little bit outdated for me, because with vite (from the creator of vue.js) setup is so much simpler and faster, and it comes with first-class support for most frameworks like Tailwind or vue out of the box. But it can't do all things webpack does (not yet). Two or three years ago I used a similar approach to what you did now, as you can see in my jmartsch/acegulpandpack: A set of gulp tasks with JS transpilation, webpack, SVG Sprites and minification (github.com) repo. With vite you use native ES modules instead of transpiling and bundling every time something changes. This makes the development process much (MUCH) faster. If you ever seen it in action, you would not like to go back to webpack. If you guys are interested in a modern build environment for your CSS and JS, I could see if I find the time to write a tutorial for it.
-
Update August 2022: There finally now is a native way of opening the correct file and line, if tracy throws an error. Please see the updated first post.
-
Yes exactly but with an easier syntax (imho), but dump is just one example. I don't know anything about the caching, and yeah it is bad that not the real file is shown in the dump
-
I used Smarty and Twig before, and have to say, that Latte feels much better, and the conditional rendering of elements is a great simplification.
-
This is just syntactic sugar and uses Tracys debug bar, similar to using `{bd ($myvar)}. Using things like tags and filters are also syntactic sugar. {$page->intro|noescape} // or <div n:if="$features"> Tags have some advantages over plain PHP in the template context. For example they are chainable and easy to read/write: {$page->intro|noescape|upper} // outputs unescaped HTML content in uppercase
-
I did not upgrade yet, I am in the process of integration Latte v3 into the TemplateEngineLatte renderer, but still need time for it. Right now I am using v2
-
Or just use {dump $page->title} I think you can drop the parentheses after items or content. Also you might want to use a n:if clause on the ul, so the markup is discarded if there are no items. <ul n:if="$block->items"> <li n:foreach="$block->items as $item"> <a href="#">{$item->title}</a> <div>{$item->content|noescape}</div> </li> </ul> I am also using Latte in an actual project and love it so far. For the integration into ProcessWire I am using TemplateEngineFactory. It also has a Latte renderer (but with Latte 2 atm, actual version is 3).
-
cannot see the GET variables in the url but in the developer tool.
dotnetic replied to froot's topic in General Support
Somewhere in your template where you expect the variables to appear try the following code: print_r($_GET); // or echo $_SERVER["QUERY_STRING"]; What do they output? Also you might want to take a look at this module PaymentPaypal (PaymentPaypal) - ProcessWire Module- 1 reply
-
- 1
-
I think you could use just $page->references('template=adebate') to get the debates that reference this speaker. See the blog post ProcessWire 3.0.107 core updates
-
MarkupSEO - The all-in-one SEO solution for ProcessWire.
dotnetic replied to Nico Knoll's topic in Modules/Plugins
Hey Adrian, can you tell why are you unhappy with SeoMaestro? I just installed it yesterday in a new site and really like it. Are you missing some features? -
The module wasn't working because the home template had a setting of "allow url segments", so the URL hook was not working. Without the setting it works fine.
-
The easiest and best way to setup this stack in my opinion is ddev. DDEV is an open source tool that makes it dead simple to get local PHP development environments up and running within minutes. It's powerful and flexible as a result of its per-project environment configurations, which can be extended, version controlled, and shared. In short, DDEV aims to allow development teams to use Docker in their workflow without the complexities of bespoke configuration. Me and @bernhard use it, and are very satisfied. I am using it on Windows 11 inside of WSL2. But it also runs on Macs and Linux machines.
-
German language pack (de_DE) with formal salutation
dotnetic replied to dotnetic's topic in ProcessWire Language Packs
Just released the new version of the german language pack for stable version 3.0.200 -
German language pack (de_DE) with formal salutation
dotnetic replied to dotnetic's topic in ProcessWire Language Packs
I think I will have a look at the changes on friday, if I find the time. -
anybody could show an example of how to use $config->ajax ?
dotnetic replied to adrianmak's topic in Getting Started
Well, @fruid stated, that he already used halt and it did not work. I experienced the same (but I am also using Smarty Template Engine), thats why I use die() instead. -
anybody could show an example of how to use $config->ajax ?
dotnetic replied to adrianmak's topic in Getting Started
do a `die()` instead of halt -
Novice - Need to add widget / limits on HTML
dotnetic replied to andrewbauer's topic in Getting Started
You can not enter JavaScript into the CKEditor, as it is stripped out by the HTML purifier. It could also be a security problem if the editor allows this. I suggest you add your widget code on the site/templates/pagename.php where you need it. -
I am also about to post a comment with a reference to my article Warum ProcessWire das beste CMS für Ihre Website ist - dotnetic. I also have some issues with ProcessWire's structure and other different stuff like migrations (see other threads), but it depends on the type of project, and how the developer sets everything up (if is not me). Overall PW served me very well through the years, and I have a big project with many monthly visitors running flawless on it.
-
It was an installation with redirect hooks in ready.php or something like that. It worked directly in a different project.
-
Hey guys, I found a solution to the problem when using url or httpUrl for images in the code for the PDF. If you use "$img->filename", then the image would not render if output to the browser, but only in the pdf file. You have to strip the rootUrl and replace "site" with "../../site", then you can have both, a working HTML page with images displayed and also afterwards a PDF also with images. I created a helper function for this: public function convertUrlToRelativeInPdf($html): string { $html = str_replace($this->rootUrl, '', $html); return preg_replace('/\/site/', '../../site', $html); } here is my helper function to generate all of my PDFs: /** * @param $html * @param $pdfName * @param $mode * @param $header * @param $footer * @param $body * @param $stylesheet * @param $page * @param $debug * @param $settings * @return string * @throws WireException * @throws WirePermissionException */ public function generatePdf($html = false, $pdfName = 'test', $mode = 'save', $header = false, $footer = false, $body = false, $stylesheet = false, $page = false, $debug = false, $settings = false): string { $pdf = $this->modules->get('RockPdf'); // $pdf->mpdf->curlAllowUnsafeSslRequests = true; // $pdf->mpdf->showImageErrors = true; // $pdf->mpdf->setBasePath ('https://shop.fugamo.de'); $html = $this->convertUrlToRelativeInPdf($html); $pdf->settings([ 'margin_left' => 20, 'margin_right' => 20, 'margin_top' => 55, 'margin_bottom' => 50, 'format' => 'A4', 'fontdata' => (new \Mpdf\Config\FontVariables())->getDefaults()[ 'fontdata' ] + [ 'sans-serif' => [ 'R' => 'Lato-Regular.ttf', 'I' => 'Lato-Italic.ttf', ] ], ]); if (is_array($settings)) { $pdf->settings($settings); } $stylesheet = file_get_contents($stylesheet) ?: file_get_contents($this->config->paths->templates . '/pages2pdf/styles.css'); // external css $stylesheet = "<style>$stylesheet</style>"; $pdf->write($stylesheet); if ($header && is_file($header)) $pdf->SetHTMLHeader($this->convertUrlToRelativeInPdf(wireRenderFile($header))); if ($body && is_file($body)) { if ($page) { $pdf->write($this->convertUrlToRelativeInPdf(wireRenderFile($body, ["page" => $page]))); } else { $pdf->write($this->convertUrlToRelativeInPdf(wireRenderFile($body))); } } else { $pdf->write($html); } if ($footer && is_file($footer)) $pdf->SetHTMLFooter($this->convertUrlToRelativeInPdf(wireRenderFile($footer))); if ($debug) { die($pdf->html()); } $returnValue = ""; switch ($mode) { case 'download': $pdf->download($pdfName . ".pdf"); $returnValue = "Das PDF wurde runtergeladen."; break; case 'show': $pdf->show($pdfName); break; case 'save': $pdfFile = $this->pdfPath . "$pdfName.pdf"; // die($pdfFile); $pdf->save($pdfFile); // $this->message("PDF wurde gespeichert: $pdfFile"); $returnValue = $pdfName. ".pdf"; break; case 'saveAndShow': $pdfFile = $this->pdfPath . "$pdfName.pdf"; $pdf->save($pdfFile); $pdf->show($pdfName); } bd($returnValue); return $returnValue; } and I call it like this $MyHelperModule = $this->modules->get('nameOfMyHelperModule'); // attention, I am using named parameters here, only available in PHP >= 8.0 $MyHelperModule->generatePdf( html: $html, pdfName: "Sammelauswertung-$id", // name mode: 'show', stylesheet: $this->config->paths->templates . '/pages2pdf/styles.css', // stylesheet settings: [ 'margin_left' => 10, 'margin_right' => 10, 'margin_top' => 20, 'margin_bottom' => 20, ] );