-
Posts
113 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Clarity
-
Thank you very much!
-
Thank you, it indeed works. Thank you, but the select option values are still being stored as a string and $integer is already an int and doesn't need conversion.
-
Hello everyone! I have SelectOptions field which is supposed to contain integer values for the purpose of using them in selector and compare with other integer values like this: $pages->find('select_options.value>' . $integer) For example, I have SelectOptions like this: 1=5|title1 2=20|title2 3=40|title3 4=60|title4 5=85|title5 So I get that values are being strings and I can't compare them with some other value. Can you please tell me how to handle it if it is possible with SelectOptions?
-
How to sort pages by specific template names preserving pagination?
Clarity replied to Clarity's topic in API & Templates
Thank you, it indeed works! -
Hello everyone! I have a paginated PageArray and I need to sort the results first by template1, then by template2 and template3 (in any order inside 2 and 3). Then by other templates by any order. Can you please tell me how to do it? The solution might look something like: $pages->find('sort=(template=template1,template=template2|template3),...');
-
How to recursively close sub-pages in page tree?
Clarity replied to Clarity's topic in General Support
Also, the behavior in both Chrome and Firefox: - First click reduces tree only to immediate children of home. - Second click reduces tree only to home page. But third click differs: it expands tree to immediate children in Chrome and to full previously open tree in Firefox. -
How to recursively close sub-pages in page tree?
Clarity replied to Clarity's topic in General Support
@wbmnfktr, thank you, it indeed works. -
Hello everyone! In VS Code (or maybe in other IDE) by default Alt+Click on folder recursively closes tree of sub-folders if you open too many sub-folders and want to close them simultaneously. I've checked ProcessPageList.js, function clickChild(e) but haven't found a code which allows to do it for some shortcut. Can you please tell me if it is possible anyways?
-
Hello everyone! Recently I needed to construct a table using divs only: HTML: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Border</title> <link rel="stylesheet" href="css/style.css"> </head> <body> <div class="cards"> <div class="cards__item"></div> <div class="cards__item"></div> <div class="cards__item"></div> <div class="cards__item"></div> <div class="cards__item"></div> <div class="cards__item"></div> <div class="cards__item"></div> <div class="cards__item"></div> </div> </body> </html> CSS: .cards { display: flex; width: 150px; flex-wrap: wrap; } .cards__item { border: 1px solid black; flex: 0 1 32%; width: 50px; height: 50px; } The problem which I ran into is that borders are being doubled: Then I wrote to CSS the margin: .cards__item { border: 1px solid black; margin: -1px -1px 0 0; flex: 0 1 32%; width: 50px; height: 50px; } Now the double borders disappear: However, the issue in this solution is that there is a small (1px) margin to the right of table. Can you please tell me how I can do something better for this?
-
@gebeer, thank you for improving my scripts. I've updated them. Also my previous version of this script finds pages in repeaters which is not an intended behavior.
-
@bernhard, yes, of course. I've added screenshots.
-
Hello everyone! Recently I wrote these scripts for TracyDebugger console in order to make work with RepeaterMatrix easier and faster. I want to present them to the community. Show relationship between all types, names and labels. $repeaterMatrixModule = $modules->get('FieldtypeRepeaterMatrix'); $fieldName = 'content_blocks'; $repeaterMatrixField = $fields->get($fieldName); $typesArray = []; foreach($repeaterMatrixModule->getMatrixTypes() as $matrixName => $matrixType) { $typesArray[$matrixName] = $matrixType . ' ' . $repeaterMatrixModule->getMatrixTypeLabel($matrixType, $repeaterMatrixField); } db($typesArray); Show all pages which have specific type in field (repeater_matrix) with this name: $repeaterMatrixModule = $modules->get('FieldtypeRepeaterMatrix'); $typeName = 'block_text'; $fieldName = 'content_blocks'; $repeaterMatrixField = $fields->get($fieldName); $typeId = $repeaterMatrixModule->getMatrixTypeByName($typeName, $repeaterMatrixField); $typeLabel = $repeaterMatrixModule->getMatrixTypeLabel($typeId, $repeaterMatrixField); $pagesWithType = $pages->find("{$fieldName}.type={$typeName}"); db($pagesWithType); db($typeLabel, 'Name of type'); This list can be continued as soon as I'll invent more scripts.
-
Hello everyone! I'm using TinyMCE module and I want to insert a table to the page. However, I don't need an attribute "border" to be automatically appended to the table. Can you please tell me how to get rid of this in a proper way?
-
Thank you! I already did it. My code was the following (in search view): <?php if($q = $sanitizer->selectorValue($input->get('q'))): ?> <?php if($pages->find('search_index%=' . $q)->count): ?> <?= $searchEngine->renderResults() ?> <?php else: ?> <?= $searchEngine->renderResults([], $searchEngine->find(Utils::handleSearch($q))) ?> <?php endif; ?> <?php endif; ?> I check first if there are search results in normal keyboard layout and then invert keyboard layout using Utils::handleSearch() method if there aren't any results.
-
Hello, @BrendonKoz! I need to change the erroneous keyboard layout after user performs the search. For example, I wrote 'ghbdtn' and that's supposed to be 'привет' (hello) on Russian. The code shown by the link is not similar to what I have. I'm using the following code ($searchEngine is a variable which contains the module): <head> ... <?= $searchEngine->renderStyles() ?> <?= $searchEngine->renderScripts() ?> ... </head> <body> ... <?= $searchEngine->renderForm() ?> ... <?= $searchEngine->renderResults() ?> ... </body>
-
Hello, @teppo and everyone! Can you please tell me how to modify the query during search?
-
Hello everyone! I'm using "use" statement in controller like this: <?php namespace Wireframe\Component\MyComponent; use Wireframe\Lib\Utils; class MyComponent extends \Wireframe\Component { ... } Then it works in component view iff I write use Wireframe\Lib\Utils; in component view, otherwise I get an error: Class "ProcessWire\Utils" not found. Can you please tell me if it is possible to use utility class in component view if it is explicitly used only in component controller?
-
Hello everyone and @kongondo! Can you please tell me how to create a dynamic menu using your module? Where URLs of pages are relative not to a whole site, but to every page where we use this menu.
-
How to save a page after other page becomes hidden?
Clarity replied to Clarity's topic in General Support
Thank you, it works! -
Hello everyone! Can you please tell me how to save a page after other page becomes hidden? Something like: $wire->addHookAfter('Pages::hide', function($event) { if(wire()->page->id == $event->arguments('page')->id) { wire()->pages->find('selector for page')->save(); } }); But Pages::hide won't work because class Pages doesn't have such a method. Which method of which class should I use?
-
Hello everyone and @ukyo! Can you please tell me how to deal with this error? Argument 1 passed to ProcessWire\FieldtypeMystique::loadResource() must be of the type string, null given, called in /home/i/ivangr/tverkurort.ru/public_html/site/modules/Mystique/InputfieldMystique.module.php on line 175. My Mystique code is: <?php namespace ProcessWire; return function ($page = null, $field = null, $value = null) { ... };
-
How to exclude hidden repeater fields via API?
Clarity replied to Clarity's topic in API & Templates
Thank you, it works! -
Hello everyone! Can you please tell me how to exclude hidden repeater fields via API? E.g. something like $page->repeater->find('exclude=hidden').