Jump to content

Clarity

Members
  • Posts

    98
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Clarity

  1. 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.
  2. 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>
  3. Hello, @teppo and everyone! Can you please tell me how to modify the query during search?
  4. 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?
  5. 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.
  6. 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?
  7. 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) { ... };
  8. Hello everyone! Can you please tell me how to exclude hidden repeater fields via API? E.g. something like $page->repeater->find('exclude=hidden').
  9. If I'll really need PageReference, I think I can use hook + JS which was mentioned in the topic above. However, I found that using PageReference for my needs is superfluous, I can simply use ->find() method instead.
  10. I found a solution: increased numPageLinks from 5 to 10.
  11. Hello everyone! I have an issue with MarkupPagerNav module. When I have 6 pages and stay on pages 1-4, the separatorItemLabel is being shown between 5 and 6 while it shouldn't. My options are following: $options = array( 'numPageLinks' => 5, 'nextItemLabel' => '>>', 'nextItemClass' => '', 'previousItemLabel' => '<<', 'previousItemClass' => '', 'lastItemClass' => '', 'currentItemClass' => 'active', 'separatorItemLabel' => '<span>&hellip;</span>', 'separatorItemClass' => '', 'listMarkup' => "<ul>{out}</ul>", 'itemMarkup' => "<li>{out}</li>", 'linkMarkup' => "<a href='{url}'>{out}</a>", 'currentLinkMarkup' => "<span class='current-page' href='{url}'>{out}</span>" ); Can you please tell me where I am wrong?
  12. Hello everyone! I have a PageReference field and I need to get a selector of resulting PageArray for the purpose of setting the limit of these pages in order to use it in the pagination. Can you please give me an advice?
  13. Hello everyone! I have a HTML code for the form: <form class="contact-form" action="/ajax-handler/" method="POST"> <input type="text" placeholder="Name"> <input type="text" placeholder="Phone"> <input type="text" placeholder="Message"> <button type="submit">Submit</button> </form> I have an JS code which handles it via AJAX request: $(function() { var form = $('.contact-form'); $(form).submit(function(e) { e.preventDefault(); var formData = $(form).serialize(); $.ajax({ type: 'POST', url: $(form).attr('action'), data: formData }) .done(function(response) { alert(1); }) }); }); However, when I open "Network" tab in Dev Tools, I see that the request goes to the same page where the form is being placed, not to /ajax-handler/ page. Can you please tell me where I was wrong?
  14. Hello everyone! Can you please tell me how to convert Pageimages collection to plain array?
  15. Yes, it works too. Thank you for the advice. Let me think about it. Thank you about the explanation. ? Thank you for the addition.
  16. Well, my code is like this: <?php namespace Wireframe\Controller; class Test extends \Wireframe\Controller { public function init() { $var = $this->foo(); $this->var = $this->foo(); $this->view->var = $this->foo(); bd($var); // 1 bd($this->var); // null bd($this->view->var); // 1 } public function foo() { return 1; } }
  17. Hello, @AndZyk! Yes, I think it might be the reason. Using $this->view in Wireframe instead of $this resolved my problem.
  18. Thank you, I already found that I can use additional single-valued Page Reference for my purposes.
  19. Sorry if I was unclear, but it's not quite what I want. I need all pages with this Page Reference and with given in the selector value of the first element of this Page Reference, not the first page with this Page Reference.
  20. Thank you, but can I actually use it in the selector string? I need to find the pages with specific Page Reference and access the first element of them, not simply get the first page of the collection.
  21. Hello everyone! Can you please say how is this situation really possible? 1) On some line of the code inside a class, I assign the value: $this->var = $this->foo(). 2) On the next line of this code, I compare these two and output to TracyDebugger: bd($this->var == $this->foo());, but it outputs false value (first is null and $this->foo() is a set of pages).
×
×
  • Create New...