Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/03/2024 in all areas

  1. Getting stuck like that is not fun! Hopefully we can help you out. First though is a little self-help question: Have you referenced all of the steps from the following page? https://processwire.com/docs/start/install/troubleshooting/#troubleshooting-upgrades I suspect there's some sort of error being generated and either debug mode is off (due to the website being in production) so you can't see the messages by default, but the error messages should be in one of your log files, or in your server (apache / php) error logs.
    1 point
  2. 1 point
  3. To be clear, are you a developer of the site in question or are you asking more from an editor’s perspective? ProcessWire is quite flexible, so in many parts one would have to be familiar with the specific setup (field and template structure, installed modules) to assist with the user experience. I think you’re asking about a different site, that works differently from the one from the screenshots?
    1 point
  4. To render the screen you showed, this happens: ProcessPageAdd::execute() is called. This is hookable, so you could mangle its markup output, but it’s going to be disgusting. Because neither parent nor template were given, execute() now calls renderChooseTemplate() and immediately returns its result. renderChooseTemplate() is not hookable. Within renderChooseTemplate(), ProcessPageAdd::executeNavJSON() is called. This is hookable, but it’s not going to be very useful. executeNavJSON() – surprise – doesn’t return json but an associative PHP array containing, among other things, the templates you’re allowed to add. It will sort these alphabetically by name using ksort(). Back in renderChooseTemplate(), the allowed parents for each of these templates are now queried using this selector: $pages->find("template=$parentTemplates, include=unpublished, limit=100, sort=-modified") So now you know why Nadelholzbalken is #1: it was most recently modified. Also it’s hardcoded to only show 100 pages. Both are not easily changed. So yeah, you’re basically stuck with post-processing the output of ProcessPageAdd::execute() and being limited to the 100 most recently modified pages. Alternatively you could build the list yourself. It’s only a bunch of links to ./?template_id=123&parent_id=4567 after all. Something like this: $this->addHookBefore("ProcessPageAdd::execute", function(HookEvent $event) { $process = $event->object; if (input()->get('template_id') || input()->post('template_id')) return; if (input()->get('parent_id') || input()->post('parent_id')) return; //we weren’t given a parent or a template, so we build our own list $event->replace = true; $templates = $process->executeNavJSON(array('getArray' => true))['list']; $out = ''; foreach($templates as $tpl_data) { if(empty($tpl_data['template_id'])) continue; $template = templates()->get($tpl_data['template_id']); if (!$template) continue; $out .= "<h3><a href='./?template_id={$template->id}'>{$template->name}</a></h3>"; $parentTemplates = implode('|', $template->parentTemplates); if(empty($parentTemplates)) continue; $parents = pages()->find("template=$parentTemplates, include=unpublished, sort=title"); $out .= '<ul>'; foreach($parents as $p) $out .= "<li><a href='./?template_id={$template->id}&parent_id={$p->id}'>{$p->title}</a></li>"; $out .= '</ul>'; } $event->return = $out; }); Obviously this looks like ass, but functionally that’s the gist of it.
    1 point
  5. Can I throw another log onto this fire? Today I installed a local instance of oobabooga and vicuna. It looks like text-generation-webui has an API mode that can be set to listen for JSON prompt requests! It would be great to either fork PromptGPT or develop an option to select alternative API endpoints, etc. I used this tutorial to guide the install - with the exception I also needed to install NVIDIA CUDA toolkit to get access to CUDA cores from pytorch.
    1 point
  6. OK - this kind of works: In my template I've included the Cloudflare script (and added their end point to the content security policy). Then I'm injecting a placeholder into the form: $comments_form= $page->comments->renderForm(array( 'requireHoneypotField' => 'email2' )); // add a div with class="cf-turnstil" to the form - this gets replaced with a token (after a successful challenge) $cft_tag='<div class="cf-turnstile" data-sitekey="yourturnstilesitekey"></div>'; $comments_form=str_replace("CommentForm' method='post'>","CommentForm' method='post'>$cft_tag", $comments_form); echo $comments_form; Cloudflare replaces that with a token if they think you're not a bot. Then in init.php (not _init.php) I'm hooking into ProcessPageVIew $this->addHookBefore('ProcessPageView::execute', function(HookEvent $event) { if(wire('input')->post('CommentForm_submit')){ // get the Cloudflare token. $cf_token=wire('input')->post('cf-turnstile-response'); // and send it to siteverify $postdata = http_build_query( array( 'secret' => 'yoursupersecretcloudflaresecretkey', 'response' => $cf_token ) ); $opts = array('http' => array( 'method' => 'POST', 'header' => 'Content-Type: application/x-www-form-urlencoded', 'content' => $postdata ) ); $context = stream_context_create($opts); $api_json_response = file_get_contents('https://challenges.cloudflare.com/turnstile/v0/siteverify', false, $context); if($api_json_response ){ // check result and redirect if failed. $result=json_decode($api_json_response,TRUE); if(!($result['success'])){ // die or redirect or whaterver you fancy. // print_r($result); // die("Failed verification."); wire('session')->redirect('/some-help-page-or-something/'); } }else{ // die or redirect or whaterver you fancy. die("No response from verification server."); } } }); If we have a comment that's been submitted then I check the token with Cloudflare. If it fails we can redirect or die or something - it'd be nice to fail a bit more gracefully. No idea how well this will deal with spam and I think I'll need to do some user testing but I think it might be useful.
    1 point
  7. Think you could make your own little "cart" just a littly form with a hidden field for storing the page->id or if this form is on the same page you want to add to the cart you don't even need the hidden field. if($input->post->addtocart && !$cart) { $cart = new Page(); $cart->parent = $pages->get(5771); $cart->template = 'cart'; $cart->title = 'session_id()'; //for example $cart->save(); $cart->of(false); $cart->items = $pages->id; //not a hundred percent sure right now but should work (think I've done it like this already) } } items field would be multi page fieldtype you would then include this "$modules->get('Pages2Pdf')->render();" into the page template you want to generate the pdf's from on the cart page you add a link for the customer, think it should work when you just link to one of the pages and append ?pdf=1 to the url, which will then create the pdf create a new template under /templates/pages2pdf/ with the same name as the template you put the "$modules->get('Pages2Pdf')->render();" in in this template you iterate through the pages in the cart like you would on a blog page or similar and output everything you need for me the final output worked only with heredoc syntax, seems that proper double quotes are needed by tcpdf (you could echo as "normal" but then you would need to escape the double quotes) hoffe es ist einigermaßen verständlich und klappt (hope it's understandable and works)
    1 point
×
×
  • Create New...