Jump to content

dragan

Members
  • Posts

    2,007
  • Joined

  • Last visited

  • Days Won

    21

Everything posted by dragan

  1. I strongly disagree. An empty string is useless. (maybe "correct" in a strictly SQL / theoretical / technical view, but not in the context discussed here) It's funny that * returns empty string, but ? or ! return ""?"" and ""!"". I'm really surprised (knowing how important security is for @ryan). Does that mean that a malicious attacker could potentially bring a server to its knees by searching with wildcard automatically x times per second?
  2. I found some other strange stuff (only tested in Tracy): $q = "*"; $query = $sanitizer->selectorValue($q); $pgs = $pages->find("parent=1041, include=all, vertec|title|name|remarks%=$query"); d($pgs); This returns everything. Every single page inside parent id 1041. ! returns a seemingly random amount of results (74 out of 1061) - completely wrong. ? does the same, but returns 73 instead of 74. So, I guess you'd have to manually sanitize the query yourself: Check if minimum string length is 3. Remove charactes such as ! & *. And of course, make it a habit to narrow results down (according to template, parent, not in trash, etc.). I would expect PW to throw some sort of error if a search string is less than 3 characters. Maybe the results may differ if I actually used it in a template (outside Tracy) and not logged in as superuser, or with debug off. But still, this behavior truly puzzles me.
  3. https://adrianbj.github.io/TracyDebugger/#/debug-methods?id=dump In case you haven't installed Tracy Debugger yet, you should do it NOW ?
  4. First of all thanks for the nice write-up and congrats to your re-launch. I'm curious: If you install a sub-directory into a WP site, or let's say just a .php file at WP root, it can't be accessed due to WP's own redirect (.htaccess) rules. Did you have to add some .htaccess exception for this? There are two modules out there. They seem to be quite old, but did you consider using one of them anyway? I agree that an "out-of-the-box" solution would of course be preferrable. Feel free to add this feature to the wishlist / roadmap list (if it isn't there already).
  5. Are you aware that you can fully rewrite the UIKit admin theme? Just copy the wire/modules/AdminThemeUikit folder to site/modules/. The next time you load a page in the backend, PW will ask you which version you'd like to use. You can even choose if you'd like to use SASS or LESS, iirc. If that's overkill for you, you can just override paddings and margins if you write / load an extra admin.css. But the first thing you should consider, is to simply configure the admin theme via GUI @ site/backend/module/edit?name=AdminThemeUikit&collapse_info=1 And of course, PW lets you define borders, paddings, margins and background-colors on a per-field basis.
  6. I had to do something similar once. Here's something you might try as a starting point. A hook in site/ready.php : if ($this->page->template == 'admin') { $this->addHookBefore('Pages::saveReady', function(HookEvent $event) { $form = $event->object; $page = $event->arguments(0); $user = wire('user'); if($page->template == "basic-page"){ $summary = $page->summary; $languages = wire('languages'); // see wire/core/InputfieldWrapper.php $item_error = "<p class='InputfieldError ui-state-error'><i class='fa fa-fw fa-flash'></i><span>{out}</span></p>"; $js = "<script>$(\"wrap_Inputfield_summary div.InputfieldContent.uk-form-controls.langTabsContainer\").append(\"$item_error\");</script>"; foreach($languages as $language) { if($language->isDefault()) continue; $user->language = $language; $langName = $language->name; if(strlen($summary)<50) { $form->error("Summary in $langName is too short!"); // regular error message at the top } } } $event->return = str_replace("</body>", "$js</body>", $event->return); // flash error msg on the field }); } (Adjust template and field name of course) This will still let the page save, and only display a red error msg on top, not the actual "required field error". I have no idea how PW does that.. I'd have to dig around in the core files, but no time atm... Of course it would also be nicer if the actual error message would be displayed in the user's language (d'oh)...
  7. What do you need this for? Is it just for the backend, i.e. what you see in the page tree? If that's the purpose of your hook, you could use custom page list titles. There's a core method for that in advanced mode, and several modules.
  8. $selector = "template=expertsItem, location=$location, department=$department, id!=2131, sort=expertSurname"; ? or if you're trying to exlude the page you're on, you can use id!=page.id
  9. Seems like you have to install this permission first: https://processwire.com/blog/posts/processwire-2.6.15-makes-the-permissions-system-a-whole-lot-better/ (it's optional). https://processwire.com/docs/user-access/permissions/#page-hide It's under site.com/backend/access/permissions/add/ -> show system permissions
  10. try this .uk-slider-items li { display: table; }
  11. There are roughly three types of ("official") templating strategies in PW: Direct output (php echo everything immediately) Delayed output (what you seem to be using, i.e. output var $content just once) Markup regions If you really are using delayed output, you would have to rewrite this, e.g. like $src = $page->header->first()->url; $alt = $page->header->first()->description; $content .= "<img src=\"$src\" alt=\"$alt\" /> Your header most likely comes before the main content (body), so you just have to figure out where to insert the above code. It may not be in the basic-page template file, but somewhere else. Note that $var = 'foo' will override anything else that came before, i.e. if you defined $content = 'your-header-code' before, $page->body will completely reset your $content variable, not append to it.
  12. @ryan Don't know if you have noticed it: The developer map is broken (lots of JS errors). Did that break after the redesign?
  13. Try upgrading Tracy. There's just one other forum thread where the same error message appears. According to @adrian's reply, it could also be because you're using serialize() somewhere in your code.
  14. uhm... your site is super-fast. You get 100 with Lighthouse performance audit. TTFB is a mere 30ms. Perhaps test it in incognito mode - maybe caching is off when you're logged in as superuser?
  15. Not sure, but maybe sub-selectors or / and owner selectors may help: https://processwire.com/blog/posts/processwire-3.0.95-core-updates/ https://processwire.com/docs/selectors/#sub-selectors
  16. afaik no, but you could use a repeater instead.
  17. dragan

    useful styles

    I fixed this for you ? tbh though, people were using Modernizr for years, and still use polyfills and whatnot, that bloats the HTML tag with countless pseudo classes, just so the tools know if their polyfill function should do anything this way or another. And with tools like Angular, Vue or React, you have inline crap all over the place... ng-this, ng-that, CSS written in JS(X) etc.
  18. I guess that should be 2048: http://cheatsheet.processwire.com/page/page-status/page-statusunpublished-2048/ Sure about that? I thought you only get unpublished pages with find() if you add include=all to the selector.
  19. @gregory Please don't post the same question twice. You asked the same question here as well...
  20. Not sure you can change that. But you can use the default "Find" Lister for that?
  21. Probably a server timeout. Did you check your Apache or PW logs? If FTP is an option, you could try using https://modules.processwire.com/modules/process-admin-actions/ There's a handy "FTP to pages" action you could try.
  22. I don't really understand the purpose of those two pages (or the whole setup, according to your description). Care to explain what these are used for? Do you really mean container2/ or user-n/container2/ ?
  23. This has appeared several times in the forum already. This screenshot shows what + where you have to define the locale.
  24. @wbmnfktr YES. That one. Rote Fabrik. Good times. Oh, and I just discovered another BBC 6 Music Iggy episode today via Twitter: https://www.bbc.co.uk/sounds/play/m0004d2m I love how Iggy doesn't care about time and space and genres. It's either "the good kind, or the other kind", to paraphrase Duke once more...
×
×
  • Create New...