Jump to content

flydev

Members
  • Posts

    1,366
  • Joined

  • Last visited

  • Days Won

    49

Everything posted by flydev

  1. I understand now what you are trying to achieve. try that : $mypage= $pages->get(1036); $wire->addHookBefore('InputfieldPage::render', function($event) use(&$mypage) { if($event->object->name !== 'job_waehlen') return; $inputfield = $event->object; $selectfield = $inputfield->getInputField(); $selectfield->addOption($mypage->id, $mypage->title, array('selected' => 'selected')); });
  2. BitPoet is right but there is a subtlety. Actually you do not need to implement ConfigurableModule because when you use a MyModuleConfig.php along the module file, this new class extend the ModuleConfig class and thus you don't need to implements the ConfigurableModule or other configuration-specific code ! Your module IS configurable at that point. So regarding your fields configuration, it should work and if is not loading, I bet that a uninstall of the module and a Modules > Refresh and/or removing File Compiled/cache then re-installing the module will do the trick. Enjoy ?‍? !
  3. Hi, you have to assign a page. $wire->addHookAfter('InputfieldPage::processInput', function($event) { if($event->object->name == 'job_waehlen') { bd($event->return->value); // return 1019 (my test id page) $event->return->value = $this->pages->get(1); // will set you parent tree bd($event->return->value); // return 1 (root page) } }); PS: bd() call come from TracyDebugger
  4. Hi, without a loop, you could use selector subfields to find your options like the following: $page->repeater->find("sub_repeater.field=value"); So for you code : $option_name = $p->shop_product_options->find("shop_product_options_option.global_text={$option['name']}"); if(is_null($option_name) || !count($option_name)) { continue; } else { // do stuff }
  5. Hi, read that:
  6. Amazing.. ?‍? I just asked to my boss if he still has something, telling me that all the things came to the trash some time ago, but he told me that he still have a Sinclair ZX-81 with 1KB of RAM and an 16KB RAM extension (http://oldcomputers.net/zx81.html). I will have an answer tomorrow. If you're interested, just tell me. For the C64, it look like we can find some machines here in France. After the hardware part ?
  7. Sorry for the short answer, i am on mobile. Shouldn't be : $repeaterDay->save('film_times'); ?
  8. A fast answer, suggestion. From there : https://dev.mysql.com/doc/refman/5.6/en/charset-charsets.html mysql> SHOW CHARACTER SET; +----------+-----------------------------+---------------------+--------+ | Charset | Description | Default collation | Maxlen | +----------+-----------------------------+---------------------+--------+ | latin1 | cp1252 West European | latin1_swedish_ci | 1 | | utf8 | UTF-8 Unicode | utf8_general_ci | 3 | | utf8mb4 | UTF-8 Unicode | utf8mb4_general_ci | 4 | +----------+-----------------------------+---------------------+--------+ My bet is that you might have a 4-byte characters in a keyword which is actually triggering the error where MySQL utf-8 character set only supports 3-byte characters. My recommendation is to convert your database to the utf8mb4_general_ci collation. PS: Backup, Backup, Backup Edit: Blog post found on ProcessWire: https://processwire.com/blog/posts/pw-3.0.15/#utf8mb4-considerations Good luck ?
  9. When we submit the login form of your admin page, the response is a 404 error code. Also your attempt to visit the reset.php failed, you might have an issue with the .htaccess file. You could try the following : backup everything create a file - disable-procache.php - on the root web dir (along the index.php file) with this code: <?php namespace ProcessWire; require_once('./index.php'); // get the module $pc = $modules->get('ProCache'); // turn off procache $pc->cacheOn = false; visit the page at http://yourwebsite.com/disable-procache.php replace the .htaccess file with this https://github.com/processwire/processwire/blob/master/htaccess.txt (do not forget to rename it to .htaccess) try to login - result ?
  10. That's good to know about MAMP Pro, thanks ! About PureVPN, if you feel concerned by privacy things, check this website for a short - bad/sad - review about PureVPN : https://restoreprivacy.com/purevpn-review/
  11. For modules, what @dragan said. Also in getModuleInfo(), you can add : 'page' => array( 'name' => 'mymodulepage', 'parent' => 'setup', 'title' => 'MyModulePage' ), And how do you do that ? The reason is because the page added require a ProcessModule to be defined.
  12. I don't fully understand the issue, there is an example of buidling a PageArray, inserting pages, looking for a given page (item), removing it from the PageArray : // example $allpagesarray = new PageArray(); // loop to get all Page tree object and insert them in the PageArray for this example foreach($pages->get(1)->children as $p) { $allpagesarray->add($p); if(count($p->children)) { foreach ($p->children as $cp) { $allpagesarray->add($cp); } } } echo "count allpagesarray: {$allpagesarray->count}<br>"; // new PageArray containing some Page object $productpages = new PageArray(); foreach ($pages->get('/products/')->children as $prod) { $productpages->add($prod); } $firstprod = $productpages->first; // the Page object we are looking for in $allpagesarray if($allpagesarray->has($firstprod)) { echo "page found (id:$firstprod->id), removing it from PageArray<br>"; $allpagesarray->remove($firstprod); if($allpagesarray->not($firstprod)) echo "page (id:{$firstprod->id}) removed<br>"; } // check if the Page still exist after removing it from the PageArray if($allpagesarray->not($firstprod)) { echo "page not found (looking for id: {$firstprod->id})<br>"; } else { echo "page still found (id:{$firstprod->id})<br>"; } echo "count allpagesarray: {$allpagesarray->count}<br>";
  13. Yes, to be more precise, as it look like you want to access this array from a template, you will want to set this array as a property to the right page id or template context. Check : wire()->addHookProperty(...); https://processwire.com/api/ref/wire/add-hook-property/
  14. Hi, I think we could say that ready.php is one of the file where we can define hooks to alter templates. It could also be a module. So yes, it's possible and it's the way to go and it depend only on the context you put your hook on.
  15. Sorry @MarcoPLY I didn't saw your last ping! This is the correct way to call the hook, put it in ready.php as you did then, go to Modules > Refresh if you still can't see the hook. Code : wire()->addHookAfter('Pages::saved', function(HookEvent $event) { // Get the object the event occurred on, if needed $pages = $event->object; // Get values of arguments sent to hook (if needed) $page = $event->arguments(0); // your code: $page = $event->arguments[0]; bd($page); // tracy debug: User page object if ($page->template == "user") { $mc = wire('modules')->get("SubscribeToMailchimp"); $email = wire('user')->email; $subscriber = [ 'FNAME' => wire('user')->pad_firstname, ]; $mc->subscribe($email, $subscriber); bd($mc); // tracy debug: MailChimp object } });
  16. Correct, try to compare your hook-code and the one on the documentation: https://processwire.com/api/ref/pages/saved/ hints: function, HookEvent, $pages, $event, object; ? besthintever: tracy
  17. Ok this is the issue. Your problem is a known bug in SOAP extension and you should update the version running on your server to at least PHP 7.1.14 (known to me where the bug was fixed and its working). So just to be clear, PHP 7.0 branch contain the bug. To fix it, update the server PHP version. And FYI, a good habit is to develop with the same environment to avoid those head scratching moment ? - https://bugs.php.net/bug.php?id=70469 Submitted: 2015-09-10 13:50 UTC Modified: 2017-11-22 22:14 UTC https://github.com/php/php-src/pull/2899
  18. Hi, Are you on ProcessWire 3 ? If yes then write at the top of the check_code.php the following code : <?php namespace ProcessWire; What's the error(s) ? - Assuming the problem is calling this file, modify your call(s) to this file like that : <!-- example for form action --> <form method="post" action="<?= $config->urls->templates; ?>download/check_code.php"> [...] </form> <!-- example for redirect --> <?php $session->redirect($config->urls->templates . 'download/check_code.php');
  19. Whats the PHP version on XAMP and server? (Cant reproduce the error, working fine here)
  20. By default, SOAP trigger error with his custom php error handler. To catch exceptions, add array('exceptions'=> true) as an argument : try { $client = new \SoapClient('faulty url goes here', array('exceptions'=> true)); } catch (\SoapFault $e) { echo 'wrong'; }
  21. Hi @quickjeff It should work out of the box. Just put the code after the LoginRegister execute() function call, done. Nope, no reason ?
  22. You are safe to skip this warning while you are sure you don't have a script that need to run longer than the limit (e.g. a custom cron job which in this case will fail silently). If you don't have lot of modules or your site's size isn't that "big" then you are again safe to ignore it. A small note about this specific warning coming from the FileCompiler.php to try to find out the culprit (imho, in your case, it come from a module) : Read on https://processwire.com/blog/posts/processwire-3.0.14-updates-file-compiler-fields-and-more/#file-compiler-updates Call to set_time_limit() in ProcessWire 3 : https://github.com/processwire/processwire/search?q=set_time_limit&amp;type=Code
  23. It depend on your needs, check : [...] const statusInit = 2; // system and modules are initializing const statusReady = 4; // system and $page are ready [...] E.g: in init.php, $page is not accessible (called too early) in ready.php, $page is accessible. Summarily said, new API variables are set (populated) before your prepended file to be consumed in your templates. If you want to access the $general variable as is from a template, you will have to set it in ready.php because here you can know the template/page context. Check those four examples.. Let's say we want to debug $general from our home.php template using Tracy with bd($general); #1 - Set new API var in init.php : (both call return null because we try to access the API var from a template, but still here the template context is unknown) $general is null $wire->general is null #2 - Set the new API var in ready.php : $general is populated $wire->general is populated #3 - Set the new API var in _init.php : $general is null $wire->general is populated #4 - Set the new API var in home.php : (same result as _init.php) $general is null $wire->general is populated Hopefully this will make thing clearer for you though an expert could explain deeper the thing.
  24. Another idea depending the number of data you got (anyway, not really a criteria here), you could also use RockFinder by @bernhard and custom queries using MySQL EXTRACT function with subquery. # pseudo-query SELECT pages.id FROM ( sub_query ) WHERE EXTRACT(MONTH FROM DATE( subquery_here ) ); https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_extract
  25. Bump. Answer needed @LostKobrakai in before to put this damn refactoring thing on the tasks list ?
×
×
  • Create New...