Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Zeka last won the day on February 3

Zeka had the most liked content!

About Zeka

  • Birthday 04/12/1989

Profile Information

  • Gender
  • Location
    Kyiv, Ukraine

Recent Profile Visitors

4,172 profile views

Zeka's Achievements

Hero Member

Hero Member (6/6)




Community Answers

  1. 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/
  2. As an option https://processwire.com/blog/posts/pw-3.0.173/#telling-processwire-what-page-to-render
  3. https://github.com/processwire/processwire/blob/master/wire/config.php#L516
  4. 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]
  5. 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.
  6. Hi @prestoav Try to output this https://processwire.com/api/ref/session/get-all/
  7. Not sure, but probably getFresh method is applicable in such a case. https://processwire.com/api/ref/pages/get-fresh/
  8. https://processwire.com/docs/modules/hooks/#how-can-i-add-a-new-method-via-a-hook
  9. Hi @theoretic You are adding a property via hook instead of method https://processwire.com/api/ref/wire/add-hook-method/
  10. 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');
  11. 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 } }
  12. 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
  13. 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'; }); } }
  14. 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
  15. https://github.com/processwire/processwire/blob/dev/wire/core/ProcessController.php#L388
  • Create New...