Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/01/2023 in all areas

  1. Happy New Year! This week we've got ProcessWire 3.0.209 released on the dev branch. Consider this version a release candidate (RC1) for the master/main branch. Relative to 3.0.208, this version contains primarily issue resolutions and minor improvements (commit log). If you have a chance to test it, please let us know if you run into any major issues by reporting them here. So long as no new major issues surface, by this time next week my hope is that we'll have the dev branch merged to the master/main branch for version 3.0.210. This week one of my clients pointed me to https://chat.openai.com/ which is really quite interesting. It's an artificial intelligence that you can chat with, and it knows quite a lot about ProcessWire and how to code in ProcessWire. Though it knows a lot about a lot of different APIs, and actually a lot about everything, not just development related stuff. But I mention it here because of how it appears it's been trained fairly well in ProcessWire. When I asked it for examples of what CMSs it knows how to code for it told me WordPress, Joomla, Drupal and ProcessWire. I'd encourage you to get an OpenAI account to try it out, it can blow your mind. Ask it questions like how to develop a ProcessWire module, how to build a search engine in ProcessWire, how to use pagination in ProcessWire, or anything you can think of. It seems to have an answer for everything. The client that told me about it is currently using it to write AWS scripts for him, and he said it's saving him a lot of development time. What I also find interesting is not just how it seems to have an answer for everything, and that it knows how to code, but also that it makes mistakes pretty regularly, and recognizes those mistakes when you point them out... and apparently learns from them. That's basically how we work. For example, I asked it how to resize an image in ProcessWire and it explained through text and code examples how to use the size() method on image fields. But it also told me that I could use the $options argument to specify the type of resize interpolation (bicubic, linear, nearest, etc.) and ProcessWire has no such option. When I told it that, it apologized and corrected its code example, and also explained more details about the size() method's $options argument. There was another instance where it made a mistake (trying to do a PHP math operation within a string) and I explained that PHP doesn't support that. It essentially said "I know that, but my example doesn't do that". Then I asked it to double check its example because it didn't look right to me, and then it replied (paraphrased) "Oops, sorry, you are right, here's a corrected version." Anyway, it's just kind of funny to me that I'm talking to a computer with these kinds of interactions, and how it seems to "think" and learn a lot like we do. It will be interesting to see where this technology leads. Currently it is a free research preview, where I suppose we are helping to test the AI and help it learn, but it's very interesting and engaging just to talk with it. Also worth noting is that it does not have internet access (other than to chat with people). So it can't go and hunt down information from websites, actually making it that much more impressive in my mind.
    5 points
  2. @bernhard Thank you my man. I will try that tomorrow. Peace and best wishes on your new year. Note that I updated my previous message.
    1 point
  3. I'd check if she is able to copy/paste here: https://www.tiny.cloud/docs/demo/full-featured/
    1 point
  4. No, it will create a single database table. If you use the table field on multiple pages, all records will go into the same database table, just with a foreign key connecting each record to its page. So perhaps you will make a Track template and add the Hotlaps field (Profields Table) to it. That way you don’t need a custom trackID column because that will just be the page’s ID. Because it’s a single database table you will still be able to figure out, for example, the car with the most hotlaps across all tracks, by just doing very simple custom SQL: $sql = <<<SQL select car, count(id) as hotlaps from field_hotlaps group by car order by count(id) desc SQL $query = wire('database')->prepare($sql); $query->execute(); $queryResults = $query->fetchAll(\PDO::FETCH_KEY_PAIR); A car will probably be a page, so you would use a Page Reference column in your table. The query above thus gives you a bunch of page ids you can convert to page objects like this: wire('pages')->getByIds(array_keys($queryResults));
    1 point
  5. You can do the same in PW. You just don't get the page editor and have to build a GUI for editing that table on your own. Why not? Maybe you are just missing a tabular view like shown here? https://processwire.com/talk/topic/26663-need-help-making-sse-work/?do=findComment&comment=220918 For me: Not really ? Those things are always really hard to understand if you are not into the topic. So for me it would help a lot to get more details or specific examples. Or to get screenshots of how it is done at the moment. But I'm quite sure there's no easy peasy answer to your questions as it is a complex case ?
    1 point
  6. Happy New Year everyone and thanks for sharing! I am amazed with this thing that also chats in other languages: I asked a question in Italian and it gave me a perfect answer… also translating the comments, but not the code statements… ??
    1 point
  7. @teppo This thing is apparently kind of an alpha or beta test, but it seems full of potential and kind of cool to imagine where it's headed when the issues are worked out. At the moment, it's odd and kind of funny with the mistakes that it makes. It seemingly just makes stuff up when it doesn't know the answer to something. It's like it has some kind of creative element to it or something, which made the behavior fascinating. It's completely different from any kind of computer interaction I've had before. I love the fact that it seems to know how to code ProcessWire stuff even if it's prone to mistakes. I've not experimented with AI, machine learning, neural networks, etc., but it makes me want to learn more about it.
    1 point
  8. Yes, please! That's what I've been saying for a long time... Yes, please! That's the part that made me move away from AOS. I'm very happy without it btw - it hurt a little in the beginning but I'm not missing anything any more. For field/template edit links we have the great https://processwire.com/talk/topic/26537-adminhelperlinks-shortcut-links-to-edit-fields-and-template-directly-from-page-edit/ that has not caused a single issue in all of my pw instances. AOS on the other hand has cost me hours in finding bugs in my modules that turned out to be bugs in AOS. RockMigrations has the concept of "tweaks" where we can add micro-modules via single php files (https://github.com/baumrock/RockMigrations/tree/main/tweaks) and enable/disable them via GUI in the module's settings: Agreed, but don't forget that some features also need several hooks in place, so we need a combination of PHP/CSS/JS. I've also built https://github.com/baumrock/RockAdminTweaks some time ago which had the idea of making it possible to have all those little tweaks organised in a modular and manageable way. I don't see any reason why we would need support for 3 admin themes that all do the same and just look a little different. We have now the possibility to create custom styles of the backend without the need of creating a new theme (see https://github.com/baumrock/AdminStyleRock#wording-theme-vs-style ) I disagree ? Why do you think that or what exactly do you mean? But it's a little offtopic so if it's not easy to answer just ignore it. I agree ? Thx for making the list @dotnetic and pushing that topic forward!
    1 point
  9. Hello all, I wanted to share a proof of concept approach on how we can have an infinite scroll pattern without writing Javascript. We can achieve this with htmx. What you will get An overview page with a list of posts (PW pages). On initial page load 5 posts will be shown. When scrolling down and reaching the last post, another 5 posts will be loaded via AJAX in the background and appended after the last post until no more pages are found. Prerequisites You are using the delayed output strategy, with a _main.php appended. Just like using the default site profile when installing ProcessWire You are using markup regions, in my _main.php I have a div#content that will be used for the output of the posts Inside site/config.php $config->useMarkupRegions = true; Inside site/templates/_main.php <!-- main content --> <div id='content'> </div> For script loading I am using a custom $config->bodyScripts FilenameArray Inside site/config.php $config->bodyScripts = new FilenameArray(); Inside site/templates/_main.php before the closing </body> tag <?php foreach ($config->bodyScripts as $file) : ?> <script src="<?= $file ?>"></script> <?php endforeach ?> </body> PW page structure for this tutorial In the page tree I have a parent page "Posts" with template "posts". All child pages of that page have template "post" In the template "posts" settings in the "URLs" tab, check "Allow Page Numbers" and save. Needed for pagination. When viewing the page "Posts" all logic happens inside site/templates/posts.php site/templates/posts.php <?php namespace ProcessWire; // posts.php template file // add htmx js from site/templates/scripts $config->bodyScripts->add($config->urls->templates . 'scripts/htmx.min.js'); $limit = 5; $posts = $pages->find("template=post, limit={$limit}"); $lastPost = $posts->last(); $nextPageUrl = $page->url . $input->pageNumStr((int) $input->pageNum() + 1); $hxAttributes = array(); $hxAttributes[] = 'hx-get="' . $nextPageUrl . '"'; $hxAttributes[] = 'hx-trigger="revealed"'; $hxAttributes[] = 'hx-swap="afterend"'; ?> <?php if (!$config->ajax) : ?> <section pw-append="content" class="posts" hx-headers='{"X-Requested-With": "XMLHttpRequest"}'> <?php endif ?> <?php foreach ($posts as $post) : ?> <article class="post" <?php if ($post == $lastPost) echo implode(' ', $hxAttributes) ?>> <header> <h3><?= $post->title ?></h3> </header> </article> <?php endforeach ?> <?php if ($config->ajax) return $this->halt() ?> <?php if (!$config->ajax) : ?> </section> <?php endif ?> And that is all there is to it. Not a single line of Javascript, thanks to htmx. I followed the infinite scroll pattern from the official htmx examples. Now let's break the code down into easily digestible chunks // add htmx js from site/templates/scripts $config->bodyScripts->add($config->urls->templates . 'scripts/htmx.min.js'); This adds site/templates/scripts/htmx.min.js to our custom $config->bodyScripts FilenameArray so it will be loaded in _main.php. You can get the script here from unpkg.com. $limit = 5; $posts = $pages->find("template=post, limit={$limit}"); Sets our pagination limit to 5 and loads the correct set of posts. $lastPost = $posts->last(); Saves the last post of each set. We use this later to determine whether the htmx attributes should be rendered. $nextPageUrl = $page->url . $input->pageNumStr((int) $input->pageNum() + 1); We are building the link to the next "page" with the next set of posts. Will result in something like "/posts/page2", "/posts/page3" etc. $hxAttributes = array(); $hxAttributes[] = 'hx-get="' . $nextPageUrl . '"'; $hxAttributes[] = 'hx-trigger="revealed"'; $hxAttributes[] = 'hx-swap="afterend"'; Define our htmx attributes as an array. They will be added to every last post's HTML. Note the hx-get attribute which will be the URL for the AJAX call in the background. That request is triggered whenever the last post becomes visible inside the viewport while scrolling down. hx-swap afterend tells htmx to append the next batch of posts after the last post. <?php if (!$config->ajax) : ?> <section pw-append="content" class="posts" hx-headers='{"X-Requested-With": "XMLHttpRequest"}'> <?php endif ?> // and <?php if (!$config->ajax) : ?> </section> <?php endif ?> Renders the wrapping section tag only on initial page load which is a none AJAX request. Note the hx-headers='{"X-Requested-With": "XMLHttpRequest"}'. This adds an additional header to all AJAX requests with htmx. We need this header so ProcessWire understands that it is an AJAX request. Otherwise $config->ajax would always return false. See https://htmx.org/attributes/hx-headers/ for more info <?php foreach ($posts as $post) : ?> <article class="post" <?php if ($post == $lastPost) echo implode(' ', $hxAttributes) ?>> <header> <h3><?= $post->title ?></h3> </header> </article> <?php endforeach ?> Render each posts's HTML. If it is the last post, also render our htmx attributes. For brevity in this example I only output the post title. <?php if ($config->ajax) return $this->halt() ?> For AJAX requests stop execution of the template file and everything that follows. This prevents appending of _main.php for ajax calls. So we only get the desired HTML for the list of posts and no head, footer etc. Summary Compared to other approaches, htmx lets us control all our AJAX logic with a few html attributes. Really neat and concise. Easypeasy. I like that and will surely use an approach like this in future when infinite scroll is needed. What I like in particular is how easy this is implemented with ProcessWire's powerful pagination capabilities. If you have the same page structure, the code in site/templates/posts.php is working out of the box as is. I have this running on a standard PW multilang site profile with additions/amendments mentioned above under "Prerequisites". Here's a visual of the result:
    1 point
  10. Maybe this helps? https://whatsmychaincert.com/?test2.gemeindeguru.at I wish I knew more about this stuff ?
    1 point
  11. Hi Benjamin, Can you provide an example that shows successful use of the replacement wanted by planmacher as hooked from admin.php? If it is possible, I'd like to learn how to do this too. I must admit, I am a little doubtful about a straight translation from ready.php to admin.php as I think admin rendering works a little differently.
    1 point
  12. Hi, Having installation problems with a new host. I used the site profile exporter to pull my site from another host, and installed on a new hosting space. I got this message at the Compatibility Check stage: fail: ICONV Support I pushed on regardless and it seemed to install OK. I can get into the admin but when I go to edit a page I get this error: Error: Call to undefined function iconv() (line 149 of /home/fagerhu/public_html/pw/wire/core/Sanitizer.php) This error message was shown because you are logged in as a Superuser. Error has been logged. Anyone seen this before? Alex
    1 point
  13. Thanks for the info on ICONV, the web host has enabled it so its working now. cheers
    1 point
  14. I've yet to come across a host that doesn't have iconv support. This one comes with PHP and the only way to remove it is to specifically disable it when you compile PHP. Sometimes when dealing with smaller hosts (or those running their own server/VPS) they disable everything they don't recognize. Since iconv is part of PHP's core distribution, it's not something a host should disable unless they are only hosting a single site that they know doesn't need it. Most likely LiquidWeb does have it enabled, but the VPS owner compiled PHP without it. I think the best thing to do here is to ask them to enable it, along with any other PHP core features they may have disabled. Though since your installer didn't report anything else, iconv may be all you need. I don't think ProcessWire uses iconv() anywhere other than the pageName sanitizer, so if you don't want to wait on the host, you could always try modifying that line to an alternate solution.
    1 point
  15. It sounds like iconv isn't installed on the server - just need to ask Liquidweb to install it for you - that's all. I'm guessing the person who runs the hosting has a VPS package as usually they don't have many modules installed by default. if you want information as to what iconv actually does I'd suggest Googling it, but all the error during install is telling you is that a required module isn't installed and you need it to use ProcessWire properly. In fact, here you go - looks like something to do with supporting different languages/characters: http://www.php.net/manual/en/intro.iconv.php
    1 point
  16. I think there's a couple of peops here using LiquidWeb. Maybe they can shed the light.
    1 point
×
×
  • Create New...