Jump to content

BrendonKoz

Members
  • Posts

    227
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by BrendonKoz

  1. The "Thanks" trophy is nice in that it provides reputation points back to members, but aside from a little ego boosting, I don't think it has any terribly high value or merit -- with perhaps the exception of visually providing a means to let other visitors know what replies are worth reading carefully? The "mark as solution" feature is not enabled, or is at least hidden. I'm not sure why the email notifications are still worded that way, but you won't be able to find that button. 🙂
  2. I'm not finding the "Expect-CT" text coming up in a file search for my ProcessWire sites, nor did I get any results when I searched the ProcessWire GitHub repo. Do you have any 3rd party modules that might inject its own headers? I know you said that other CMSs aren't providing this warning, but have you tried your project on another server just to see if it's definitely PW and not the local development server? (My hunch would be a 3rd party module, but hard to know.)
  3. If your function is placed in ready.php or init.php, then you might have to use wire('page') to get the current page. Have you tried simply using the reserved $page variable to see what would happen? You can always use $pages->get(1) to get the default landing/homepage (or in this case, with the wire method, wire('pages')->get(1)). If the children of the standard ProcessWire homepage are your individual site's homepages, then break that logic out a bit more: <?php foreach wire('pages')->get(1)->children as $homepage) { if (!wire('page') == $homepage) { continue; // Skip to the next iteration of the loop } else { // Place your navigation generating code here, except if you use this, change $page in your code above to $homepage } }
  4. Ohhhhh. I wouldn't have thought to try that. Thanks for explaining, and with the GIFs too! ♥
  5. I've experienced it, and if I'm remembering correctly, it seemed to be related to either (only) a CSS issue, or a JavaScript call that wasn't applying the appropriate class(es) for CSS display. I looked into it for a bit, but since it was only unexpected and not preventing proper functionality I moved on since I never fully solved it. @monollonom Can you explain what you mean in more detail? I didn't quite understand (and am curious); gorny shows two fields (where one field has three options), but you mention three conditionally visible fields...?
  6. Don't forget that you can define/allow overrides for templates based on inputfield settings in the "Overrides" tab of the field. Then the template(s) can allow the override of those particular settings of the field. Alternatively, you don't have to think only about the template settings - you can edit the rendering of the PHP template and check what the current template is, and then render the image's size differently depending on the template. You have the control! 🙂 Image Inputfield Overrides:
  7. Speaking of Softaculous, the PW download page links to Bitnami and AMPSS, but Bitnami's apparently dropped support for PW (a broken integration connection somewhere?), and AMPSS, although likely still works since it's a desktop version of Softaculous, doesn't have a landing page for PW. Super pumped to see an across-the-board update of the Pro modules. I commend Ryan's project management abilities. Fighting off scope creep and staying on-task is a very difficult thing to do (at least for me) when solo-developing, so many compliments to you on that!
  8. Without looking at it directly, I'm pretty sure the default setting/configuration for TinyMCE is to wrap all content in paragraph tags. However it knows enough to not wrap a DIV element in a paragraph, thus it falls back to doing what you notice it does. There should be a way to either disable the automatic paragraph, and/or switch it for a DIV, if that's what you (will always?) want. IIRC both TinyMCE and CKEditor (v4) both do that.
  9. The httpUrl property/method will provide you with what you want, whether referring to a Page, PageImage, or PageFile object. The browser should the full URL when you hover in the status bar area simply because that's what it does, but you are correct in that you need to view source to verify what's being output in code. Typically you don't actually want to hardcode the full URL into the rendered code as it's a bit slower for the client (web visitor's browser) to negotiate the resource. If they're already on your domain, you just refer to the relative path of objects/pages/files on your domain; it's a tiny bit more efficient, and as you've already noticed, the browser automatically identifies/assumes the correct location anyway. If you're running a single website on multiple domains but want to redirect visitors to a specific domain, you could use redirects on the server instead of hardcoded domain-based links, but that doesn't mean you can't do what you're doing either. As for SEO benefits or detriments to this, aside from the speed hit, I'm not sure if there are any. If you plan to generate JSON-LD, Canonical URLs, XML Sitemaps, PDFs, or other potentially downloadable files from your content, that would be one area that could benefit from absolute URLs if you didn't want to do extra work, later on, to adjust the URLs on export. Ultimately though the choice is yours depending on context, needs, and desires - and ProcessWire provides you with that choice! $page->url or $page->httpUrl. To get the current website domain, you'd likely want either $input->httpHostUrl();, or $pages->get(1)->httpUrl; (or $pages->get('/')->httpUrl; they'll both retrieve the home page's absolute path; the home page in ProcessWire always has an ID of 1). Take a gander at the searchable ProcessWire API. For the above, you could find them by searching, "host" (without quotes). For identifying other paths, run a PHP print_r() on $config->urls. 🙂 For reference if anyone else is reading this over and needs it, here's a simplified breakdown of relative vs absolute paths in URLs: https://www.conductor.com/academy/urls/faq/absolute-vs-relative/
  10. A slightly simpler method would be to only handle the logo icon part via SVG, and align the rest with standard (custom styled) HTML markup. I applaud your enthusiasm for including it all though, and will definitely also look through the links that were shared in this discussion. It's so much easier to dynamically generate bitmap images than SVG for things like this, but filesize and other attributes aren't nearly as nice. Shoot, if you had a specific template in mind (like you do for this particular example), you could even make it responsive. 👍
  11. That's definitely strange. No recent modification date on index or htaccess (modrewrite) files for the site? It's strange that only lister seems to be affected. The (query string in the) full path when you login is different than the full path when you load the page tree. There might be something strange there too, but it's sometimes easier to focus on one thing than multiple. I am honestly not entirely sure what to recommend at this point, based on the provided symptoms. Have you reached out to the server maintainers to see if anything had recently been changed? EDIT: If your local version works fine, maybe download a backup of the live site and compare the files (diff), or just run it locally and see if it's reproducible on your own development server. If it is, it's probably easier to diagnose there anyway.
  12. I personally have not experienced this, but the very first question that comes to mind is whether you've checked the logs generated in site/assets/logs to determine if there's any additional insight found there. Similarly - and a bit easier - if you've checked your browser's console for any errors while performing this task in case there are errors reported there.
  13. Oh, specifically for the console. I believe I experienced this once as well. Will try to be more attentive. Hasn't happened since. I am not using any Rock modules currently, though since it's only happened once to me I would lean more toward PC performance over module in my instance. Have you tried a different browser just to see if it's primarily a Chrome (on Mac?) thing? Safari / Firefox... If you have access to a Windows or ChromeOS box, maybe try Chrome there too? Chrome has a task manager. When you notice the issue - assuming you've reduced your Chrome tabs to just the one (?), does the task manager give any additional insight? Similarly, Chrome's DevTools offers a runtime performance monitor (not the same thing as is shown in the above photo)... Just some things to look into.
  14. If calling the size() method on any page image fields, the default value for upscaling within that method is true. That means if there's code in a template to resize, unless upscaling is passed in as an option with a value of false, a 200x120 sized image could theoretically be resized to 1920x1200. (Just a possible way this could happen.)
  15. In your first post of this topic, you mention the "body" field. Unfortunately I don't see that field being represented in either of the above template files. I'm not entirely sure here why you'd use both (if you're using both) the _main.php and main.php files - it seems like your main.php file was created based on the _main.php; using them both simultaneously wouldn't make sense. Within both of the above templates, there is a referenced "content" field, but not a "body" field. Do you have a "content" field? If not, try changing the variable name in the appropriate template(s) from "content" to "body" to match the associated backend template field name(s). Does that make sense?
  16. Oi. Not fun. Good luck! If it's at all helpful, link them to the topic. I did. It didn't help me for my recent issue, but it might give the support team a starting point. 🤞
  17. This might be of use to you. https://processwire.com/talk/topic/25268-unable-to-save-an-image-or-file-pw-websites-hosted-on-dreamhost-solved/
  18. Updating this for further future reference for Dreamhost customers. Their support team mentioned that they had added a specific rule to their custom ModSecurity handling for the /processwire/ admin URL path. If you change the administrative path for security-by-obscurity, then their ModSecurity rules will kick in and all of the things that used to get blocked, get blocked again. You'd need to contact their support and have the settings applied per-site, per custom URI path. Their support team is great in working with their customers, at least. 🙂
  19. I can't find any documentation at this moment that shows this working, and I don't have any sites that come to mind where I could test this, but I think it works... If your search is only searching pages that have a template of 'product' (or whatever your product template is), I believe you can use this: sort=-parent.archived This assumes that the value of archived is 1, if it is indeed archived.
  20. Once you have a PageImage object, you can use the getDebugInfo method and parse the return value to identify the mimetype. 🙂 https://processwire.com/api/ref/pageimage/get-debug-info/
  21. The problem here is (potentially) three-fold, depending on (others') needs: If it's supported in a Pageimage field, it's likely expected to also be supported in a Pageimages field (WireArray) which adds some awkward complexity, because... We can have multiple image fields per template - we'd have to determine focus prior to pasting for this to work properly, whether a button is clicked (and it just attempts to pull from the clipboard) or a some sort of area gains focus, and then we paste... As flydev mentions, we're limited in the filetype that we can save as - and simultaneously if there's a developer preference should it be predetermined, or do we just go with whatever the OS provided as default? What you might be thinking about is this forum's ability to paste an image as a file attachment, but it is essentially using CKE to handle that; otherwise, I only really remember Robin's module as a way to paste URLs of a file (and not just a data: URL, though it might be able to be modified to handle that). I've handled clipboard image pasting before, but I've never handled multiple images (files) within a single clipboard instance. That's outside your described scenario, to a degree, but drag-and-drop supports multiple files, so should copying multiple existing files and pasting also similarly work in this example?
  22. I'd wanted this for quite awhile but the thought never crossed my mind to create a module for it. An excellent quality-of-life improvement via this module - thank you!
  23. Hi @teppo! I had a warning pop up today due to my indexing of a repeater that contains a combo field. The lib/Processor.php attempted to run `implode()` on its values, but its values were that of a multidimensional array, so PHP threw an error (Warning: Array to String conversion). I solved it by flattening the multidimensional array prior to the call to implode. I'd have submitted a pull request via Github, but I thought that in this instance there might be other places this type of solution would be warranted? Value prior to flattening: Value after flattening: Adjusted method (the two lines after "// Flatten any multidimensional [...]" comment): <?php public function processIndex(array $index, array $args = []): string { $processed_index = ''; $index = array_filter($index); if (!empty($index)) { $args = array_merge([ 'withMeta' => true, 'withTags' => false, ], $args); $meta_index = $args['withMeta'] ? $this->getMetaIndex($index) : null; $processed_index = array_filter($index, function($index_key) { return strpos($index_key, Indexer::META_PREFIX) !== 0; }, ARRAY_FILTER_USE_KEY); // Flatten any multidimensional arrays to a single dimension, then convert to string for indexing $processed_index = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($processed_index)); $processed_index = iterator_to_array($processed_index, false); $processed_index = implode(' ... ', $processed_index); $processed_index = str_replace('<', ' <', $processed_index); if (!$args['withTags']) { $processed_index = strip_tags($processed_index); } // Note: "u" flag fixes a potential macOS PCRE UTF-8 issue, https://github.com/silverstripe/silverstripe-framework/issues/7132 $processed_index = preg_replace('/\s+/u', ' ', $processed_index); if ($args['withMeta']) { $processed_index .= "\n" . (empty($meta_index) ? '{}' : json_encode($meta_index, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)); } } return $processed_index; } I also wasn't sure if this was the best solution to a problem that, I believe, is not explicitly supported by the module. 😉
  24. My confusion was from the comment in the code example within the documentation that discusses the use of the $expire parameter using get() (the one with a value of 3600 being passed). But, overall, properly defining its meaning is far more beneficial overall. I tend to agree with @artfulrobot that there are times when knowing when a cache was created (ex: to clear an improperly stored value in a recently created cache) could be more useful than knowing when it expires, though both could potentially be useful in certain circumstances. It seems we only have the one option, as far as I can tell. I'm not well-versed in PW's caching (yet).
  25. As far as I can tell, you're correct. Based on the way the documentation example is written, and how the methods process a numeric expire value in the get request, it doesn't: get cache only if it’s less than or equal to 1 hour old (3600 seconds) Instead, it... get cache only if it expires within the next 1 hour (3600 seconds) As for how best to report/request a change like this we might need to understand how the method was intended... In this case I'm not entirely sure if @ryan intended it to function the way the documentation is written, or if the code example in the documentation is incorrect...
×
×
  • Create New...