Jump to content

BrendonKoz

Members
  • Posts

    420
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by BrendonKoz

  1. All browsers request a /favicon of some sort (.ico, .png, .gif, etc) - it's the icon that shows up in your browser's TAB to identify the website at quick glance. It may not be required, but you will always have a request, and if you don't include one, you'll also always get 404 errors in your webserver log files. There are other files that browsers will automatically request. I often use a webservice to take care of (most) of them at once, such as https://realfavicongenerator.net/. Older browsers/devices may still request files that this service no longer generates for you, but thankfully those requests will slowly fade with time. ?
  2. Honestly, the fact that PW does not require composer is a selling point for me. I develop on multiple hardware, depending on where I'm at (home on my gaming machine, at work on a business class PC, or on my 2011-era Macbook Air) - all running a Docker-based solution with shared file access to a Dropbox instance (in other words: very slow access to host OS files in the virtualized host OS). It took well over an hour for my Macbook Air to finish its composer install of Statamic. When the non-composer version of it was available, it took a little over a minute to unpack everything. There are absolutely massive benefits to standing on the work of others who have come before, but the massive inclusion of unnecessary code also exists (and @wbmnfktr already mentioned the additional attack vectors and need to keep things up-to-date, and how things can break from dependencies). I'm always concerned with one small included library in a composer setup getting a repository pull request from a bad actor that gets accepted...and then any/all platforms that use that little library (and keep up-to-date) are now essentially, unknowingly, vulnerable. I'm glad that ProcessWire offers both options. Having a composer option is awesome. When solutions don't offer a simple alternative to composer, it just sucks (for me). I wish I had more to provide in terms of similar CMSs to compare to ProcessWire, but the only ones I'm aware of, and I don't even entirely consider them all too similar, have already been mentioned. ? Some features of Grav CMS, maybe, are comparable in terms of its intention for customization.
  3. Hi mel47, if you haven't yet figured this out, I think we might need a bit more information in terms of what capability your templates have - like, are there any page reference fields that could reference other pages? What page, or pages, do you want the members listed on? Since you're mentioning regions I wasn't sure if members are listed on every page, or just specific choices. When you mention "member/awardee template", are you referring to a ProcessWire template assigned to a page type, or a PHP file (template), because I got confused when you asked if you should use the member/awardee template and render it in basic-page which is itself a ProcessWire page template...and if you did intend to render an entire page's output inside another template (i.e.: basic-page) then that would seem you wanted members included on quite a few pages.
  4. My only concern with using a JSON solution is, through my experience on Dreamhost and going back and forth with disabling mod_security for various issues, I noticed that Apache sometimes logged that it delivers the HTTP request, whereas if it's a PHP include/require or database query, it's all going to be run on a single PHP process (unless explicitly coded otherwise). If using JSON since Apache is handling a separate request, I think it has the possibility to spawn/create another PHP child process. Under normal scenarios this isn't a problem, but if you start getting hit with a bot attack of some sort (dictionary attack for wp-* pages, or DoS, or just a lot of 404s from a web scraper using old data [thanks, AWS]), you'll be increasing the spawn rate of PHP child processes much more quickly for any pages requesting data externally, and possibly hit a limit. Obviously caching can alleviate a lot of that - if you've taken the time to implement it. Just something to (possibly?) keep in mind. Realistically if you're getting attacked you'll still likely hit a limit eventually. ? Since many of us like cheap hosts... ?
  5. If you prefer one-liners: <?php // https://processwire.com/api/ref/wire-array/each/ echo $pages->find('template=faq')->each("<div><h2>{question}</h2>{answer}</div>\n"); ?
  6. After enabling it, you'd then need to add it. I copy/pasted your plugin's code into a file in my test PW site, followed my steps, but then also added it to the list of items in the toolbar. It (unfortunately) doesn't show up as a suggested item, so you have to type it manually and make sure you don't misspell it. Afterward, it should be enabled on your configured field(s). My field's Tools Menu is disabled, so I didn't test against that, but it does work, at the very least, for the toolbar/icon area when added.
  7. Neat! I like the readability score - it provides some useful context back to the authors. I was originally looking to see if it'd be possible to integrate the hemingwayapp(.com) interface as a field for similar reasons, but gave up. I instead just created a "Estimated Reading Time" field for site visitors as a feel-good (for me) feature. (I'll share it in case it's useful. The $page->reading_time is a hidden integer field in the template.) Multilingual sites could use the referenced source study to define times based on available data. <?php // ready.php // Blog/News Post Page - set reading time $wire->addHookBefore('Pages::saveReady(template=news-post)', function(HookEvent $event) { // Get values of arguments sent to hook (and optionally modify them) $page = $event->arguments(0); // Get the word count of the summary and body fields (combined) $summary_word_count = count(wire('sanitizer')->wordsArray(strip_tags($page->summary_textarea))); $article_word_count = count(wire('sanitizer')->wordsArray(strip_tags($page->rte))); // Set the value for the reading time field (number) based on word count // To provide a range, a text value would have to be returned (and stored), but is possible by calculating cpm, // wpm_top, wpm_bot and determining variance // Source Study: https://iovs.arvojournals.org/article.aspx?articleid=2166061 $cpm = 987; // average characters per minute, for English $wpm_bot = 161; // English values for reading speeds $wpm_top = 228; $wpm_ave = ceil(($wpm_bot + $wpm_top) / 2); $page->reading_time = ceil(($summary_word_count + $article_word_count) / $wpm_ave); // Populate back arguments (assuming they've been modified) $event->arguments(0, $page); }); As for your actual question... I haven't done this myself, but looking at the module and the field's settings, I believe you need to: Edit the settings of the "InputfieldTinyMCE" module. Look for the (image below) External Plugin files section, expand it if necessary, and it'll show you where to place your necessary file(s) for your additional plugins. Once your additional plugin(s) have been added properly to the InputfieldTinyMCE module's settings correctly, I do believe you'd then need to go to your TinyMCE field(s) that you want to take advantage of the plugin(s), and add/enable them. To do so, edit your field(s), go to the Input tab, and configure the necessary section(s) (I would assume the "External plugins to enable" would be the first to change) - my example image is blank only because I haven't added any plugins to my system. InputfieldTinyMCE module config: TinyMCE field Input tab setting:
  8. In a long thread of similar issues, it's often blamed on Twitter's crawler failing to load for some reason, and the cache getting corrupted. It may take a few days to clear. It (your site) worked for me today, multiple times. Ignore the grammarly icon overlay. ?
  9. I just ran your home page's minified HTML source through a code beautifier so I could read it a bit better, removed all IMG elements, CSS link and JS references, and uploaded it to a subdomain of our hosted website. I tested linking to the "test.html" file via Twitter and it did not unfurl to create a card. I then noticed that you're declaring both Facebook Graph and Twitter Card meta tags. I have not done that; I've used Facebook Graph meta tags, and only added the Twitter Card meta tags that don't also exist under Facebook Graph, so I removed all of your Twitter meta tags except "card" and "site", and tried it again. This time it loaded up a preview card. The image didn't load, but it may be because the domains don't match (I'm not sure about that one). This is what I used: <meta property="og:title" content="Digital Marketing Montenegro: SEO &amp; Online Marketing Expert"> <meta property="og:description" content="Digital Marketing Montenegro. Top SEO &amp; SEM Services for Brands. Increase Website Traffic &amp; Leads. Get a Free Quote from Miljan Vujosevic Today!"> <meta property="og:type" content="website"> <meta property="og:image" content="https://vujosevic.com/site/assets/files/1/web-1.1200x630.jpg"> <meta property="og:url" content="https://vujosevic.com/"> <meta name="twitter:card" content="summary_large_image"> <meta name="twitter:site" content="@VujosevicCom"> I'm not saying that will fix everything (as when I tried it the image didn't render), but it at least did get a card view to show up!
  10. I didn't see anything in particular that looked out of place from quickly looking it over either. In fact, the unofficial Twitter Card Validator rendered a Twitter card as you'd expect from your markup. Usually if something changes without you doing anything, the fault isn't on your end - or at least with your code (maybe, like you said, a change to the server, like a robots.txt file or some sort of proxy, server protection, redirection, etc.). Since Twitter's official validator/renderer isn't really active anymore, it's hard to know what isn't working and why. If you have a different server (host) and web domain that you could test against, maybe export the source code of your homepage, along with the image (and path) and recreate it elsewhere and see if linking to that test/temporary location works as expected. At the very least - if it works - it would eliminate the rendered HTML code as being the issue.
  11. The official Twitter Card Validator tool no longer functions and renders a preview, why they didn't just remove the tool is unknown to me. Instead, they direct devs to just start creating an actual tweet (no need to send it) to test rendering/preview functionality. I get the same error with my website using the Twitter Card Validator, but it renders as expected when writing out a tweet. What's the difference between your site and mine that I tested against? Your HTML is minified. Maybe that has something to do with it? I'm not sure.
  12. At this level of uncertainty, this is where I'd probably set up xdebug to integrate with an IDE to step through processes. Alternatively, maybe Ryan's ProfilerPro in ProDevTools to compare how the module version works vs the traditional?
  13. This is pretty cool - thanks for sharing! For your color assignment, if this might help, I'd used Chart.js for a PHP-based project in the past and didn't want to have to manually assign colors, so I used the data label to dynamically generate colors for the chart. Here's the helper function I came up with. In my case, I found that the haval128,4 hashtype worked well for color differentiation/contrast, but another option may end up being slightly better with different datasets. ? <?php /** * Convert a string into RGB array (with alpha transparency option) * * @param string $string Any text to be represented as color * @param string $hashtype Hashing algorithm which supports a 32-character output * @return array RGBA color set */ function string_to_rgba($string, $hashtype = 'md2') { // 32-char options: md2, md4, md5, ripemd128, tiger128,3, tiger128,4, haval128,3, haval128,4, haval128,5 if (!in_array($hashtype, ['md2', 'md4', 'md5', 'ripemd128', 'tiger128,3', 'tiger128,4', 'haval128,3', 'haval128,4', 'haval128,5'])){ $hashtype = 'md2'; } $fullhash = hash($hashtype, $string); $hash = substr($fullhash, 0, 8); $colors = str_split($hash, 2); foreach ($colors as $i => $color) { $decimal = hexdec($color); if ($decimal > 230) { $decimal -= 25; } else if ($decimal < 50) { $decimal += 50; } $colors[$i] = $decimal; } $colors[3] = intval($colors[3] / 255 * 100); return $colors; }
  14. The "summary", just in case this was overlooked, isn't (entirely) an in-built feature for the module. It needs to be told what field in your template(s) will be used for the search result summary when rendered. From the documentation on the Modules page, under the "Options" heading, check the render_args property of the module's config, and look for the below: // Summary of each result (in the search results list) is the value of this field. 'result_summary_field' => 'summary', In the config, the "result_summary_field" points to the field used in your instance of ProcessWire this module is being used in that will be used to render the search result template's summary. So if in your templates you either don't have a summary field, or the field you use to define a summary is named differently, you'd need to use whatever value you have for your template(s). If maybe you used something like "short_description" as a page summary field, go with that. If you don't have a summary, you could use a "body" or "content" field, and in the render template use some form of string truncation, such as sanitizer()->truncate($your_summary_field, 80). If you're using JSON, slightly further down is a different section for that: // These settings define the fields used when search results are rendered as JSON. 'results_json_fields' => [ 'title' => 'title', 'desc' => 'summary', 'url' => 'url', ], Does that help at all?
  15. That was likely a conscious decision with their htaccess rules to prevent numerically traversing an entire forum (and instead requires parsing HTML to identify internal hyperlinks, so more processing power on the part of bad bots). Good find though! I much prefer shorter links. ?
  16. I somehow managed to miss this reply. Thank you for both of your replies, @Robin S! I did manage to get this working, with some oddities here and there that had to be worked through due to how I was checking/setting access permissions. I chose not to explicitly set permission for each and every template per role since I'm using a field that's added to the templates to determine access, so it seemed doubly difficult to do that, and my hope was that inheritance would work properly most of the time. So far that's fairly true, with occasional exceptions (ex: nested repeaters since repeaters have their own system templates). It felt a little hack'ish but I checked against the template name and if strpos() found a match to "repeater_" against $page->template->name, then I'd allow access to the edit method (add didn't cause an issue the way I had it written). I wasn't sure how else to check if a template of a page being checked for access belonged to a repeatable fieldtype.
  17. Disabling/Uninstalling SessionHandlerDB is supposed to log out any users - did you get logged out prior to seeing that message? I should've mentioned it would be a good idea to back up the database prior to disabling, just in case, but since you just moved hosts, I'd imagine whether you did or did not get a backup prior to disabling the module, you should have the ability to restore that table and its data, if need be - and/or restore to your prior host's backup state. I know a lot of people have had issue with the SessionHandlerDB, which is why I think it's a good idea to see if running the site with it disabled might help. Unfortunately, you also want to be able to use your site, and it seems something is holding on to a cache and/or expecting the table to exist. I'm not familiar with all of the modules you've mentioned, so maybe one of them needs it too?
  18. I haven't personally messed much with the table salt things, but usually that's related to passwords. If you can log in successfully, I'm thinking that's OK (and I would not change it). If you have a feeling there may be an issue with SessionHandlerDB, try disabling it temporarily to see what happens.
  19. I tried accessing your website (and the problematic page) last night and also encountered the error. The error message that I received was about a proxy server having issue, however. Is the current host using nginx or Apache? If there's a proxy server somewhere in there (if not nginx) then it's going to be beyond my experience/capabilities to know how to help. Otherwise, maybe look into why that particular page section (Newsboard) seems to cause trouble when other pages mostly load rather quickly. ProDevTools' ProfilerPro might be useful here, if identifying problem areas on your own ends up being difficult to find.
  20. Are you calling your create() method from the constructor?
  21. Thanks - that did it! Looks like forcing "isLocal" was what I needed here. In this case it's not a guest, though I'm guessing the permission level is equivalent to guest. (I haven't explicitly added any tracy related permissions to roles.)
  22. I had thought I had Tracy enabled for all users (excluding guests) awhile back and disabled it. Now I can't seem to re-enable it now that I need to diagnose some things. I am not restricting non-superusers (or superusers for that matter), the Tracy Debugger is enabled, and I even tried to match the IP address using PCRE pattern of /.*/ with no luck.
  23. I'm responding with no experience using custom page classes, so if my reply is just silly, I apologize. ? Perhaps I'm missing something, but I think my question here is also the question that ProcessWire is throwing an error about. Where do your ProcesswireTemplate::INDIVIDUAL_CAR_CHOICES and ProcesswireTemplate::INDIVIDUAL_CAR_CHOICE variables' values come from? In fact, where is the ProcessWireTemplate class located? There's a Template class in wire/core, but I'm not seeing a Processwire* class anywhere. If those classes/values don't exist, that could cause the errors to be thrown. If you're moving the code to another class, maybe it's not actually being called/used and ProcessWire is falling back to using the standard Page class?
  24. This is really neat. If the action relates to a topic, can the topic name be linked to the actual topic? (I saw people viewing topics that I hadn't read in a long time and recall it being interesting; currently have to go back to the forum and search for it). Related to PWGeeks - is the "last updated" status the last time the related project was (determined to be) updated, or the last time PWGeeks checked the project's status? I ask because the very last page (279 as of right now) shows a last update time based on my current clock time. Ordering by "Recently Modified" shows FieldtypeFolderOptions on the first paginated page, but was last updated (Github) 4 years ago. I love the PWGeeks project, btw. ❤️
  25. So far my solution to this seems unnecessarily complex. I have a primary RepeaterMatrix field (`content_body`). I've duplicated that field and called it "content_column". I created a Repeater (standard) field, added a simple number field (for column width, for now) and the "content_column" field. I've added "content_row" to "content_body" as a new item. I'm using field-based file rendering, so I have a file structure such as: fields: - content_body.php - content_body/field1.php - content_body/field2.php ...etc... So now I've got to duplicate the files for rendering the contents of the "content_column" RepeaterMatrix, which is basically just a copy/paste of all the individual fields of the "content_body" folder, and maintain changes between the duplicated files. I tried to add "content_body" to "content_row" as a subfield, but I kept getting 503 errors in the admin and ultimately had to revert the database to recover. ?
×
×
  • Create New...