Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/24/2024 in all areas

  1. @bernhard: Thanks to your forum thread, I finally did the switch from my previously used XAMPP development stack to WSL2/DDEV on my Windows 11 machine. Now I do all my Python, PHP and Node/Html projects within the Linux subsystem on Windows 11 using VS Code as my editor of choice. Only Windows Desktop C# projects (WinForms, WPF) are still done on the Windows side using Visual Studio 2022. Always wanted SSL certificates on my localhost. Installation was easy and my first project was set up within minutes by simply cloning and importing my MySQL dump into my ddev container. Thanks for the inspiration.
    3 points
  2. Hi @poljpocket, sort (-iname ... ) does not work, because iname_* contain different criteria to sort the images. To have an impression of the site, here's the link: (The new sorting function is not yet implemented completely) http://www.malabu.de But ->reverse(); was the right way, it works! Thanks to you all GΓΌnter
    2 points
  3. You need to expand the parent select and navigate to the assigned parent. When you hover on that, you should see the "unselect" button.
    2 points
  4. 1 point
  5. Fun fact. Creating a local backup of a live Wordpress site was easier with DDEV too. MySQL and PHP versions can easily be set in .ddev/config.yml to match the LIVE versions. Adding a POST import-db hook automatically replaces the hardcoded site URLs in the database.sql dump to match the URL on my localhost when running ddev import-db β€”file=database.sql.
    1 point
  6. Hey @Andi thx for your open eyes! I've just pushed a "fix" for this on the dev branch. The thing is that this JS markup is needed sometimes and therefore will be rendered as soon as RockFrontend has some variables set. This was the case for isDDEV and therefore you saw the output. I don't see anything bad with having that markup on my sites. If anyone has good reasons to remove it let me know. The idea is to have a central place to send settings from the backend to the frontend. Some of them are only necessary when logged in, but there might also be situations where a module wants to set something that the frontend consumes. For example the root url of the site, that is unfortunately not always "/" but could also be a subfolder like "/myproject". On the backend that's easy via $config->urls->root, but on the frontend there is no standard and so I added this global RockFrontend variable/object that can hold these kind of things. The order in which you call ->styles() or ->scripts() does not define the order of the output. This method defines it: private function injectAssets(string &$html): void { $assets = ''; foreach ($this->autoloadScripts as $script) $assets .= $script->render(); foreach ($this->autoloadStyles as $style) $assets .= $style->render(); $html = str_replace("</head>", "$assets</head>", $html); } That means scripts will always be rendered first, then styles. I can change that if anyone has good reasons, though I think it does not make a difference. The more important thing is that you can or probably should add "defer" to your scripts, which makes the script load at a later point when the dom is ready. With UIkit this can lead to problems though as it might cause FOUC, because uikit adds custom classes like "uk-grid" when using <div uk-grid> for example. If you are not using defer, then it will work without issues. If using defer, you'd had to add the class manually: <div class="uk-grid" uk-grid> I'm simply loading these 47.8kB upfront to make my life easier.
    1 point
  7. Can you post your exact code lines where the sort "doesn't work"?
    1 point
  8. @Gideon So I beg to differ on that assumption. Pageimages is a WireArray and thus will have a sort() function. See here: Pageimages class - ProcessWire API. @biber You can find the API for sort() here: WireArray::sort() method - ProcessWire API. There is no rsort() function, but sort() can still reverse the order like so: $images = $page->images->sort("-iname_".$order, SORT_NATURAL |SORT_FLAG_CASE); note the "-" (minus) in front of the field name. Here is another approach: $images = $page->images->sort("iname_".$order, SORT_NATURAL |SORT_FLAG_CASE)->reverse(); This is using the reverse() function of WireArray, whose docs you can find here: WireArray::reverse() method - ProcessWire API
    1 point
  9. Hi @biber I don't think the sort() function is available to pageimages because pageimages is not WireArray. The result of the below line returns nothing. $images = $page->images->sort("iname_".$order, SORT_NATURAL |SORT_FLAG_CASE); Then foreach($images as $image) Give error because the variable $images is empty. Gideon
    1 point
  10. Hi @Christophe Unfortunately we don't have Code Intellisense or autocomplete in latte files at the moment 😞 See https://github.com/smuuf/vscode-latte-lang/issues/5 You are adding the method "listchildren()" to your ParentPagePage, nowhere else. That means you can all this method only on pages that have the template "parent-page". Why should it do that? You are calling a method of an object. If that does not exist it is expected to throw an error. You CAN do what you describe though. Sometimes it is useful and I'm doing that as well. You could add that method to your DefaultPage.php and there return an empty sting. That would make $page->listchildren() return "" by default, which means it does not throw an error. For some page types you can then implement a different logic: DefaultPage.php --> listchildren() { return ""; } FooPage.php extends DefaultPage --> listchildren() { return "foo!"; } BarPage.php extends DefaultPage --> listchildren() { return "BAR"; } // in any template echo $page->listchildren(); That it totally up to you. Same with regular ProcessWire templates. It's up to us devs how we organise things and everybody does it differently. I can only say what I came up with and what works great for all kings of projects (from very simple to very complex ones): layout.latte for main markup /site/templates/sections/... for all sections /site/templates/partials/... for all partials Details: layout.latte --> holds the html markup skeleton of the page, eg: <html> <head>...</head> <body> <header>...</header> <main>...</main> <footer>...</footer> </body> </html> Then all my template files are usually empty (like home.php, basic-page.php, foo.php, bar.php). Next, I divide my design into sections. A section is a portion of the page that goes from the very left to the very right and has an undefined height/content. You can then add those sections to your main markup file like this: <html> <head>...</head> <body> <header> {include "sections/topbar.latte"} {include "sections/navbar.latte"} </header> <main> {include "sections/breadcrumbs.latte"} {include "sections/content.latte"} {include "sections/content-footer.latte"} </main> <footer> {include "sections/footer.latte"} </footer> </body> </html> This is often all I need, because I build all the available sections in RockPageBuilder and then I can simply add them to the pages as I need them. But it works without RockPageBuilder as well. You then just need to code all your page layouts depending on the page template. If all those pages share the same breadcrumbs and content-footer it could look like this: <html> <head>...</head> <body> <header> {include "sections/topbar.latte"} {include "sections/navbar.latte"} </header> <main> {include "sections/breadcrumbs.latte"} {if $page->template == 'foo'} {include "sections/content-foo.latte"} {elseif $page->template == 'bar'} {include "sections/content-bar.latte"} {else} {include "sections/content.latte"} {/if} {include "sections/content-footer.latte"} </main> <footer> {include "sections/footer.latte"} </footer> </body> </html> You could also use a dynamic approach: <html> <head>...</head> <body> <header> {include "sections/topbar.latte"} {include "sections/navbar.latte"} </header> <main> {include "sections/breadcrumbs.latte"} {include "content/" . $page->template . ".latte"} {include "sections/content-footer.latte"} </main> <footer> {include "sections/footer.latte"} </footer> </body> </html> It's just regular PHP inside the latte tags, so you could also do is_file() checks etc: <html> <head>...</head> <body> <header> {include "sections/topbar.latte"} {include "sections/navbar.latte"} </header> <main> {include "sections/breadcrumbs.latte"} {var $file = "content/" . $page->template . ".latte"} {if is_file($file)}{include $file}{/if} {include "sections/content-footer.latte"} </main> <footer> {include "sections/footer.latte"} </footer> </body> </html> Obviously you'd need to create those files. Here I'm placing them into a new folder called "content", which would be /site/templates/content/foo.latte for example. Next, partials: If you have repeating markup inside your sections you can outsource them into the partials folder. For example let's say you want to show a blog overview page that shows all single blog items as cards. You'd have a section like "blog-overview.latte" like this: // blog-overview.latte <div uk-grid> <div n:foreach="$page->children() as $item"> <div class="uk-card"> <h3>{$item->title}</h3> <p>{$item->teaser()}</p> </div> </div> </div> This example is very simple and if you only use your cards here, then it's easier to leave them here. If you are using the exact same cards on two or three places then you can create partials for them: // blog-overview.latte <div uk-grid> {foreach $page->children() as $item} {include "partials/card.latte", item: $item} {/foreach} </div> // /site/templates/partials/card.latte <div> <div class="uk-card"> <h3>{$item->title}</h3> <p>{$item->teaser()}</p> </div> </div>
    1 point
  11. If you truly want to make an admin theme from scratch like I'm doing, it's best to just take AdminThemeUikit, since that is the "official" and most supported theme and rip out UIkit and start replacing it with your own approach and just hack away at it. Keep in mind that ProcessWire makes heavy use of jQuery UI and a few other libraries so you'll have to play nicely with them unless you want to replace them too, but that takes it to another level. With Bootstrap, it's straight-forward enough given the similarities with UIkit, although this is turning out to be more work than I anticipated. But that was the point since I want it to force me into looking at how everything is interconnected. One idea for an admin theme is to do it with pure, modern CSS and as little JS as possible and as accessible as possible (good reason why here).
    1 point
  12. Is my 100th post I wanted to do something special. I edited a video, hope you like it Just for fun Edited: Now with subtitles
    1 point
  13. Have you ever had to revive an old project for whatever reason? Was it a pain to get it up and running, because you switched to a totally new laptop in the meantime? I had this situation today and it was no problem at all thx to DDEV 😎 --> got an error that DDEV can't boot up the project because the path changed from /my/old/laptop/projectX to /my/new/laptop/projectX But it also showed the solution: And then again: --> Browser popped up, table xy not found - well yes, obviously I don't have the database on my new laptop! Boom, everything works! With a quite old project with a quite outdated version of PHP πŸ˜ŽπŸš€
    1 point
  14. 🚨 [[ UPDATE December 6, 2022 ]] 🚨 I prepared a small landing page to validate how many of you would be willing to take the course, so that we would have a rough estimate of how many people would be willing to take the course. πŸ”— Show me your interest here πŸ”— ------------------------------------------------------- Hello to the entire wonderful Processwire community! I am here to announce my willingness to create a video course for beginner/mid-level developers interested in learning more about the main aspects of our beloved CMS. I have been working with Processwire continuously for years now, so I feel confident that I can share what I have learned to other developers interested in becoming faster and more efficient in their day-to-day work. I have noticed that lately many people here in the forum have complained about a lack of material and tutorials for taking the first steps, and although so many resources are already present within the board, I understand how complicated it can be to be able to connect the dots and have a clear reference on how to get started or how to find clear answers in a short time. As you know Processwire is a very broad tool, very flexible and able to be adapted to any need, so it will not be possible to dissect every aspect in this course, especially the more advanced ones that can help in rarer cases (at least in my personal experience). πŸŽ‰ But don't worry, I plan to explain with many practical examples many tips and tricks that can help you in developing sites, even particularly structured ones! πŸŽ‰ So I am here to test your interest and ask you what aspects you would be most interested in me covering, even those related to design (css, scss, postcss, tailwind) or javascript libraries/frameworks integrations (vue, alpine.js, greensock for animations,etc.). My idea would be to create together a magazine with a restricted area for users, newsletter integration, catalog filtering according to different parameters (year, author, topics, etc.) and much more.πŸ’£ It will be a paid course, I have not yet decided what the price will be, but it will be affordable for everyone πŸ‘. For a small period of time, I would be pleased if you would give me pointers and ideas, so I can see what your real interest is (if any!) and also motivate me πŸ™‚ Let me know! Thanks! πŸ™
    1 point
  15. You're inside a function, so there's no global $datetime object. wire('datetime') should do the trick.
    1 point
Γ—
Γ—
  • Create New...