Jump to content

Search the Community

Showing results for tags 'solved'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL







  1. Hi all. I just ran into a very strange problem. The solution is below but I am just not sure if this is a 'feature' or a bug 😀! My lister bookmark for selector: 'has_parent!=2, template=62, categories=1072, limit=25, sort=-modified, include=unpublished' gets changed into below selector whenever I am not logged in as a superuser: 'has_parent!=2, template=62, categories=1072, limit=25, sort=-modified, include=hidden' Note the 'include=' part which is changed. EDIT: Template with ID 62 is 'product' in this case. I am referring to it by name instead of ID. From reading the source code, I can follow this exactly here: // if all specified templates are editable, include=unpublished is allowed if($numEditable == count($templates)) { // include=unpublished is allowed } else if($includeMode == 'unpublished') { // include=unpublished is not allowed if($showIncludeWarnings) { $this->resultNotes[] = $this->_("Not all specified templates are editable. Only 'include=hidden' is allowed"); } $includeSelector->value = 'hidden'; $changed = true; } This is taken from ProcessPageLister here. The way the $numEditable variable gets determined is as follows: foreach($templates as $template) { $test = $pages->newPage($template); $test->id = 999; // required (any ID number works) if($test->editable()) $numEditable++; } You can find this here, a few lines above the first snippet. The selector doesn't contain any parents, so these lines are the ones being used. Whenever I am logged in as non-superuser, I can also see the error message "Not all specified templates are editable. Only 'include=hidden' is allowed". So everything behaves just as intended. Now for the solution, which brings me to this possible bug: Adding access control to the template 'product' and enabling editing for the specific role solves the problem. The lister now shows unpublished pages and the error message is gone. So far so good. But: Before the change, the user could still edit the products because access was inherited automatically from the home template. Hence on the surface, the configuration is exactly the same and the user can do exactly what they could before. Only the direct access has changed which has an impact on the 'editable' check. The question now is, is this intended or am I looking at an edge case which isn't covered by the rather simple editability check using an arbitrary new page? @ryan: Could it be that Lister should add a parent to enable access inheritance in this check? I can imagine that this gets very complicated rather quickly...
  2. Hi, I copied my website malabu.de on a local LAMP-server which runs PHP 8.2.7 and got the following Fatal Error: As I am not very familiar with PHP I do not know, how to fix it. This is my _head.php-file: <!DOCTYPE html> <html lang="de"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title><?php echo $page->title; ?></title> <meta name="description" content="<?php echo $page->summary; ?>" /> <link rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates?>styles/malabu.css" /> </head> <body> <!-- navigation --> <div id="menu"> <h1 class="titel"><a href="/">malabu.de</a></h1> <nav id="nav"> <ul> <?php // top navigation consists of homepage and its visible children $homepage = $pages->get('/'); $children = $homepage->children(); // make 'home' the first item in the navigation $children->prepend($homepage); /** * Recursive traverse and visit every child in a sub-tree of Pages. * * @param Page $parent root Page from which to traverse * @param callable $enter function to call upon visiting a child Page * @param callable|null $exit function to call after visiting a child Page (and all of it's children) */ function visit(Page $parent, $enter, $exit=null) { foreach ($parent->children() as $child) { call_user_func($enter, $child); if ($child->numChildren > 0) { visit($child, $enter, $exit); } if ($exit) { call_user_func($exit, $child); } } } visit( $pages->get('/') , function(Page $page) { echo '<li><a class="men" href="' . $page->url . '">' . $page->title . '</a>'; if ($page->numChildren > 0) { echo '<ul>'; } } , function(Page $page) { echo '</li>'; if ($page->numChildren > 0) { echo '</ul>'; } } ); // output an "Edit" link if this page happens to be editable by the current user if($page->editable()) { echo '<li><a class="men" href="'.$page->editURL.'">Edit</a></li>'; } ?> <!-- öffne Mailformular --> <li><a class="men" href="mailto:info@malabu.de"><img src="<?php echo $config->urls->templates?>styles/brief.gif" width="25" height="15" alt="info@malabu.de" title="schreib mir"> </a></li> <!-- search form <form class='search' action='<?php //echo $pages->get('template=search')->url; ?>' method='get'> <input type='text' name='q' placeholder='Search' value='' /> <button type='submit' name='submit'>Search</button> </form> --> </ul> </nav> </div> _head.php
  3. I kept getting these errors on my modules page on one site I have no such modules listed, but inspection via Adminer shows that they have entries in the modules database. Each entry has data listing a number of modules, such as (for .ModulesVerbose.info). 178 summary Tracy debugger from Nette with many PW specific custom tools. author Adrian Jones href https://processwire.com/talk/forum/58-tracy-debugger/ versionStr 4.23.33 I assumed that the database got corrupted somehow (but how?), so I deleted the entries. Everything seems to be OK.... Any ideas what might have caused this? Anyway, thanks @adrianfor Adminer - always useful in extremis.
  4. Hi. Still quite new to processwire and general web developement. After working on localhost for a while, I wanted to upload my site to my live server. But I forgot to remove processwire-master folder from the structure as I installed my processwire profile on my live database (I'm not even quite sure when I should have done that - just after unzipping processwire-master to my root ?). Anyway now I'm stuck with that and even though I could probably install again I feel like this could be somewhat of a learning experience. So how can I move cleanly and properly my site back to the root, and removing pw-master in the process ? I've done the obvious which was, well, just moving the thing back 1 step in the folder structure. But exepectedly, I couldn't access the admin anymore because the url was now wrong, and my ProForm was also missing from the homepage (404). I've tried looking into existing forum posts with little success as I'm not too sure of how to describe my issue other than the title of this post. Please excuse my poor level of technical skills, I come from the design side of things and many things are still black magic to me 😅
  5. I'm probably being dim, but can anyone explain why $pages->get('/processwire/access/permissions/') returns a null page? See Tracy console below:
  6. Hi Team I am trying to fetch the label of form fields with this api function. $form = $forms->get('shop-payment-stripe'); $fieldDefinitions = $form->fields; If I try to print $fieldDefinitions it shows empty. Also, if I print $form variable it is surely returning ProcessWire\FormBuilderForm Object. Any suggestions how to get the form field labels. (Field names are surely accessible from form)
  7. Hi, Info: I have a secured section on a website. Users with a certain user role has access to this section through a frontend login form. Summary: When i modify and try to save the current user (e.g. the user is logged in) by API, the `pass` field won't get populated with the new value. Instead the field `pass` is cleared, so the user page is set to `unpublished` on save. // Rough abstract... // Info: var `u` represents a instance of the current user $u->of(false); $u->pass = 'valid-example-password'; // DOES NOT get saved, instead the `pass` field gets cleared $u->save(); $u->of(true); As this was proven before my last PW update 3.0.210 > 3.0.221 some weeks ago, i wonder if this behavior relates to the update (?) If so (which would make sense to me for several reasons), the question is: How can i provide those users the ability to change their passwords within the frontend secured section while they are logged in? Re-login doesn't work (Error: Failed login for 'xxx' - Login not allowed) either. // log in with new credentials $u = $session->login($u->name, $pass); What do i miss here? ;-). Many thanks for your thoughts! Olaf
  8. Hi there, I'm working on an email message template and would like to render a custom one to be sent. I tried to use $files->render() this way // rendering file e.g. a template file or a hook statement in ready.php $body = $files->render('emails/myfile', array( 'myVar1' => $var1, 'myVar2' => $var2, ... )); but $vars seems to be not accessible from within the rendered file. That is, $vars seems to be not set: // rendered file emails/myfile.php $myVar1 = $vars['myVar1']; // is not set $myVar2 = $vars['myVar2']; // is not set ... // is not set How can I get the $vars so to properly render the custom message template for sending the email? Notes: By using $files->include() the $vars is accessible but I cannot use this method because I should retrieve the output $body as a return value for sending the email later. So, I'm still looking to render the custom message using $files->render(). This thread is someway related to this one.
  9. Hi, I'm getting this error on a new host: I've never seen it before and wondered if someone has dealt with something similar in the past? If so, were you able to solve it? Also, according to phpinfo(); mod_rewrite is enabled but none of the urls are working. I'm ready to move her site to a new host but thought I'd ask here first. Warning: Zend OPcache API is restricted by "restrict_api" configuration directive in /usr/www/users/floreng/000/site/assets/cache/FileCompiler/site/modules/AdminLinksInFrontend/AdminLinksInFrontend.module on line 170 Warning: session_name(): Session name cannot be changed after headers have already been sent in /usr/www/users/floreng/000/wire/core/Session.php on line 294 Warning: ini_set(): Session ini settings cannot be changed after headers have already been sent in /usr/www/users/floreng/000/wire/core/Session.php on line 297 Warning: ini_set(): Session ini settings cannot be changed after headers have already been sent in /usr/www/users/floreng/000/wire/core/Session.php on line 298 Warning: ini_set(): Session ini settings cannot be changed after headers have already been sent in /usr/www/users/floreng/000/wire/core/Session.php on line 299 Warning: ini_set(): Session ini settings cannot be changed after headers have already been sent in /usr/www/users/floreng/000/wire/core/Session.php on line 300 Thank you so much.
  10. Like the title says. Accidentally renamed "wvprofile_body" to "Body" where I actually meant to change the label. Didn't notice that I had entered that into the wrong field, hit Save. ProcessWire destroyed the wvprofile_body table then showed me an error saying that the field "body" already exists. I have no idea what happened. I've never had this happen before, but I've also never accidentally renamed a field to an existing field name. Has this happened to anyone else? Doesn't PW check for a unique name before deleting data? Looked in the database directly, the entire wvprofile_body table is gone. Keep backups.
  11. Hi have a general question if this would be possible: I have a page that contains a repeater. This repeater holds an image and a cite for each repeater item. On the page itself all repeater items (= all cites) should be visible in a carousel. But on other pages I would like to select a specific single (!) cite from that repeater to be shown. This cite should be selectable from a list, not just hard coded as a ProcessWire selector with the ID of the repeater item... I know that this could be achieved with a page reference field. But in that case I can't make use of the repeater field but instead have to create a subpage for each cite I want to add. The repeater solution seems to be more straight forward.
  12. Hi, I'm wondering what's the best way to provide only the page edit form, without header, footer and breadcrumb (see screenshot). Can I hook into the rendering and remove some parts? Thank you in advance, with best regards Sebastian
  13. I have the need to change the text colors in a TinyMCE field. There seems to be a plugin available for this case: https://www.tiny.cloud/docs-4x/plugins/textcolor/ But in the field settings this plugin option is missing: What could be a workaround for this? SOLVED: The documentation link was for version 4... in the current version 6 you have to insert the "forecolor" setting into the toolbar. That's it!
  14. Since Updating to the latest Processwire Version 3.0.210 I get the following error. I've have this website running since processwire 2.2. Has anyone else experienced this or an idea what the problem might be? Thanks! Peter Fatal Error: Uncaught Error: Undefined constant "languages" in site/templates/admin.php:39 #0 wire/core/WireHooks.php (1051): TemplateFile->{closure}() #1 wire/core/Wire.php (484): WireHooks->runHooks() #2 wire/core/PagesEditor.php (787): Wire->__call() #3 wire/core/PagesEditor.php (478): PagesEditor->savePageFinish() #4 wire/core/Pages.php (840): PagesEditor->save() #5 wire/core/Wire.php (419): Pages->___save() #6 wire/core/WireHooks.php (952): Wire->_callMethod() #7 wire/core/Wire.php (484): WireHooks->runHooks() #8 wire/core/PagesEditor.php (1235): Wire->__call() #9 wire/core/Pages.php (1017): PagesEditor->_clone() #10 wire/core/Wire.php (422): Pages->___clone() #11 wire/core/WireHooks.php (952): Wire->_callMethod() #12 wire/core/Wire.php (484): WireHooks->runHooks() #13 wire/modules/Process/ProcessPageClone.module (363): Wire->__call() #14 wire/core/Wire.php (413): ProcessPageClone->___process() #15 wire/core/WireHooks.php (952): Wire->_callMethod() #16 wire/core/Wire.php (484): WireHooks->runHooks() #17 wire/modules/Process/ProcessPageClone.module (130): Wire->__call() #18 wire/core/Wire.php (413): ProcessPageClone->___execute() #19 wire/core/WireHooks.php (952): Wire->_callMethod() #20 wire/core/Wire.php (484): WireHooks->runHooks() #21 wire/core/ProcessController.php (350): Wire->__call() #22 wire/core/Wire.php (413): ProcessController->___execute() #23 wire/core/WireHooks.php (952): Wire->_callMethod() #24 wire/core/Wire.php (484): WireHooks->runHooks() #25 wire/core/admin.php (160): Wire->__call() #26 wire/modules/AdminTheme/AdminThemeDefault/controller.php (13): require('...') #27 site/templates/admin.php (101): require('...') #28 wire/core/TemplateFile.php (328): require('...') #29 wire/core/Wire.php (413): TemplateFile->___render() #30 wire/core/WireHooks.php (952): Wire->_callMethod() #31 wire/core/Wire.php (484): WireHooks->runHooks() #32 wire/modules/PageRender.module (575): Wire->__call() #33 wire/core/Wire.php (416): PageRender->___renderPage() #34 wire/core/WireHooks.php (952): Wire->_callMethod() #35 wire/core/Wire.php (484): WireHooks->runHooks() #36 wire/core/WireHooks.php (1060): Wire->__call() #37 wire/core/Wire.php (484): WireHooks->runHooks() #38 wire/modules/Process/ProcessPageView.module (184): Wire->__call() #39 wire/modules/Process/ProcessPageView.module (114): ProcessPageView->renderPage() #40 wire/core/Wire.php (416): ProcessPageView->___execute() #41 wire/core/WireHooks.php (952): Wire->_callMethod() #42 wire/core/Wire.php (484): WireHooks->runHooks() #43 index.php (55): Wire->__call() #44 {main} thrown (line 39 of site/templates/admin.php)
  15. I ran over a bug (?) that kind of freaks me out. It's this kind of problem that seems to occur without any reason. But let me explain: I have a project that is using the latest UIKit 3 library. On the homepage I make use of a slideshow component which is also configured to take space of the entire viewport height (via: uk-height-viewport). The other content elements are introduced by using the Scrollspy component when scrolling down. I was wondering why no link is working (even javascript on click events on anything on the page). Instead the "first" click only triggers the hover state of the link/button. Then the second click triggers the link event. This only occurs on mobile devices (like my iPhone). The only solution to make links work in the first place is to get rid of the uk-height-viewport attribute of the slideshow. OR to get rid of all the Scrollspy instances. This makes no sense to me. I made a small demo site where I can exactly reproduce this phenomenon. So it seems to have nothing to to with my project code but is in fact a kind of UIKit bug (?). Please have a look: http://uikit.thumann-preview.de/ 1. Open the page on a mobile device 2. Scroll down to the red button 3. Tap on the button. Nothing happens but the hover state is activated. 4. Tap again on the button. The link is working. I also made a short video that shows the problem: RPReplay_Final1675711729.MP4 Here's the code of this test page: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>CDN Example</title> <script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.15.11/js/uikit.min.js" integrity="sha512-uNdy6/b4kpAKQgC1MqDRW7HzGqmja6jPPfQ0Pv3q4f0r5XpL4cxPlgqgSbFT5pnLFo4BSFZX8Ve/ak0DDN06OA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.15.11/css/uikit-core-rtl.min.css" integrity="sha512-+6D4TOLdOBhkuufbELpbCiGmD+Y4dzrNbSPGwtgGO2nf7Id3dM0x5R/Cw0bI/13pFUnsRL8pfpmKNWLbAx8fGg==" crossorigin="anonymous" referrerpolicy="no-referrer" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.15.11/css/uikit-core.min.css" integrity="sha512-Up68klxaLGLgBXFtu9KAkcM0/b1Vv97wru/VabGokNEwbQN1RBjBtthqDgildf/8YCOKaaLvT5ZfIvVPom5dIw==" crossorigin="anonymous" referrerpolicy="no-referrer" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.15.11/js/uikit-icons.min.js" integrity="sha512-Rrh7aqdTz7Q1BPfCdWCK3poag9FNK1HQJMbSdL/eRZwXkbS1EWlY5n2XJ70ZVh1ZLRIJEUoWxATps1cyzpGp/g==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> <style> body { max-width: 90%; margin: auto; background-color: rgb(227, 227, 227); } footer { padding: 10px; background-color: cornflowerblue; padding-top: 20px; } </style> </head> <body> <header> <nav class="uk-navbar-container" uk-navbar style="background-color: cornflowerblue;"> <div class="uk-navbar-right"> <ul class="uk-navbar-nav"> <li class="uk-active"><a href="#" style="color: white">Home</a></li> <li> <a href="#" style="color: white">Account</a> <div class="uk-navbar-dropdown"> <ul class="uk-nav uk-navbar-dropdown-nav"> <li class="uk-active"><a href="#">Login</a></li> <li><a href="#">Sign Up</a></li> <li><a href="#">Report</a></li> </ul> </div> </li> <li><a href="#" style="color: white">Item</a></li> </ul> </div> </nav> </header> <!-- Slider --> <div class="uk-position-relative uk-visible-toggle uk-light" tabindex="-1" uk-slideshow="ratio: false"> <ul class="uk-slideshow-items" uk-height-viewport> <li> <img src="https://picsum.photos/200/400" alt="" uk-cover> </li> </ul> <a class="uk-position-center-left uk-position-small uk-hidden-hover" href="#" uk-slidenav-previous uk-slideshow-item="previous"></a> <a class="uk-position-center-right uk-position-small uk-hidden-hover" href="#" uk-slidenav-next uk-slideshow-item="next"></a> </div> <!-- Cenetred Text --> <h1 class="uk-text-primary uk-text-center">This is awesome</h1> <!-- Adding card --> <div class="uk-child-width-1-3@m uk-grid-small uk-grid-match" uk-grid uk-scrollspy="cls: uk-animation-slide-bottom"> <div> <div class="uk-card uk-card-primary uk-card-body"> <h3 class="uk-card-title">Card1</h3> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> </div> </div> <div> <div class="uk-card uk-card-warning uk-card-body"> <h3 class="uk-card-title">Card 2</h3> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> </div> </div> <div> <div class="uk-card uk-card-secondary uk-card-body"> <h3 class="uk-card-title">Card 3</h3> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> </div> </div> </div> <div class="uk-child-width-1-3@m uk-grid-small uk-grid-match" uk-grid uk-scrollspy="cls: uk-animation-slide-bottom"> <div> <div class="uk-card uk-card-warning uk-card-body"> <h3 class="uk-card-title">Card 4</h3> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> </div> </div> <div> <div class="uk-card uk-card-secondary uk-card-body"> <h3 class="uk-card-title">Card5</h3> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> </div> </div> <div> <div class="uk-card uk-card-primary uk-card-body"> <h3 class="uk-card-title">Card 6</h3> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> </div> </div> </div> <a href="https://www.google.de" class="uk-button uk-button-danger uk-margin">I AM NOT WORKING :-(</a> <!-- Card with images --> <div class="uk-child-width-1-2@m" uk-grid uk-scrollspy="cls: uk-animation-slide-bottom"> <div> <div class="uk-card uk-card-default"> <div class="uk-card-media-top"> <img src="/slides/slide3.png" width="1800" height="1200" alt=""> </div> <div class="uk-card-body"> <h3 class="uk-card-title">Human</h3> <p>An average of 20 times every minute, your eyes blink. The tongue has roughly 8,000 taste buds, each of which can have up to 100 cells. In reality, earwax is a form of sweat.</p> </div> </div> </div> <div> <div class="uk-card uk-card-default"> <div class="uk-card-body"> <h3 class="uk-card-title">Cat</h3> <p>Cats have a 6-times-their-height jump capacity. The average cat snoozes for 13 to 16 hours every day (roughly 70% of their life). A cat's lifespan is equivalent to 15 years in a person's life. A Maine Coon is one of the largest domestic cat breeds.</p> </div> <div class="uk-card-media-bottom"> <img src="/slides//slide4.png" width="1800" height="1200" alt=""> </div> </div> </div> </div> <br> <br> </body> </html>
  16. I want to add a tab to an edit page in the admin via API. I found a code from @kixe here https://processwire.com/talk/topic/15015-tabs-in-module-config-page/?do=findComment&comment=134624 that basically does this, but I can´t get it to work correctly (see screenshot). As you can see the Tab has a weird name and the submit button appears before the fieldset. Also the tab should appear as second, directly after "Inhalt (content)". Maybe I did something wrong when adding the tab to the form? Here is the code that I used: public function ready() { $this->addHookAfter('ProcessPageEdit::buildForm', $this, 'addButtons'); } public function addButtons($event) { $page = $event->object->getPage(); if ($page->template == "bewerbung") { $form = $event->return; $inputfields = new InputfieldWrapper(); $tab = new InputfieldWrapper(); $tab->attr('title', 'Settings'); $tab->attr('class', 'WireTab'); $markup = $this->modules->get('InputfieldMarkup'); $markup->label = 'Settings'; $markup->value = '<p>Just a placeholder for some inputfields.</p>'; $tab->add($markup); $inputfields->add($tab); $form->add($inputfields); } }
  17. Hi, all! I "inherited" a rather old processwire project and managed to upgrade the ProcessWire core version and nearly all installed modules to recent versions. Only the installed pro module ProFields: Table can't be upgraded via the module manager of ProcessWire. The module ProFields: Table must have been purchased by my clients at some point in time (no billing or license information is avalaible to me) and is still in use. Currently version 0.1.3 of ProFields: Table is installed. My problem is, that I upgraded the related module Table CSV Import / Export that depends on ProFields: Table. This depending module (now using vesion 2.0.16) apparently is not compatible with ProFields: Table v.0.1.3 . The concrete problem is that when using the csv import feature of the module Table CSV Import / Export, it uses some kind of Hook or public api of ProFields: Table that did not exists in v0.1.3. In detail it's a call to $tabelRows->new(...); // file TableCsvImportExport.module.php, line 512 I fully expect this problem to disappear as soon as I upgrade ProFields: Table to its current version. So in short: How do I upgrade ProFields: Table? Thanks in advance, Marco
  18. Hello, I'm struggling with a query in search results that slow down the rendering way too much. So much I appreciate the processwire api, I may have done stupid things with it. I have a site-search for documents (pages). After retrieving the matches, I query for the used tags at each page to render a tag-filter menu (isotope.js). In addition there is a counter on each tag label to show the usage of this tag by documents in the current result list. Thats my code… //$matches : found pages //$tags : collection of all tags used by $matches (a tag is a page) //$page->tax_tag : is page reference field at document pages, multiple select foreach ($tags as $tag) { $usage = 0; foreach ($matches as $doc) { if ($doc->tax_tag->has("id={$tag}")) $usage++; } $label = "{$tag->get('title')} {$usage}"; … } I guess that's award-worthy for producing as many unnecessary database hits as possible ... 😇 What do you think is the right way to get this data out of the database? Is anybody out there with a blazing sql-query to get all that tag-info in one hit?
  19. Hi there, I've optimized a search for items with MarkUpCache for all predefined searches (e.g. like a category) – that did work well so far using code [A] in my search template file. Today I tried to not only cache the list in its whole markup, but in addition each item in its separate cache-file. [A] and [B] On first load, it leads to an error: You must attempt to retrieve a cache first, before you can save it. (in /wire/modules/Markup/MarkupCache.module line 120) - I can see the single items cache files are generated (item-####), but the cache dir results-for-#### is empty Reloading the (search)page subsequently runs without error, but still no cache file for the list in results-for-#### Where is my mistake? I'm stuck – would be pleased about a tip. // [A] --------------- //@search tpl file.php $cache = wire("modules")->get("MarkupCache"); if (!$data = $cache->get("results-for-###", 3600)) { $data = renderResultList($foundpages); $cache->save($data); } //using $data for output echo $data; // [B] --------------- //@_func.php //render a result list of items function renderResultList($items) { $out = ''; // cycle through all the items foreach ($items as $item) { $out .= renderResultListItem($item); } return $out; } //render a single item function renderResultListItem($item) { $cache = wire("modules")->get("MarkupCache"); $cachefile = "item-{$item->id}"; if (!$data = $cache->get($cachefile, 3600)) { $data = $item->title; //…add more markup and data $cache->save($data); } return $data; }
  20. Hi, in a template file I successfully used $files->include(): File: /site/templates/a-template-file.php <?php namespace ProcessWire; $files->include('partials/file-name.php'); // ... This loads the /site/templates/partials/file-name.php file containing other ("nested") $files->include() statements, for instance: File: /site/templates/partials/file-name.php <?php namespace ProcessWire; $files->include('partials/other-file-name.php') // ... Now, in the template file, I would like to use $files->render() (instead of $files->include()) to retrieve output as a return value: File: /site/templates/a-template-file.php <?php namespace ProcessWire; $output = $files->render('partials/file-name.php'); // ... But, by using the render() (instead of the include()) function, I get the error message coming from within the rendered /site/templates/partials/file-name.php file: I think the problem is the "./" as shown in the above error message. Note: In the rendered /site/templates/partials/file-name.php file, I tried to use the "nested" $files->include() with the allowedPaths option set (i.e. $files->include('partials/other-file-name.php', [], ['allowedPaths' => [$config->urls->templates]])) and many other things, without success. How can I solve the problem in order to use the render() (instead of the include()) function?
  21. Hi, in the /site/init.php file I've stated: wireSetting([ 'a_key' => [ 'value1', 'value2', 'valueN' ], '...' => '...' ]) I normally use with success the wireSetting in my template files like this: wireSetting('a_key'). I would like to use this wireSetting in an Hanna code, but when I do this I get the error "Method ProcessWire::wireSetting does not exist or is not callable in this context". How can I use wireSetting in Hanna code?
  22. Hi there, I can't get my LazyCron to fire <?php $useMain = false; $wire->addHook('LazyCron::everyMinute', null, function() { $log->message("1 min passed"); echo '1 min passed'; }); echo 'hooked - '; ?> Some output for good measure I tried making it into an anonymous function (see above), but same result as by using the example in the docs (with regular function). No lazycron*.cache file, No logs, No message - it just doesn't fire at all. Not sure how to proceed? tx!
  23. Hello I manage a multi-language site. In very few case I would like to have a content in other language than default when the value is not set in current language. I try this way to check if the value is empty, but the value is printed with default language $cl = $languages->get($user->language->name); $blog_title = $page->getLanguageValue($cl, 'title'); Is there a way to check if a value is empty in some language?
  24. Fatal Error: Uncaught Error: Call to a member function className() on null in wire/modules/Fieldtype/FieldtypeTextareaHelper.php:41 #0 wire/modules/Fieldtype/FieldtypeTextarea.module (338): FieldtypeTextareaHelper->getConfigInputfields(Object(Field),Object(InputfieldWrapper)) #1 wire/core/Wire.php (417):FieldtypeTextarea->___getConfigInputfields(Object(Field)) #2 wire/core/WireHooks.php (951):Wire->_callMethod('___getConfigInp...', Array) #3 wire/core/Wire.php (485):WireHooks->runHooks(Object(FieldtypeTextarea), 'getConfigInputf...', Array) #4 wire/core/Field.php (1110): Wire->__call('getConfigInputf...', Array) #5 wire/core/Wire.php (414): Field->___getConfigInputfields() #6 /wire/core/Wir (line 41 of wire/modules/Fieldtype/FieldtypeTextareaHelper.php) Hello everyone, recently I stumbled on this error when trying to edit a textarea field... Running php 7.4 and PW 3.0.201. Has anyone by chance encountered this problem? Kind regards, - Igor
  25. I retieve my Products by $items as $item. Inside each $item-page is a $rating field. $item1 has $rating value 4 $item2 has $rating value 3 etc. I need to count the $rating field-value inside each $item-page that match my selector to get the average. To see how many $item each seller has, I used the code below. But I do not know how to proceed: <?php $qty = $pages->count("parent=/products/, seller=$item"); echo $qty; ?>
  • Create New...