Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/14/2022 in all areas

  1. AI is great in producing text, that looks plausible, but it's not concerned with actual correctness. I'm working with elixir nowadays and there have been many examples posted, where responses claimed some API to exist in the stdlib, which just didn't. Looked totally fine on paper until you looked into the actual stdlib and found nothing. So really AI can be useful, but in the case of ChatGPT you really want someone chatting, who can actually validate the responses. Languages evolve and that's not a new thing at all. Take for example computer, which used to be a human doing math, and now is a machine. There's a good reason why we don't use natural language for programming our – now machine – computers. They're messy and not at all strictly defined.
    2 points
  2. For what it's worth, it makes sense to have the capability to test drive new template files, so I rolled a little module. This adds a field to the template configuration for an alternative template file only used for editors. https://github.com/BitPoet/TemplateTester
    1 point
  3. Sure. In your template file (or auto append file, here for _main.php), just include the correct template according to the user's login status. <?php namespace ProcessWire; if($user->isGuest()) include('_main_regular.php'); else include('_main_wireframe.php');
    1 point
  4. I just stumbled across this post and wanted to share a very simple solution if you create a InputfieldTextArea with the API and want it to automatically resize based on the content: $f = $this('modules')->get('InputfieldTextArea'); $f->name = 'myText'; $f->label = 'Text'; $f->attr("oninput", "this.style.height = ''; this.style.height = this.scrollHeight +'px'"); // this line
    1 point
  5. Even better than the above... just check: if (wire('page')->template->name != 'admin') This way, if a logged in admin user is on an admin page the correct customer details will be rendered rather than theirs, but on the front end it will still fill out the admin users details if doing checkout testing.
    1 point
  6. @kongondo No drama lama!! It's no issue to me. Just thought it was good to know. It's bloody chilly isn't it! ?
    1 point
  7. It's the general PW page overview. In general things are a bit borked due to some deprecation notice, I think.. ps. Nice with a proper ecommerce solution for PW!
    1 point
  8. It seems like you could take advantage of the part of the module's documentation that I linked to above, something like the following: <?php namespace ProcessWire; $searchEngine = $modules->get('SearchEngine'); ... <head> <?= $searchEngine->renderStyles() ?> <?= $searchEngine->renderScripts() ?> </head> <body> <?php echo $searchEngine->renderForm(); // This assumes your search form uses GET, and a field named 'q' if ($q = $sanitizer->selectorValue($input->get->q)) { // Modify your value of the search query ($q) here... // ... // This finds pages matching the query string and returns them as a PageArray: $results = $pages->find('search_index%=' . $q . ', limit=25'); // Render results and pager with PageArray::render() and PageArray::renderPager(): echo $results->render(); // PageArray::render() echo $results->renderPager(); // PageArray::renderPager() // ... or you iterate over the results and render them manually: // echo "<ul>"; // foreach ($results as $result) { // echo "<li><a href='{$result->url}'>{$result->title}</a></li>"; // } // echo "</ul>"; } ?> The biggest benefit to the SearchEngine module is its creation of the (default) `search_index` field. You can query against that field just like any other field within ProcessWire. Rendering the form and search results are just additional benefits.
    1 point
  9. @Joss The utf8mb3 listed on your field_article_text table is the same thing as utf8 I think (utf8 is 3 bytes), so that won't support emojis. Check in your /site/config.php file and look for $config->dbCharset and change it to this: $config->dbCharset = 'utf8mb4'; Then try creating a new Textarea field that uses TinyMCE. It should now use that utf8mb4 charset, and emojis should work. If you want to convert your existing field_article_text field, you'll want to export the table and all its data (with phpmyadmin), then edit the resulting SQL file/dump, change the "CHARSET=utf8mb3" to "CHARSET=utf8mb4". Then import to replace the old table. If you get an error, change the KEY length "250" for that data_exact key in the CREATE TABLE statement to "191".
    1 point
  10. A few months back I had the urge to try a lot of new things and one thing was a SSG (static site generator) called 11ty.dev and there was one channel and one website that made it super easy to start. https://www.youtube.com/@11tyRocks/videos https://11ty.rocks/ I liked it because it showed everything from start to "sure you can build an app with that". What I want to say is that even guides on how to install ProcessWire, make it more secure, or about hooks or how to "write your own module" would make perfect sense. There is more than enough courses could cover. As already mentioned... there are few bits and pieces out there, most of them are quite outdated or at least the ProcessWire backend already looks totally different which makes it awkward in some kind to watch those videos. A new fresh approach sounds really good. There are tons of topics your course or maybe even courses could offer and talk about. See @bernhard's videos. They are really great and in full detail while only talking about a specific module. Haven't thought it through but I personally would provide some basics at least (installation, file and folder structure, some best practices), then maybe something like building a blog or magazine (as mentioned already) and go from there. A blog could have a RestAPI, a custom RSS Feed, and, so, on... oh and there is always: SEO, Online Marketing and Affiliate Marketing. There could be courses about "Why ProcessWire is perfect for (or) How to do SEO, OM, AM with ProcessWire". Just outlined a few ideas out of my head. ProcessWire Basics Installation Security Migration Updates and Maintenance How to structure your project Dos and Dont's Import a HTML Template/Theme ProcessWire: Your First Real Project Blog/Journal/Magazine Member Area ProcessWire Advanced User, User roles, Access rights How to Hook How to Customize How to Whitelabel How to RestAPI/GraphQL ProcessWire as Headless CMS Use VUE, Angular, Svelte, AlpineJS with ProcessWire Your very first ProcessWire module How to structure your backend, fields and templates ProcessWire SEO PageSpeed Caching SEO-related Modules ProcessWire Setups Multi-User Setup Multi-Instance Setup Multi-Domain Setup ProcessWire Master Class ... ... ... My 2 cents for now.
    1 point
  11. That's exactly what it is. It is because the repeater page is a child of admin, not of its ’get for' page. per a response from @ryan in another post:
    1 point
  12. Very elucidating!! I'm learning this myself and it's great to confirm/correct some of the assumptions I had. Thanks a bunch for this @MarkE!
    1 point
  13. My bad, I figured it out. In order to work the class only needs to extend WireData. So the following example works. <?php class MyClass extends WireData { public function ___someFunction() { // Do something } } // ready.php $this->addHookBefore('MyClass::someFunction', function($event) { // some customization });
    1 point
×
×
  • Create New...