Jump to content

Leaderboard

Popular Content

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

  1. This week updates continued with various .js files in the core (for jQuery 3.6+ compatibility). A few external libraries were also updated to the latest versions, including jquery-tablesorter, jquery-ui-timepicker, magnific-popup and vex. And finally, InpufieldTinyMCE has been added to the core! That's a lot of updates, but there's not a lot more to write about these updates because we covered the jQuery updates last week, and InputfieldTinyMCE has been the topic of several past posts. But now we've got everything together and running smoothly in ProcessWire 3.0.216. I think we're now ready to focus on getting the next main/master version out in the coming weeks. There likely won't be an update next week because I'll be traveling for a few days, but will be back to a regular schedule the following week. Thanks for reading and have a great weekend!
    2 points
  2. Extends Pagefile to use Cloudflare Images, Stream and R2 storage to serve files. https://github.com/nbcommunication/CloudflareAssets The main purpose of this module is to allow ProcessWire to be used in an auto-scaling multi-instance environment. By serving file assets from Cloudflare, it is not necessary to have all file assets copied to all instances and we also get the benefits of serving assets from a CDN. How it works When a Pagefile is added in the admin or via the API, it is uploaded to Cloudflare's R2 storage service. Additionally, if the file is an image, it is uploaded to Cloudflare Images, and if the file is a video it is uploaded to Cloudflare Stream. When a URL for the Pagefile is requested e.g. $pagefile->url(), the appropriate Cloudflare URL is returned. As ProcessWire's admin still requires the file to be available locally, in a multi-instance setup if a file is not available it is downloaded from the 'master' copy in R2. This module is not yet being used in production. There may be changes to how Images work in the coming months as features are still being rolled out to this Cloudflare service. Cheers, Chris
    1 point
  3. It’s only in the /wire/ directory so you can do your own thing in /site/.
    1 point
  4. Sure, you need to understand at least the basics of CSS and SCSS before moving on to bootstrap or similar. To begin with, you might want to learn about how to shape page layouts with CSS as that is an essential part of website design.
    1 point
  5. lol entirely forgot I provided the exact same answer... at least I'm consistent ?
    1 point
  6. OK, other people have struggled with same problem too. Using the module upgrade() function is the way to go, that works. https://processwire.com/talk/topic/26912-module-update-function/#comment-222616 Problem solved ?
    1 point
  7. Sum up for the last weeks: I learned a lot about HMTL and CSS. Now i will try to do some own sites and see how far i can get... One question about CSS is: Do you use frameworks or do you style up your projects with your own "little" CSS framework? On this question there are also different youtube contributions of the above mentioned channels, which are very good! But also i want to ask here in the PW community, how you "usually" start projects? Do you usually first take a framework (e.g. bootstrap) and only in specific cases style up the project on your own, or do you go the other way round and take your own styles and only for specific reasons take a framework, and why? Until now, i think, it makes more sense to study CSS and JS itself before studying bootstrap, because their docs are also very escalating and bloated. And after all your work "looks like bootstrap", except you come up with a lot of work on top to "restyle" it that it looks a little bit different. Tanks for all your input on that and Best Regards!
    1 point
  8. Yeah, I have tried that, but nothing had happened. But maybe I have done something wrong. I will take a look if owerwriting, as you have it done, will be the better way to go. Thanks for your help!!!
    1 point
  9. Have you tried hooking after your module’s ___upgrade() ? You could also put your code in there like I did for one of mine
    1 point
  10. Thanks @bernhard, it works! I would never have believed that this was really possible. If you knew for how long I have tried this ... The generated markup is now correctly rendered as if a guest user would see it in the frontend: User is not logged in, user has the role "guest", user()->isGuest() is true and user()->isSuperuser() is false. Everything works perfectly ? You are genius. Many, many thanks!
    1 point
  11. I think I've fixed that ? Does it work now?
    1 point
  12. <?php $wire->addHookAfter("Pages::saved", function (HookEvent $event) { $page = $event->arguments(0); // early exits based on your needs if($page->template != 'your-static-template') return; // save some variables for later $lang = $this->wire->user->language; $user = $this->wire->user; // create markup for all languages // render everything as guest user $this->wire->users->setCurrentUser($this->wire->users->getGuestUser()); foreach ($this->wire->languages as $l) { // key for page meta data, eg static-german or static-english $key = "static-" . $l->name; // set temp language $this->wire->user->language = $l; // render page and save it to meta data $page->meta($key, $page->render()); } // change user back to what it was $this->wire->users->setCurrentUser($user); $this->wire->user->language = $lang; }); This would save the static markup in $page->meta("static-default") or $page->meta("static-english") etc... You can then do whatever you want with that piece of data ? You could also create files instead of saving everything to the database - depends on your setup which would be better.
    1 point
  13. I'm not yet sure what ProcessWire could do here since it's the template file that controls all the logic of what gets output. But I may not yet fully understand the request, so I'll use an example or what I do understand below. Markup Regions don't have control over what your template file spends time rendering, just what gets output at the end. So there wouldn't be much benefit to having output of partials when it still has to spend the time to render everything, whether used in the output or not. Instead, you would need some logic in your template file in order to selectively render partials, and gain a performance benefit from it: <?php namespace ProcessWire; // render just $part if requested, otherwise render all parts $part = $input->get('part'); // i.e. header, content, footer ?> if($part == 'header' || !$part): ?> <div id='header'> ...header markup... </div> <?php endif; ?> if($part == 'content' || !$part): ?> <div id='content'> ...content markup... </div> <?php endif; ?> if($part == 'footer' || !$part): ?> <div id='footer'> ...footer markup... </div> <?php endif; ?> <?php if($part) return $this->halt(); ?> In the above example, if the page is requested without a "?part=" query string in the URL, then it renders everything (header, content and footer). But if rendered with a "?part=content" query string in the request URL (for example), then it would render and output just the <div id='content'>...</div>.
    1 point
  14. Freaking awesome!! I've been thinking about doing the same for bunny.net these last couple weeks and the approach I had outlined in my mind would have been very similar to yours. Very well done, I'm super excited for this ?
    1 point
  15. Others have mentioned how to do it in the Markup or in $config. If you wanted to do it using JS, this is how: document.body.addEventListener("htmx:configRequest", (event) => { // add XMLHttpRequest to header to work with $config->ajax event.detail.headers["X-Requested-With"] = "XMLHttpRequest" }) https://htmx.org/events/#htmx:configRequest Not meaning to hijack this thread and I haven't read through everything and I don't know how Markup Regions work...just want to mention that I have set up a GitHub repo for htmx + Alpine.js + Tailwind CSS + ProcessWire demos. It is early days but I am hoping to add all sorts of demos there, from basic to advanced ones, including backend and frontend examples. I'll create a thread for this work at a later time. Meanwhile (and I have nothing against the OP wish), I am happy to take on a challenge like 'how would you build this complex page using htmx' . OK, maybe not as complex as this app: From React to htmx on a real-world SaaS product ?: (too much todo, etc.). Edit First two demos are discussed in this thread:
    1 point
  16. This is an excellent idea and would simplify some of the gymnastics required when working with HTMX or similar libraries. I think this would fit nicely into how ProcessWire works.
    1 point
  17. There is an “upgrade” function defined in the Module class you can use (same as “install” / “uninstall”). You don’t need to use a hook for this. https://processwire.com/api/ref/module/ (here’s an example in a module I made)
    1 point
  18. Latest Tracy + PW master --> saving tracy settings worked - maybe a warning could be thrown to make that more obvious? if(!is_array($this->data['styleAdminType'])) $this->warn('Please save tracy settings');
    1 point
  19. Just some explanation because it is interesting... This isn't something that is specific to Repeaters - it applies to any selector used on a PageArray/WireArray (a Repeater field returns a PageArray). When you do $some_pagearray->find() this is different to a $pages->find() - the method name is the same but they are actually totally different methods. See find() method in the PageFinder class vs the WireArray class. When using $pages->find() the method refers back to the fieldtype for each queried field and the fieldtypes can do some special preparation to the queried value. In the case of a Datetime field the value is passed through strtotime() if it is a string. So this allows "today" to be converted to a timestamp. But when using $some_pagearray->find() this process does not happen, so the queried value must be a timestamp. Another gotcha to watch out for is using the page status as a string in a selector. With $pages->find() you can do something like "status!=hidden" but this won't work with a selector in $some_pagearray->find(). I think it would be nice if things like this did work with PageArrays - there is an open request for it.
    1 point
  20. You could also use a hook. $this->addHookAfter('ProcessPageEdit::execute', function(HookEvent $event) { // Get page being editted $page = $event->object->getPage(); // Only use on pages with the product template if ($page->template != 'product') return; // Set the title & you also have access to all $page fields $title = "New title"; // Overwrite the processBrowserTitle $this->wire('processBrowserTitle', $title); }
    1 point
×
×
  • Create New...