Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by Zeka

  1. @ryan Thank you for one more year with PW. It would be great to hear about the PW roadmap for 2023. Been playing with GPT chat for almost a week, crazy stuff. AI will definitely affect humanity more than the invention of manufacturing and electricity
  2. Hi @jsilmarovi You could bootstrap PW instance to your Laravel app https://processwire.com/docs/front-end/include/ and that use PW api to create or edit pages https://processwire-recipes.com/recipes/create-page-via-api/ https://gist.github.com/lokomotivan/e0a20f96b6df02970bccd700a119930e
  3. $page->repeater->find('status!=unpublished')
  4. Thanks, @teppo information and example, now it's more apparent to me how and where this feature could be used.
  5. Hi @teppo It would be great to get some insight into the usage of aliases. What is the intended way of using it?
  6. As @Ivan Gretsky said, the core of CKEditor 5 has changed and implementing it in PW will require significant changes, so maybe we should consider other options like https://imperavi.com/article. It is also used in Bolt CMS (not a promotion).
  7. Hi @digitalhandwerker In your scenario, where you are getting pages by their paths would be more appropriate to use $page->getByPath() method like $pages->getByPath('/en/', [ 'useLanguages' => true, ]);
  8. Hi @fruid You have to turn on advanced mode by setting this in your config.php $config->advanced = true; Than on settings tab on that page you will be able to toggle 'system' checkbox
  9. Hi @JerryDi I would recommend getting to know with 'owner' selector as it could be beneficial in the setups Ryan provided. https://processwire.com/blog/posts/processwire-3.0.95-core-updates/
  10. As an option https://processwire.com/blog/posts/pw-3.0.173/#telling-processwire-what-page-to-render
  11. https://github.com/processwire/processwire/blob/master/wire/config.php#L516
  12. There is also an option to use cookie and htaccess RewriteEngine On RewriteCond %{HTTP_COOKIE} language=(ua|en) [NC] RewriteCond %{REQUEST_URI} !^/(ua|en)/ [NC] RewriteRule ^(.*)$ /%1/$1 [R=301,L]
  13. Hi @Matzn <?php namespace ProcessWire; class ParentModule extends WireData implements Module, ConfigurableModule { public static function getModuleInfo() { return [ 'title' => 'Parent Module', 'version' => 1, ]; } const defaultValue = '12345'; public function __construct() { $this->set('api_user', self::defaultValue); // set default value in construct } public function getApiUser() { return $this->api_user; } public static function getModuleConfigInputfields(array $data) { if(!isset($data['api_user'])) $data['api_user'] = self::defaultValue; $form = new InputfieldWrapper(); $f = wire('modules')->get('InputfieldText'); $f->name = 'api_user'; $f->label = 'API USER'; $f->value = $data['api_user']; $form->add($f); return $form; } } <?php namespace ProcessWire; class ChildModule extends ParentModule { public static function getModuleInfo() { return [ 'title' => 'ChildModule', 'version' => 1 ]; } public function __construct() { parent::__construct(); bd($this->getApiUser()); bd($this->wire()->modules->getModuleConfigData('ParentModule')); } } Take a look at the construct method of ChildModule. Without calling parent::__construct you will not be able to get what you want. Also you can use $this->wire()->modules->getModuleConfigData('ParentModule') to get config data of module.
  14. Hi @prestoav Try to output this https://processwire.com/api/ref/session/get-all/
  15. Not sure, but probably getFresh method is applicable in such a case. https://processwire.com/api/ref/pages/get-fresh/
  16. https://processwire.com/docs/modules/hooks/#how-can-i-add-a-new-method-via-a-hook
  17. Hi @theoretic You are adding a property via hook instead of method https://processwire.com/api/ref/wire/add-hook-method/
  18. There is no built-in functionality. The simplest way is to create addtional fields like 'page_views' and 'page_popularity', then populate these fields inthe desirerable way and use them in your selectors like pages('template=post, sort=-page_views');
  19. Why just not create a text field like 'externa_id' and then check it while import like foreach ($import_records as $import_record) { $exists = $this->wire()->pages->has("template=some-template, external_id=" . $import_record['unique_id']); if($exists) { // update } else { // create a new page } }
  20. Hi @swissdoode . Take a look at Inputfields.js file, there are many methods that you could find helpfull https://github.com/processwire/processwire/blob/dev/wire/templates-admin/scripts/inputfields.js#L37
  21. Hi @toni. Process modules is intended to be used in admin and they are not autoloaded, so for such hook you can create an satelite autoload module or put this code to init.php file. class URLHooker extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'URLHooker', 'version' => '0.1', 'singular' => true, 'autoload' => true, 'requires' => [ 'YourProcessModule>=0.1' ], ); } public function init() { $this->wire()->addHook('/hello/world', function($event) { return 'Hello World'; }); } }
  22. Also take a look at ProcessHello module https://processwire.com/modules/process-hello/ https://processwire.com/blog/posts/pw-3.0.181-hello/ https://github.com/ryancramerdesign/ProcessHello
  23. https://github.com/processwire/processwire/blob/dev/wire/core/ProcessController.php#L388
  24. Hi @erikvanberkum It should return current langauge values without any additions to the code, so make sure that you made translations in field configuration.
  25. Hi. Is there a way to find pages by $page->meta data? Thanks.
  • Create New...