Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/16/2019 in all areas

  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
    6 points
  2. 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 points
  3. Works like a charm! Thank you for this! And also, I want to thank every one for motivating me to write hooks and seeing how practical and easy they're to make! ?
    5 points
  4. $wire->addHookAfter('ProcessPageEdit::buildForm', function($event) { $page = $event->object->getPage(); if($page->template != 'home') return; // example if($page->isUnpublished()) return; $form = $event->arguments(0); $field = $form->getChildByName('title'); // example $field->collapsed = Inputfield::collapsedNoLocked; }); ?
    5 points
  5. PageHitCounter Version 1.2.4 Thanks to @wbmnfktr for reporting the issues. And thanks to @Sergio for the corrections. Both issues have been fixed in version 1.2.4 and the corrections have been applied. Changelog as always updated in the first post. Explanations of the bugs below. The functionality has always been and is correct. The module sends the data to a fictitious endpoint of the current page. Then the module hooked in before a 404 is triggered and writes the data. The problem here was that the module "Jumplinks" had a lower priority than PageHitCounter. Therefore the request was logged as 404, because jumplinks were executed earlier. Now fixed, PageHits are not logged as 404, regular 404s will be. Here was the problem that system templates or pages are excluded in the normal search, without the selector "include=all". This is now included by default. Oh, my gosh, there were a lot of typos in there. So if you have a lot on your mind what you're going to code next, you don't look at the comments. Anyway, many thanks for the corrections! And by the way, I'd love to. Take the code and build something new out of it! ?
    4 points
  6. The family centre in Furtwangen, Germany, is an association of three Catholic day-care centres. Among them are the kindergartens Maria Goretti and St. Martin as well as the children's house St. Elisabeth. The navigation of the website captivates by a clear structure, which is thought from the point of view of the site visitors. The structure and the color-separated areas make it easy for visitors to enter the site. The color palette used for this is derived from the logo and gives the site a playful and friendly appearance. In the background, large-format pictures give a first impression and create an authentic atmosphere. For announcements there is a news ticker on which events, news or job offers can be advertised. www.familienzentrum-furtwangen.de Features: Navigation News ticker Navigation The navigation is separated in areas for visitors or parents and has an automatically generated color palette with ten different colors from the logo. Links can be references to existing pages to resuse informations without having duplicate content. News ticker The news ticker can contain downloads, links or text and is a fixed part of the navigation. Modules used: Cookie Management Banner Front-End Page Editor Markup Sitemap XML ProCache Repeater Matrix Tracy Debugger Upgrades Regards, Andreas
    3 points
  7. Well... me neither. I'd also prefer to have one common and stable solution, so if you are now willing to accept those changes (I also read the thread again and was confused by my own explanations sometimes. One point was misleading (that I was requesting to place the files in the module's folder which would break on every update, of course) and it's always a little hard to have such conversations via internen + non-native language ? ) I'll try to send a PR for your module as soon as I start working on the related modules!
    3 points
  8. Can you share a bit more details on how data is handled. E.g. what happens if I change a field or even remove it.
    2 points
  9. $page->find()start from $page if $page != home { $page->find( 'parnet=/blog/' ) will.alwayse return NO things } so >>> u.must use $pages->find() noT $page->find() !! OAR u can.uses $pages->get('/blog/')->children( 'limit=3, include=all' ) if usesing $pages say shits bout array it mean yoU write-over it some where >>> u did a $pages = array some.where ! fix that.or u can uses wire( 'pages ')->find(' you.selectoro stuff here '); or functiones api pages()->find( 'selectros in this' ) amen
    2 points
  10. Be careful here @Autofahrn and @psy. @VeiJari is talking about init.php and not _init.php. init.php ready.php finished.php Just to keep this in mind. https://processwire.com/blog/posts/processwire-2.6.7-core-updates-and-more/
    2 points
  11. Thank you @Wanze for this great module. Only one thing to mention: From the point of security it is not recommended to add the generator metatag (or any other information to help hackers to know something about the system). So it would be great to add a setting checkbox to disable the rendering of this metatag. I know I can render each metatag separately but using your render method ($page->seo->render()) would be much more comfortable ?. Best regards Jürgen
    1 point
  12. If that's indeed the case: To avoid this, in your pageref field definition, use "selectable pages" > "selector string" and then insert this condition: id!=page.id to avoid references to itself.
    1 point
  13. Is planet_reference of page 1018 pointing to itself? BTW: Use dump() or the shorthand d() better than echo in the console ?
    1 point
  14. Wow. It's 2019 and people are still using this? @neonwired please read this: https://stackoverflow.com/a/1293130
    1 point
  15. Is this field set up to only accept one image or multiple? And what did you define in the output settings? (single image or multiple, string or array) You would use this if you only allow one single image. But in your screenshot I see multiple images. In that case, you would rather use something like $page->headimage->first()->url to get the first image only.
    1 point
  16. Hi @Manuel and welcome to PW and the forum ? I don't see anything strange here. Could you paste the whole code? Are you sure you don't have any endless loop somewhere? I'd also recommend that you install TracyDebugger - you can try snippets like the one posted above easily in the console: https://adrianbj.github.io/TracyDebugger/#/debug-bar?id=console
    1 point
  17. Hi @Robin S I've just tried your example, because I'm always using ProcessPageEdit::buildForm for such things. In my case your hook fires twice on a regular page edit and three times on an multilang field with two languages... Any reason why you are using Field::getInputfield and not ProcessPageEdit::buildForm like in this example that I've just posted:
    1 point
  18. Actually, I just tried out your code, but got this error: Exception: Call to a member function add() on boolean on line: 13 line 13 is $selected_page->page_field_b->add($p); o_O
    1 point
  19. Nice use of AJAX. Speeds up page loading to nearly instantly.
    1 point
  20. Windows 10 with Brave (Version 0.62.51 Chromium: 73.0.3683.103 (Official Build) (64-bit)) and Chrome (Version 73.0.3683.103 (Offizieller Build) (64-Bit)). It works in Firefox (66.0.3 (64-Bit)) and EDGE (latest).
    1 point
  21. You are probably looking for the "collapsed" field and its constants. (collapsedNoLocked to be precise)
    1 point
  22. I was actually talking about /site/templates/_init.php, but after reading the difference of /site/init.php and /site/templates/_init.php, I decided to include psys' solution to site/init.php. Thank you for this!
    1 point
  23. I really like the side by side layout for content and nav. I imagine it being a great solution to cut unnecessary cost in catering to smaller screens and larger screens with different layouts.
    1 point
  24. https://github.com/processwire/processwire-requests/issues/297
    1 point
  25. Indeed, I don't see a way either. Would be nice to have this as configuration option in the module. Maybe we should file a request to https://github.com/processwire/processwire-requests ?
    1 point
  26. For now, I added a $post_date (datetime) field on journal-entry and created pages normally with a title. It actually works ok, I sort the index page children by $post_date and happy enough for the moment. Thanks everyone.
    1 point
  27. Looks very cool, @ukyo! Thanks for that, but the font-size on the video was hard on my eyes. ?
    1 point
  28. Hi all, Sorry, I'm late to the party! Interesting conversation here. I am not a fan of duplicating modules, if what they offer are very similar. I would prefer to try a PR in the first instance :-). Interestingly, the other day when @adrian was reporting some issues with the module and suggesting changes, I had a rethink about your suggestions and decided it was worthwhile going with your suggestions, especially the auto include. I didn't mention it since I didn't have the time then to work on the module. So, my take is, we can improve the existing module, with new features and/or hooks. All PRs will be duly credited. I suggest we try that first. That's my opinion :-).
    1 point
  29. Well who knows! The devil is in the detail. And I do agree the javascript events would be a powerful enough reason. I also remember reading that conversation a while ago and do agree on your points. Particularly the "auto include" of files, pretty much like the modules.
    1 point
  30. Hi @elabx, thx for asking ? Well, one (crucial) thing would be the javascript events. Maybe that could be added to kongondo's module, that's why I was asking for his opinion. Besides that I don't like how his module works (I'm picky, I know). We had some discussion about it (https://processwire.com/talk/topic/10804-module-runtimemarkup-fieldtype-inputfield/?do=findComment&comment=148083). And it was simply easier to have things under my control than modifying his version with custom hooks. But yeah.. It might not be necessary to have another module for this ?
    1 point
  31. Unfortunately, this isn't built in as a feature, but I'm thinking the non-capture feature might work for you. Not tested, but try using <[-]{1}[\d*]> at the end of the source. Thanks Peter – I recall wanting to do this for v2, where you choose how many you'd like to retain in the log. I think I'm gonna need to find some time to finish v2. Will likely need to make a few changes here and there (not up to speed with all the new core-dev) before I proceed with the frontend work that's still due.
    1 point
  32. Hey @ryan, great update! I wonder if the new CacheRender function can also be used for repeaters or repeater matrix items? Like this: foreach($page->repeater_field as $item) { echo $cache->renderFile($item->render(), WireCache::expireSave); } It would be great, especially with a lot of repeater items and outsourced render files the rendering can take a few seconds.
    1 point
  33. Good pick-up @wbmnfktr! /site/init.php is different to /site/templates/_init.php I guess the custom of using ready.php is that by that time, PW knows about the current page which in this case, is referenced in the hook.
    1 point
  34. I'm curious, how would your module be different from FieldtypeRuntimeMarkup?
    1 point
  35. Hey @WillyC, nice to read from you again. (Long time no see.) ?
    1 point
  36. Sure, init.php runs before ready.php as well, but thanks for the link, which explains this more precisely:
    1 point
  37. Hi @VeiJari It's usual practice, but not compulsory, to put hooks into /site/ready.php. site/ready.php loads before _init.php. You're changing the saved page data so you may need to turn off outputting formatting first if saving the entire page, or simply set-and-save the 'ajasta' field, eg (untested): wire()->addHookAfter('Pages::published', function($event) { $page = $event->arguments('page'); $t = wire()->templates->get($page->template); if($t->name == 'artikkeli' && $t->hasField("ajasta") { $page->setAndSave('ajasta', 0); } $event->return = $page; });
    1 point
  38. @titanium - this used to work as expected - ie these pages could not be found via the search. I just took a look and it appears that relatively recent changes to this live search feature means that now other results are returned, but note that the links from these results go to view the returned pages, rather than allowing the user to edit them. So I think the main functionality has not been compromised. Remember that this module is not designed to control view permissions, just editing.
    1 point
  39. For some inputfield visibility constants it is too late to set them at inputfield render. For Inputfield::collapsedHidden, Inputfield::collapsedNoLocked and Inputfield::collapsedYesLocked these are handled by the InputfieldWrapper class. I've found that a good method to hook for setting the visibility of fields in Page Edit is Field::getInputfield. This example is for /site/ready.php but easy to adapt to a module context: $wire->addHookAfter('Field::getInputfield', function(HookEvent $event) { // Only for ProcessPageEdit if($this->page->process !== 'ProcessPageEdit') return; $field = $event->object; $inputfield = $event->return; if($field->name == 'proj_code_folder') { $inputfield->collapsed = Inputfield::collapsedNoLocked; } });
    1 point
  40. You are not using a PW selector. This needs to be in PHP syntax: if($page->template->name == 'home'|| $page->template->name == 'project' || $page->template->name == 'projects' || $page->template->name == 'posts' || $page->template->name == 'partners'){ But maybe instead you could see if the $page->sidebar actually exists. Maybe that won't work in your scenario, but thought I should mention it just in case.
    1 point
×
×
  • Create New...