Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by ukyo

  1. I am using this module for SEO, LANGUAGE and ELEMENTS (uikit components) USAGE EXAMPLE : LANGUAGE On my private module, i added my custom configs path to Mystique module by using : Mystique::add('my-module-configs-path'); - Create config file <?php namespace ProcessWire; // Filename: MyModule/configs/Mystique.language.php // This options normally coming from a file array, i added 2 options for example $options = [ 'tr' => 'Türkçe', 'en' => 'English' ]; $defaultValue = 'en'; /** * Resource : MyModule => Language */ return [ 'title' => __('MyModule: Language'), 'fields' => [ 'title' => [ 'label' => __('Language title'), 'description' => __('Title of language'), 'type' => Mystique::TEXT, 'columnWidth' => 50 ], 'code' => [ 'label' => __('Code'), 'description' => __('Language short code'), 'type' => Mystique::SELECT, 'options' => $options, 'defaultValue' => $defaultValue, 'required' => true, 'columnWidth' => 50 ], 'flag' => [ 'label' => __('Flag'), 'description' => __('Language flag code'), 'type' => Mystique::TEXT, 'columnWidth' => 50 ], 'direction' => [ 'label' => __('Direction'), 'checkboxLabel' => __('Right to left'), 'description' => __('Direction of language'), 'type' => Mystique::TOGGLE_CHECKBOX, 'type_fallback' => Mystique::CHECKBOX, 'columnWidth' => 50 ], 'currency' => [ 'label' => __('Currency'), 'description' => __('Code of currency'), 'type' => Mystique::TEXT, 'columnWidth' => 50 ], 'symbol' => [ 'label' => __('Symbol'), 'description' => __('Symbol of currency'), 'type' => Mystique::TEXT, 'columnWidth' => 50 ], 'grouping_separator' => [ 'label' => __('Grouping separator'), 'description' => __('Thousand separator for amount'), 'type' => Mystique::TEXT, 'columnWidth' => 50 ], 'decimal_separator' => [ 'label' => __('Decimal separator'), 'description' => __('Decimal separator for amount'), 'type' => Mystique::TEXT, 'columnWidth' => 50 ], 'separator' => [ 'label' => __('Use separator'), 'checkboxLabel' => __('YES'), 'description' => __('Apply space between amount and currency symbol ?'), 'type' => Mystique::TOGGLE_CHECKBOX, 'type_fallback' => Mystique::CHECKBOX, 'columnWidth' => 33 ], 'show_decimal' => [ 'label' => __('Decimal'), 'checkboxLabel' => __('YES'), 'description' => __('Show amount decimals ?'), 'type' => Mystique::TOGGLE_CHECKBOX, 'type_fallback' => Mystique::CHECKBOX, 'columnWidth' => 33 ], 'symbol_after' => [ 'label' => __('Symbol after'), 'checkboxLabel' => __('YES'), 'description' => __('Display symbol after amount ?'), 'type' => Mystique::TOGGLE_CHECKBOX, 'type_fallback' => Mystique::CHECKBOX, 'columnWidth' => 33 ], ] ]; - Select config file from Mystique field settings - Add Mystique field to language template Access data via api (in this example mystique field name is : lang) <?php $language = $user->language; // lang is Mystique field echo 'Title : ' . $language->lang->title . '<br>'; echo 'Code : ' . $language->lang->code . '<br>'; echo 'Flag : ' . $language->lang->flag . '<br>'; echo 'Direction : ' . $language->lang->direction . '<br>'; echo 'Currency : ' . $language->lang->currency . '<br>'; echo 'Symbol : ' . $language->lang->symbol . '<br>'; echo 'Grouping separator : ' . $language->lang->grouping_separator . '<br>'; echo 'Decimal separator : ' . $language->lang->decimal_separator . '<br>'; echo 'Separator between amount and symbol : ' . $language->lang->separator . '<br>'; echo 'Show decimal : ' . $language->lang->show_decimal . '<br>'; echo 'Show symbol after amount : ' . $language->lang->symbol_after . '<br>'; Output: Title : English Code : en Flag : gb Direction : 0 Currency : GBP Symbol : £ Grouping separator : , Decimal separator : . Separator between amount and symbol : 1 Show decimal : 1 Show symbol after amount : 0
  2. Keep the field name same, do what you want. Because all data on database in string format (i am not checking user posted data), you can set field settings by using processwire fields api and you can limit user by settings. Hook methods could be used for custom usages.
  3. @BitPoet will check it, but i don't want to limit user's database options and if you need an important searchable field i am not advising to use this field, use a fully searchable field. @LostKobrakai I will add more details on readme.md file and will update this post and module page. About your question : as you see on youtube video, updating fields config file will update data entry form for admin page. If you remove field, you won't see this field on admin pages anymore. I am not caching your configs, always trying to get configs from selected config files.
  4. Mystique Module for ProcessWire CMS/CMF Github repo : https://github.com/trk/Mystique Mystique module allow you to create dynamic fields and store dynamic fields data on database by using a config file. Requirements ProcessWire 3.0 or newer PHP 7.0 or newer FieldtypeMystique InputfieldMystique Installation Install the module from the modules directory: Via Composer: composer require trk/mystique Via git clone: cd your-processwire-project-folder/ cd site/modules/ git clone https://github.com/trk/Mystique.git Module in live reaction with your Mystique config file This mean if you remove a field from your config file, field will be removed from edit screen. As you see on youtube video. Using Mystique with your module or use different configs path, autoload need to be true for modules Default configs path is site/templates/configs/, and your config file name need to start with Mystique. and need to end with .php extension. Adding custom path not supporting anymore ! // Add your custom path inside your module class`init` function, didn't tested outside public function init() { $path = __DIR__ . DIRECTORY_SEPARATOR . 'configs' . DIRECTORY_SEPARATOR; Mystique::add($path); } Mystique module will search site/modules/**/configs/Mystique.*.php and site/templates/Mystique.*.php paths for Mystique config files. All config files need to return a PHP ARRAY like examples. Usage almost same with ProcessWire Inputfield Api, only difference is set and showIf usage like on example. <?php namespace ProcessWire; /** * Resource : testing-mystique */ return [ 'title' => __('Testing Mystique'), 'fields' => [ 'text_field' => [ 'label' => __('You can use short named types'), 'description' => __('In file showIf working like example'), 'notes' => __('Also you can use $input->set() method'), 'type' => 'text', 'showIf' => [ 'another_text' => "=''" ], 'set' => [ 'showCount' => InputfieldText::showCountChars, 'maxlength' => 255 ], 'attr' => [ 'attr-foo' => 'bar', 'attr-bar' => 'foo' ] ], 'another_text' => [ 'label' => __('Another text field (default type is text)') ] ] ]; Example: site/templates/configs/Mystique.seo-fields.php <?php namespace ProcessWire; /** * Resource : seo-fields */ return [ 'title' => __('Seo fields'), 'fields' => [ 'window_title' => [ 'label' => __('Window title'), 'type' => Mystique::TEXT, // or InputfieldText 'useLanguages' => true, 'attr' => [ 'placeholder' => __('Enter a window title') ] ], 'navigation_title' => [ 'label' => __('Navigation title'), 'type' => Mystique::TEXT, // or InputfieldText 'useLanguages' => true, 'showIf' => [ 'window_title' => "!=''" ], 'attr' => [ 'placeholder' => __('Enter a navigation title') ] ], 'description' => [ 'label' => __('Description for search engines'), 'type' => Mystique::TEXTAREA, 'useLanguages' => true ], 'page_tpye' => [ 'label' => __('Type'), 'type' => Mystique::SELECT, 'options' => [ 'basic' => __('Basic page'), 'gallery' => __('Gallery'), 'blog' => __('Blog') ] ], 'show_on_nav' => [ 'label' => __('Display this page on navigation'), 'type' => Mystique::CHECKBOX ] ] ]; Searching data on Mystique field is limited. Because, Mystique saving data to database in json format. When you make search for Mystique field, operator not important. Operator will be changed with %= operator. Search example $navigationPages = pages()->find('my_mystique_field.show_on_nav=1'); $navigationPages = pages()->find('my_mystique_field.page_tpye=gallery');
  5. @SamC Here is a module about auto page naming, You can get idea about naming pages automatically from source code, https://gitlab.com/baumrock/RandomPageName/blob/master/RandomPageName.module
  6. @Gadgetto I have a module but didn't add it to module directory https://github.com/trk/FieldtypeToggle Module using : https://github.com/victornpb/vt-toggle Module only works with checkbox, will add support for radio, checkbox group and radio group. You can try it or you can continue with your solution.
  7. Updated PHPMailer to 6.0.5 Module setting singular: true Module setting autoload: true v.1.0.6 PHPMailer required PHP version is >=5.5.0 https://github.com/PHPMailer/PHPMailer/blob/master/composer.json#L22 I am using module with PHP 7.2.x and 7.1.x versions with multiple sites and didn't see issue like this. I hope module update will fix your problem.
  8. <?php if($image->width > $image->height) { echo "Width : `{$image->width}px` bigger than height : {$image->height}px !"; } else { echo "Height : `{$image->height}px` bigger than width : {$image->width}px !"; }
  9. Check this doc : https://processwire.com/api/arrays/
  10. Thanks for feedbacks !
  11. PHPMailer updated to v6, Module version updated to v1.0
  12. I updated WireMailPHPMailer module to PHPMailer v6. I will update WireMailPHPMailer support post. I have request for deletion of this topic and WirePHPMailer from module directory.
  13. I tested them long time ago, before i wrote my first Mail module and i think there is problem getting DKIM.
  14. I don't have any reason for not extending base WireMail class. This is why i updated module and now module extending bas WireMail class. Now you have 2 usage types: 1. Use directly PHPMailer class 2. Use extended send method For InputfieldHelper requirement, its easy to create configurable modules with this module and usable module for many cases, i won't remove requirement of this module. Like i mentioned, i am author of WireMailPHPMailer, i am not caring about module usage statics, if someone need PHPMailer module, they can use it. - I tested swift mailer module (smtp) - I tested base WireMail class (smtp) - I tested mailgun (curl) I am not prof. of mail sending but when i make simple mail send tests with same settings (mailgun not included), https://www.mail-tester.com/ test result not ok for me (problem with DKIM). My test result with PHPMailer 10/10, this is why i am using PHPMailer library with my modules.
  15. I am using it for different cases. For modules (everything from a config file) : I am not defining default values as you see here : https://github.com/trk/WirePHPMailer/blob/master/WirePHPMailer.module#L33 Getting module configs : https://github.com/trk/WirePHPMailer/blob/master/WirePHPMailer.module#L77 Settings default values : https://github.com/trk/WirePHPMailer/blob/master/WirePHPMailer.module#L78 Merging module values with defaults, building inputfields : https://github.com/trk/WirePHPMailer/blob/master/WirePHPMailer.module#L119 - Its easy to build configurable module for me, no need to set all things on different places. For creating form you can see simple example usage on README.md I am using it for creating dynamic fields for page templates on runtime by hooking ProcessPageEdit::buildForm. In screenshots Settings and General tabs added dynamically and fields inside these tabs added by a config file. Use case change up to you.
  16. InputfieldHelper for ProcessWire v3 Module Directory - Github repo This module extends base `ModuleConfig` class add some features to this class. This module creates Inputfields from array configs. I used this module for create module configuration panel for WirePHPMailer module. You can see configs here. Also you can use this module for create forms from array.You can check github repo for usage.
  17. PHPMailer for ProcessWire v3. Module Directory - Github repo I am author of WireMailPHPMailer. Old module using PHPMailer v5 and its extend WireMail base class. No more update will come for old version, but its still working :). This module using PHPMailer v6 and not extending WireMail base class. This module integrating the PHPMailer mailing library into ProcessWire v3. Usage almost same with original PHPMailer library (no need to include PHPMailer files). Here is a simple example usage : Using directly PHPMailer library $mail = wire("modules")->get("WirePHPMailer"); $mail = $mail->mailer(); $mail->addAddress("email@domain.ltd", "Someone"); $mail->isHTML(true); $mail->Subject = "WirePHPMailer"; $html = "<h1>WirePHPMailer</h1>"; $text = "WirePHPMailer"; $mail->Body = $html; $mail->AltBody = $text; $mail->send(); Using module like classic WireMail $mail = wire("modules")->get("WirePHPMailer"); $mail->from("from@domain.ltd") ->fromName("A From Name") ->to('email@domain.ltd') ->subject('A Message Subject') ->body('A Message Body') ->bodyHtml("<h1>A HTML Message Body") ->send(); Note : This module requires InputfieldHelper, PHP>=5.6.0, ProcessWire>=3.0.0 module.
  18. I opened an issue on github and have a question. Did you try this module with multi language support ? If page have multi language support what's happening on cache naming side ? When i work languages with cache, adding user language id as suffix to cache name.
  19. Try to use: $session->get('number'); or wire('session')->get('number'); // You can make a test function setMySession($key = '', $value = '') { wire('session')->set($key, $value); } setMySession('foo', 'bar'); echo $session->get('foo'); Here is doc page about sessions: https://processwire.com/api/ref/session/
  20. Info : Before pull AdminThemeUikit module to dev branch, check this https://github.com/uikit/uikit/issues/2998 issue fixed. I see this issue after update my forked AdminThemeUikit module uikit files and opened an issue on uikit repo.
  21. @tpr I don't want to use a TemplateEngine. My module meet my needs and i am ok. Thanks for your advice !
  22. I checked : https://processwire.com/blog/posts/processwire-3.0-alpha-2-and-2.6.22-rc1/#new-module-file-compiler-tags, Not allowing function calls, whats happening inside loop ? If i want to call item based tags. Its not meet my needs {pages(template=template-name):title} or {label(title)} or {description(title)} or {notes(title)}
  23. I missed : https://processwire.com/blog/posts/processwire-3.0-alpha-2-and-2.6.22-rc1/#new-module-file-compiler-tags I will check it. @adrian For directly working on templates you are right. I am using same method with you. I wrote this functional group for own my needs and want to share it with community. I am working on a module (Component system for uikit-2 and uikit-3). At this component system, you can change lots of things by configs. Let me explain you little, I hope you can understand me :). Each component have index.php for component configs and template.php file for view. Also you can extend, overwrite or add new component for site specific. I will use grid-list component as example. Here is index.php for configs. And here is template.php file for display. As you see above selected area, i am using processString() function for custom title and subtitle configs. Component call on template : <?= co::component($finder['items'], 'grid-list', [ 'subtitle' => '{page:length} {notes(length)} // {page:cabins} {notes(cabins)} // {page:render:destinations}' ]); ?> Result : Same component call on another template : <?= co::component($finder['items'], 'grid-list') ?> Result : For my component module, I can have 1 component and i can use it on all my sites with different settings and different display options. <?= // 1 more example with "alert" component co::c('alert', [ 'title' => 'You are in {page('title')}.', 'content' => 'You need to go <a href="{pages(1200):url}">{pages(1200):title}</a> for view our products', 'alert_style' => 'danger', 'alert_size' => true, 'alert_close' => true, 'text_align' => 'center' ]); ?> If you want you can call something inside body field.
  • Create New...