Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/09/2022 in all areas

  1. This week we have ProcessWire 3.0.206 on the dev branch and a new version of the ProDevTools UserActivity module, which we'll take a closer look at in this post— https://processwire.com/blog/posts/user-activity-v6/
    2 points
  2. After a previous request for Webp support (6 years ago, times flies…) that Horst and Ryan kindly introduced in PW 3.0.132, I'm back with another request for a new image file format, AVIF, which has landed in almost all browsers. I'm actually surprised no one here in the PW community has been asking for AVIF support in ProcessWire as it seems to be provide much more consistent gains in compression and greater relative quality over Webp, and of course over good old JPEG. My experience using it definitely confirms this. I've been using Cloudinary to serve AVIF images to the browsers that support it, but of course I'd rather not use a third-party service, and use it natively in ProcessWire. Imagemagick supports AVIF if I'm not mistaken. Anyone else is interested?
    1 point
  3. Well, that's a totally different story then. Your explanation was a little short, so I did not realise we are talking about a field of an image rather than a field of a page... I've at least posted an update that forces the first alfred argument to be a Page. And if you provide something else you'll at least get a better error message: I don't know of any good way to render the editor interface just for one single image (or even a field of that image) so I don't think what you are trying to do is easy to achieve.
    1 point
  4. Thx @MarkE I've modified the behaviour of isActive() so that it treats the homepage different than all other pages. It does now only mark the homepage active if the currently views page is the homepage (id=1). I have not hat that case until now but I think that makes sense 99,9% (maybe 100%) of the time since the homepage would otherwise always be "active" (as any page is a child of the root page), which is likely not what we want. Thx for the input ? Sorry I still don't get it I think. My menus always reflect the page tree. If I want the "home" menu item on the same level as child1, 2 and 3 I simply output it above: <ul> <li><a href=/ n:class="$page->is('/') ? 'uk-active'">HOME</a></li> <li n:foreach="$home->children() as $item"> <a href="{$item->url}" n:class="$rockfrontend->isActive($item) ? 'uk-active'"> {$item->title} </a> </li> </ul> Is that what you are talking about? Not always. If no sort order is specified, they will be in id order (I think) - which is fine if you created them in the order you want. If you specify "sort=sort" then the top level will be correct, but lower levels will get mixed in - see I think you are making things more complicated than they need to be. $page->children() already return the children in the admin sort order. So if you call $page->children() recursively in your menu than the menu perfectly reflects the page tree. https://processwire.com/docs/selectors/ So the problem might be that you are using $pages->find() or maybe that you apply a selector to page->children() ?! For me $page->children() did a perfect job without any extra magic ?
    1 point
  5. Hello @virtualgadjo, First of all, sorry for the very late reply. I have let too much time pass without maintaining the French language pack. I am starting to use Processwire again for projects so I'll try to catch up. I'd be happy to integrate your work into the GitHub repository but you haven't made a pull request. Can you make one? Ideally, you don't want to go through a .zip, but keep the .json files so that versioning can be done. Or if you prefer, I can commit your work by tagging you. I will also update the readme to credit you. Once that's done, we can continue the translation work on the new versions. Have a nice day, Vincent
    1 point
  6. @Pete Oops, looks like I neglected to push the final "bump version" commit. Just pushed it and the version number should update within a day. Thanks.
    1 point
  7. Thanks for the menu suggestion @bernhard. I have done a variation on this to do a hierarchical menu which relects the page tree structure. The code below should be considered illustrative, rather than a recipe. In particular, you will need to adapt it to whatever css framework you are using. Also, my "nav.latte" is in the context of a repeater matrix item (part of my page builder framework), so the called methods live in the custom page class of the getForPage() (custom page classes don't work with repeaters directly). {* in nav.latte *} {var $selector = ($page->theme_selector) ?: "template=ThemeDisplay"} {* specific to my page builder. Define whatever selector you want for menu items here. *} {* define block that is used for recursion *} {define items, $items, $first, $selector, $shown = new ProcessWire\PageArray} {do $items = $page->getForPage()->treeSort($items)} // or you could put the function in init.php, suitably modified {foreach $items as $item}{* loop all items*} {* define variables for inside the loop *} {var $subid = "tm-menu-" . $item->id} {var $numc = ($item->numChildren($selector) && $item !== $first)} {var $active = (($item == $rockfrontend->wire->page) || ($numc && $item->children()->has($rockfrontend->wire->page)))} {* I had a problem with $rrockfrontend->isActive() not highlighting what I wanted, hence the above custom code *} {* list item markup (NB Bulma css) *} <a n:if="!$numc && !($shown->has($item) && $item !== $first)" href="{$item->url}" n:class="navbar-item, $active ? 'is-active'"> {$item->title} {do $shown->add($item)} </a> <div n:if=$numc class="navbar-item has-dropdown is-hoverable"> <a n:class="navbar-link, $active ? 'is-active'" href="{$item->url}">{$item->title} </a> {do $shown->add($item)} {* list for child-items *} <div class="navbar-dropdown"> {var $children = $item->children($selector)} {include items, $children->prepend($item), $item, $selector, $shown} {do $shown->add($children)} </div> </div> {/foreach} {/define} <nav class="navbar is-fixed-top is-transparent" role="navigation" style="{$page->theme_style|noescape}" aria-label="main navigation"> <div class="navbar-brand"> <a class="navbar-item" href="{$urls->root}"> <img src="{$logo->url}" alt="{$logo->description}"> </a> <a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbarMain"> <span aria-hidden="true"></span> <span aria-hidden="true"></span> <span aria-hidden="true"></span> </a> </div> <div id="navbarMain" class="navbar-menu"> <div class="navbar-start"> {* now include the block for the first level of items *} {include items, $pages->find($selector), $home, $selector} </div> </div> </nav> /* In the custom page class */ /** * Sort pages by how they appear in the page tree hierarchy * * @param $pages * @return void */ public function treeSort($pageItems) { foreach($pageItems as $index => $item) { $item->treeSortVal = $this->treeSortVal($item)[0]; } $pageItems->sort('treeSortVal'); return $pageItems; } private function treeSortVal($item) { $val = $item->sort + 1; $increment = 1; if ($item->numParents() > 0 && $item->parent() !== $this->pages()->get('/')) { $siblingNum = max($item->siblings()->explode('sort')); $parentVal = $this->treeSortVal($item->parent()); $increment = (1 / ($siblingNum + 2)) * $parentVal[1]; // (add 2 because we added 1 to sort to get $val, then we want 1 more than the greatest $val so that the fraction is always less than 1) $val = ($val * $increment) + $parentVal[0]; } else { } return [$val, $increment]; }
    1 point
  8. 1 point
  9. @ryan ProcessWireUpgrade can't seem to see 3.0.206:
    1 point
  10. In Test A your PHP Social Stream code is loading it's own copy of jQuery. At about line 974 you have: <!-- PHP Social Stream By Axent Media --> <link href="https://www.ncoinc.org/site/templates/social-stream/public/css/colorbox.css" rel="stylesheet" type="text/css" /> <link href="https://www.ncoinc.org/site/templates/social-stream/public/css/styles.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="https://www.ncoinc.org/site/templates/social-stream/public/js/jquery.min.js"></script> that's as well as the version of jQuery you're loading at the bottom of the page. Obviously it's not good to be loading two versions of jQuery. In Test B the Hannah code isn't loading its own version of jQuery. I'm guessing the plugin code is looking for the presence of jQuery in the markup and finds it in the second but not the first - perhaps due to the way the page is being built. The first thing I'd try would be to move loading jQuery into the HEAD section of the site rather than leaving it until last. Techincally that's going to slow down your rendering but means jQuery will be loaded early if you want to add scripts inline. Of course the best solution is not to use jQuery or include social media widgets ?
    1 point
  11. A note for myself, and people interested on how an install can scale : ProcessWire 3.0.175 adds new database scalability options https://processwire.com/blog/posts/pw-3.0.175/
    1 point
  12. Another example, clients receipts generated by the terminal are sent on real time to the "receipt app" which can be seen there: https://facture.kingspark.fr/ You can see something more than ~4M pages. This following example, is a dashboard for accouting things, a database of 10gb and more than 11M pages: (traduced by on-browser-google-trad)
    1 point
  13. Hi all, as promised, i'm back ? here is a full translation for the last master release 3.0.200 https://github.com/virtualgadjo/pw30200-lang-fr yes i know, that was fast but, actually that's because i kept translating all "minor" releases from the last master one and i haven't seen any new sentence from the 3.0.199 in case it could be useful to anybody... have a nice day
    1 point
  14. Hi everyone, I'm happy to present my latest project, which is a collection of guides and tutorials for web development with ProcessWire written by me. https://processwire.dev/ What is this? I have written several tutorials in this forum, and I wanted a central place to collect all my tutorials and put them in a logical order. processwire.dev is exactly that, a curated list of tutorials for different topics related to ProcessWire development. I have revised, updated and expanded most of my existing tutorials. There are also some completely new tutorials. Notable topics How to integrate Composer in your ProcessWire sites, and a general explainer for namespaces and autoloading. A two-part guide to using Twig with ProcessWire and adding custom functionality. How to create flexible content modules with Repeater Matrix fields and Twig. A general guide to performance optimization for ProcessWire. A starter guide for the "ProcessWire mindset" - how to structure your content. ... and much more! What's next? I hope this will be a useful resource to all of you fine people. Please note that these tutorials are very much opinionated, and they reflect my personal experience and development practices. So if you disagree with some of my conclusions, that's perfectly fine! I'm happy to discuss all my recommendations and approaches with you, so let me know if you have any feedback, suggestions or error corrections! I plan to expand this resource over time and already have some new topics planned. If you have suggestions for new topics, go ahead and post them here as well! Start reading now: processwire.dev
    1 point
  15. @monollonom Thanks! I really recommend giving Twig a try, once you get used to it you can never go back ? That's actually an area I don't have a good solution for yet. The problem is that all the template and field configuration lives only in the database, so it's not easy to put under version control. The simplest solution is to include a database dump in the version control, but that is a one-way street. Diverging versions of the database dump are really awkward to merge, so it's impossible for multiple people to work on a project independently and merge their work into one repository later, because they will have different database states that can't really be merged liked diverging versions of source code. Also, it doesn't help with continuous deployment (developing additional feature in a dev environment and updating a live site), because importing the database dump would overwrite the actual site content on the live site as well. The other solution are migration modules like RockMigrations which encode all changes as config files or migration scripts. However, writing those migrations is just so much work, especially with all the field properties which aren't really documented consistently. Mostly it just doesn't feel worth it, especially since it doesn't really solve the problem of multiple people working on a project independently of each other. I'm not even sure if there is a great solution for this. Fundamentally I would prefer if the entire template and field configuration was file-based so it could be versioned. But of course that's a completely different system design.
    1 point
×
×
  • Create New...