Jump to content

Search the Community

Showing results for tags 'solved'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

  1. 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?
  2. 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
  3. 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; ?>
  4. Since I updated to the version ProcessWire 3.0.165 installing modules from URL, directory and Upload won't work anymore. I have already added $config->moduleInstall('download', true); to my /site/config.php file, but it still doesnt work. Has anyone a solution for this?
  5. I'm looking for a module that would allow me to change page urls and make sure that the old URLs would redirect to the new adresses. Mostly for SEO/Bots. Something like https://processwire.com/modules/process-redirects/ with a bit of magic. Wasn't there a module for this in the past or did I dream that?
  6. Hi, a question of a hook newbie... Probably a simple one, but nonetheless i don't get it after reading the docs and playing around. While in admin i do something with some page fields before saving a page (here: generating vcards). If the page already exists (e.g. edit the page), its straight forward: $wire->addHookBefore('Pages::saveReady', function($event){ $page = $event->arguments(0); // do something with some $page fields... }); But i forgot to handle the case when a page is added. This naturally this leads to a ProcessPageAdd: New page '/path/to/page' must be saved before files can be accessed from it For my understanding, i somehow must differ between Pages::added and Pages::save (or Pages::saveReady) and/or combine the two respectively. Anyway, i assume this may not quite right, so i am running out of ideas. Maybe someone could give me some advice how this should be done. Thx in advance!
  7. The dropdown menus in the AdminUI on my dev machine have suddenly stopped working. Also the submit button is wrong - see below: Menu prob.mp4 As you can see, the drop-down disappears when I try and select from it. It all works OK on the live site and I have done the following: Compared the 'wire' files between the dev and live sites - no corruption or missing files Logged out and back in again Cleared the cache Stopped and restarted Laragon Obviously, I have some code on my dev site that is not yet in the live site, but I can't see that it should affect the Admin UI. Nevertheless, I have tried disabling any new js files and that doesn't fix it either. I am also using the exact same database on each site. Version is PW 3.0.190 on Windows 10 / Laragon. Any ideas?
  8. Hi, here is a task thats new to me. And obviously i overlook some basics. So maybe someone is so kind to give me some advice on this... I have a page whichs collects some contact boxes straight away on page load. It is a multilanguage Site (default is in German, the screenshots shows the english version). The results are wrapped in a form, because the user is able to narrow the resulting contacts by a page reference language switcher (values are part of every contact entry)*. This is done with a javascript ajax request to avoid page reloads. TL;DR: While everything is fine on page load, as soon as i select a country to get the related contact boxes by a ajax call, the static translated strings within the target PHP file are not recognized, e.g. their translation fails. I assume i simply miss some basics here what and when things get parsed when doing such asynchron call. *) The language switcher values has nothing to do with the choosen user language. And for the brave ones... On Page load: The highlighted areas are static translated strings (s. below). All is fine on page load (whatever current user language). If the user selects a country within the language switcher, the form in submitted per JS, do a ajax call and query the results by the giving value of the select option (more details s. below). The result is valid and looks like this (here i narrowed the result to contacts related to germany): BUT: As you can see, the static translation strings (s. highlighted areas) are not translated (e.g. use the default site language). To give a brief overview how its done, here some excerpt screens. Form tag with action target: Javascript: And here is the processing target PHP file (excerpt): contacts-flatproducts.php Many thanks in advance, Olaf
  9. Hey there! I've got a shop with product-categories and the template "product-category". The childs are articles "product-page". As soon as I'm creating a new product, it will copy the defined dynamic fields from the parent and add them to itself. Each product-category can have different dynamic fields (within a repeater maybe): - Simple textfield - Number input - Page references - Options select My problem at the moment is that I would like to predefine "sizes" or "color" in each product-category. For example an options field. But they have to be different in each category and should be fetched by their children. Would it be easily doable with the "pro fields" module? Best regards
  10. Hey all, I have pages that can be created two ways, in the PW admin and via an endpoint where JSON data is sent. I have a hook that checks field data on page save and errors if it is not correct. I would like this to create an error in the PW admin using $this->errors, but if the page is created via the Page API in the script that handles JSON requests I want to throw an exception I can catch and handle accordingly for the JSON response. This also allows for setting a user friendly error message for the PW admin, and machine friendly data for API use. Trying to figure out how to detect which context that the page is being created in. A script, or in the PW admin and act accordingly. Is this possible?
  11. That's right, it's a 2 for 1 special. I am using WireHttp to make a GET request but it is actually making 2 requests when calling WireHttp::get() only once. It doesn't matter where I make this call, it always sends 2 requests. I stripped this down and wrote the request code in init.php to test with the bare minimum of ProcessWire booted. Here's my code: <?php namespace ProcessWire; /** * ProcessWire Bootstrap Initialization * ==================================== * This init.php file is called during ProcessWire bootstrap initialization process. * This occurs after all autoload modules have been initialized, but before the current page * has been determined. This is a good place to attach hooks. You may place whatever you'd * like in this file. For example: * * $wire->addHookAfter('Page::render', function($event) { * $event->return = str_replace("</body>", "<p>Hello World</p></body>", $event->return); * }); * */ if (!defined("PROCESSWIRE")) die; $http = new WireHttp; // Create unique URL with random number to track method call vs. requests made. $url = 'https://renovaenergy.ngrok.io/processwire/test/init/' . rand(1, 9999); $http->get($url); die; Here's the requests I'm receiving after loading the page once: That test was done with all modules removed from the modules directory and the module cache cleared. I can't think of what is causing one get() call to create two requests. Running PW v3.0.184
  12. Hey all, I've been building a new feature on our PW site and the URL hooks are exactly what the doctor ordered. I am developing a RESTful web API to allow external platforms to integrate with our site. The API endpoints are namespaced at /api/v1. I am having trouble making use of the named route parameter using regex. I have a hook for /api/v1/offline-events that gets all Offline Event pages. The next route to be defined is /api/v1/offline-events/{event ID}. The event ID is using a custom string (not the Page ID) that is a 15 character alphanumeric string like this: E4LxQRXZadgjstw. However when I use a PCRE compliant regular expression (tested on regexr.com) I get an error. Here is my hook code for reference and the error produced: <?php namespace ProcessWire; $wire->addHook('/api/v1/offline-events/{eventId:#(?=.{15}$)([A-Za-z0-9])\w+#}/?', function($e) { // ommitted for brevity }); // Error thrown: Warning: preg_match(): Unknown modifier '(' in /wire/core/WireHooks.php on line 1170 I've tried using all delimiters in the documentation (!@#%) but no change in the outcome. The second question is how do I create a wildcard capture for all 404s that occur after the /api endpoint? Currently it is loading the website 404 page. Many thanks!
  13. I have a selector: $pageArray = $pages->find("template=basic-page, length.magnitude>0, include=all"); I would like an array of each of the 'length' fields. However, the field is an object and $pageArray->each('length') returns the formatted values; I want the unformatted objects. I thought perhaps I could use a callable like: $pageArray = $pages->find("template=basic-page, length.magnitude>0, include=all"); $lengths = $pageArray->each(function($p) { $length = $p->getUnformatted('length'); return $length; }); but it seems that only strings can be returned and those are concatenated. So it looks like I have to use a foreach() loop - which works, but I was expecting some neater shorthand. Any thoughts?
  14. Hi, I updated to the currently latest master (3.0.184) and now a lister (listerPro 1.1.3) preset shows the info cited in the title. According to this closed issue this is supposed to work <del>in 3.0.184</del> https://github.com/processwire/processwire-issues/issues/1428 or is this a lister(pro) issue?
  15. We have a client's Processwire site where the Pageimage::size() method has stopped working. It's creating small white PNGs in the assets folder instead of the resized image as usual. Their hosting was recently upgraded and switched to PHP 7.4 and I'm wondering if a they've removed a PHP package or changed a server config to cause this. Does anyone know if the image resizing functionality requires specific PHP modules I need to check for? I've checked the folder permissions on the server - this all looks fine. TIA, J
  16. Hi I'm using Processwire 3.0.180. When I edit a page in admin, Tracy Debugger count between 50 and 100 pages loaded, depending on the templates. All pages open in less than a second. But when I edited pages from a certain template, this pages opened in more than 40 seconds and Tracy Debugger count more than 14000 pages loaded. When I look in the pages loaded list, I find a very large amount of lines that look like this: 1247 /sc_admin/repeaters/for-field-182/for-page-1246/ Page 1248 /sc_admin/repeaters/for-field-158/for-page-1246/ Page 1249 /sc_admin/repeaters/for-field-159/for-page-1246/ Page 1250 /sc_admin/repeaters/for-field-169/for-page-1246/ Page 1251 /sc_admin/repeaters/for-field-170/for-page-1246/ Page 1252 /sc_admin/repeaters/for-field-180/for-page-1246/ Page 1254 /sc_admin/repeaters/for-field-137/for-page-1253/ Page 1256 /sc_admin/repeaters/for-field-182/for-page-1255/ Page 1258 /sc_admin/repeaters/for-field-170/for-page-1195/ Page 1261 /sc_admin/repeaters/for-field-182/for-page-1132/ Page 1262 /sc_admin/repeaters/for-field-159/for-page-1132/ Page 1263 /sc_admin/repeaters/for-field-169/for-page-1132/ Page 1264 /sc_admin/repeaters/for-field-170/for-page-1132/ Page 1265 /sc_admin/repeaters/for-field-180/for-page-1132/ Page Or other like : 10222 /sc_admin/repeaters/for-field-138/for-page-5710/1623420295-8678-1/ RepeaterMatrixPage 10232 /sc_admin/repeaters/for-field-138/for-page-5710/1623420316-7346-1/ RepeaterMatrixPage 10242 /sc_admin/repeaters/for-field-138/for-page-5708/1623482402-7605-1/ RepeaterMatrixPage 10256 /sc_admin/repeaters/for-field-138/for-page-10254/1624257169-0968-1/ RepeaterMatrixPage 10266 /sc_admin/repeaters/for-field-138/for-page-10254/1624257191-2937-1/ RepeaterMatrixPage 10278 /sc_admin/repeaters/for-field-138/for-page-10254/1624257284-3093-1/ RepeaterMatrixPage 10289 /sc_admin/repeaters/for-field-138/for-page-10254/1624258816-4716-1/ RepeaterMatrixPage 10302 /sc_admin/repeaters/for-field-138/for-page-10254/1624259001-0062-1/ RepeaterMatrixPage 10312 /sc_admin/repeaters/for-field-138/for-page-10254/1624259056-5808-1/ RepeaterMatrixPage 10326 /sc_admin/repeaters/for-field-138/for-page-10254/1624259204-4337-1/ RepeaterMatrixPage 10336 /sc_admin/repeaters/for-field-138/for-page-10254/1624259240-545-1/ RepeaterMatrixPage 10347 /sc_admin/repeaters/for-field-138/for-page-10254/1624259280-7777-1/ RepeaterMatrixPage 10357 /sc_admin/repeaters/for-field-138/for-page-10254/1624259299-317-1/ RepeaterMatrixPage 10369 /sc_admin/repeaters/for-field-138/for-page-6006/1624259684-8705-1/ RepeaterMatrixPage 10381 /sc_admin/repeaters/for-field-138/for-page-10379/1624259765-4187-1/ RepeaterMatrixPage More than 10000... This template doesn't contain repeaterMatrix. How can I understand what's happened ? Thanks for your help
  17. Hi is possible to hide FieldsetTab if page has field set to certain value? It's possible for other field type by Input->Visibility->if... but not for FieldsetTab. Thanks Francesco
  18. So, if I do this right at the top of a template PHP file: <?php namespace ProcessWire; function myFunction() { global $config; echo $config->dateFormat; }; ?> I, predictably, get this in my front end (once I figured out about the necessary global $config; line): Y-m-d H:i:s Happy camper. But if I try to access $session variables in the same way: <?php namespace ProcessWire; function myFunction() { global $session; echo $session->future; }; ?> I’m told there is no $session object; it responds exactly as if I hadn’t included the global $session statement: PHP Notice: Trying to get property 'future' of non-object in .../public/site/templates/home.php:5 I thought the problem might conceivably have to do with my private variables, so I tried the provided hasCookie() method: <?php namespace ProcessWire; function myFunction() { global $session; print_r($session->hasCookie()); }; ?> With essentially the same result: Error Call to a member function hasCookie() on null $session variables and methods are fully accessible and work exactly as expected if placed immediately outside of myFunction(). I am rapidly running out of hair. Is this intentional? Or a bug? Can anyone confirm that they see this behavior? Can anyone think of a workaround? Thanks! ProcessWire: 3.0.179 PHP: 7.4.19
  19. I have quite the pickle. The admin no matter where I am at in it, times out constantly. I either get a 504 gateway or and execution timeout. I am banging my head why its across the board. The frontend of the site works great. The site does have a lot of pages, 164,889 to be exact. Most of that is due to image pages created by media manager and having repeater matrix installed which is used on most of the pages. For some reason, if I can manage click the "Clear file compiler" without it timing out, the site perks back up and I can access the admin again and it is quite speedy. However if I walk away leaving the browser sitting for about an hour and come back, I have to start the process all over again. The site has 52 various fields. Not every field is assigned to every template. a lot of the fields are used by the matrix to create a page builder. I can't accept that PW can't handle such. I have other sites that run triple the amount of pages, but don't rely on the matrix to build the layout. I have disabled any custom module that I thought could possibly cause an issue. I have overwrote every module and the wire core thinking something may have got corrupted. I guess my next step is starting with a fresh install, but I thought I would reach out to see if I am missing something. Some background on pages: All the pages are imported using the command line which bootstraps PW and uses the api. This is a dev site, so I blow away the pages if I need to reimport them, until I get it correct. PW Version 3.0.172, PHP 7.3, Innodb 5.7.27-30. I appreciate any suggestions or thoughts.
  20. Hello, I am running ProcessWire 3.0.165 but $input->urlSegmentLast or $input->urlSegment(-1) does not work as expected. Or do I something wrong? Thank you.
  21. Hi Guys, I found here: https://processwire.com/docs/selectors/#finding2 that I can exclude results from my $pages->find($selctor); query by using parent!=123 ( parent ID ) But I was wondering if I can also do so based on the parent template? I've tried doing it by itterating over the matches array and dropping the matches with the parent but since the result is limited for use with the paginator it only drops the items from the batch displayed on this page. Say from the results within matches 0 - 20 and not the entire 0 - 220. Anybody have a idea of how to achieve this? ? Thanks in advace! Bram
  22. I've pages using the custom-page-template and I would like to display a simple message at the top of the page form when editing those pages in the Admin. I thought about hooking ProcessPageEdit::buildForm() but I do not well how to use that hook in order to display the message just for the custom-page-template pages. Any help? UPDATE: Solution found wire()->addHookAfter('ProcessPageEdit::buildForm', function(HookEvent $event) { $ProcessPageEdit = $event->object; $form = $event->arguments('form'); switch ($ProcessPageEdit->getPage()->template->name) { case 'custom-page-template': $form->prependMarkup("<div style='margin-bottom: 3.6em; margin-top: 1em; background: #ffd;'>MY MESSAGE</div>"); break; default: // do nothing } }); Any improvement is welcome!
  23. Sorry I can't find any submit button to save my configuration on a template in the admin interface. The file is fine.
  24. Hello this is my snippet public function init() { if($this->wire('user')->isSuperuser()) { $this->wire()->addHookAfter('ProcessPageEdit::buildFormSettings', $this, 'buildForm'); $this->wire()->addHookBefore('ProcessPageEdit::processInput', $this, 'saveForm'); } } public function buildForm(HookEvent $event) { $p = $event->object->getPage(); $inputfields = $event->return; $fieldset = $this->wire('modules')->get("InputfieldFieldset"); $fieldset->attr('id', 'my_fieldset'); $fieldset->label = __("My Renders"); $fieldset->collapsed = Inputfield::collapsedYes; $field = $this->wire('modules')->get("InputfieldTextarea"); $field->attr('name', 'renders'); $field->attr('value', $p->renders); $field->label = $this->_('Renders'); $fieldset->append($field); $inputfields->append($fieldset); } public function saveForm($event) { $page = $this->pages->get($this->input->post->id); $page->set('renders', $this->input->post->renders); } It builds correctly the inputs, I edit the field renders but when I save the page the value of this inputfield remain blank. What's wrong?
  25. I'm building a fieldtype/inputfield to visually select a grid like Bootstrap since it's the first time coding such thing, I'm basing my code in FieldtypeColorPicker since the base structure is the same, a graphical UI helper to finally output a string as value. The problem is I try to save the value as something like "1,2,3" referencing the index of each column selected but it gets converted as an int value so "1,2,3" becomes "1" if input random text it gets converted as "0". Here is the code: https://github.com/carlitoselmago/FieldtypeGridSpace Here's an screenshot of how it looks
×
×
  • Create New...