Jump to content

Leaderboard

Popular Content

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

  1. Have you ever had a hard time setting the values of an options field via API? Grab RockOptionsAPI ? https://github.com/baumrock/RockOptionsApi RockOptionsApi ProcessWire module for easy manipulation of option-fields via API $page->getOptions('yourfield') ->add('foo') ->remove('bar') ->save(); Readonly options field renderer By default options fields that are set to readonly via the locked collapse state only show selected options and hide other available options. That might not be what you want. Here is an alternative that turns this: Into that: Simply call $form->readonlyOptions('yourfield') in the ProcessPageEdit::buildForm hook or when using MagicPages in the editForm() method: $wire->addHookAfter("ProcessPageEdit::buildForm", function($event) { $form = $event->return; $form->readonlyOptions('yourfield'); });
    3 points
  2. Try this? <?php $events = $pages->find('template=calendar-post'); // populate dayname according to user’s language $grouped = [ 'Mon' => (object)['events' => [], 'dayname' => 'Ponedeljek'], 'Tue' => (object)['events' => [], 'dayname' => 'Torek'], 'Wed' => (object)['events' => [], 'dayname' => 'Sreda'], 'Thu' => (object)['events' => [], 'dayname' => 'Četrtek'], 'Fri' => (object)['events' => [], 'dayname' => 'Petek'], 'Sat' => (object)['events' => [], 'dayname' => 'Sobota'], 'Sun' => (object)['events' => [], 'dayname' => 'Nedelja'] ]; foreach ($events as $event) { $dayname = date('D', $event->getUnformatted('Start_date')); $grouped[$dayname]->events[] = $event; } ?> <div class="tabs movies"> <!-- tab buttons --> <ul> <?php foreach ($grouped as $anchor => $day): ?> <li> <a href="#<?=$anchor?>"><?=$day->dayname?> (<?=count($day->events)?>)</a> </li> <?php endforeach;?> </ul> <!-- /tab buttons --> <!-- tab contents --> <?php foreach ($grouped as $anchor => $day): ?> <div id="<?=$anchor?>"> <?php foreach ($day->events as $p): ?> <div class="row movie-tabs"> <div class="col-md-2 col-sm-3"> <a href="<?=$p->url?>"><img alt="Movie title" src="<?php echo $config->urls->templates?>assets/images/movie-6.jpg"></a> </div> <div class="col-md-10 col-sm-9"> <span class="title">Action, Adventure, Fantasy</span> <h3 class="no-underline"><?=$p->title?></h3> <?=$sanitizer->truncate($p->body, 150);?> <p><a class="arrow-button" href="<?=$p->url?>">Beri več</a></p> <div class="row"> <div class="col-md-8 col-sm-9"> <hr class="space-10"> <span class="viewing-times"><i class="material-icons">access_time</i> Viewing times</span> <span class="time past">14:45</span> <span class="time">18:30</span> <span class="time">20:30</span> <span class="time">24:45</span> </div> <div class="col-md-4 col-sm-3 running-time"> <hr class="space-10"> 105 mins <span class="certificate">15</span> </div> </div> </div> </div> <?php endforeach ;?> </div> <?php endforeach ;?> <!-- /tab contents --> </div>
    3 points
  3. Very cool. I developed something like this for Solution Innovators, along with a front end for our customers to view their invoices and pay off their total balance. I like how you modified the page editor here. I used separate pages for the invoice items and payments instead of repeaters because I found repeaters difficult to work with when summing and reporting data, and also mapping them to models required some hacking (or did at the time - https://github.com/processwire/processwire-requests/issues/239). How are you handling this? (or is that beyond the feature set of this project?) We also built our whole time tracking software on ProcessWire :)
    2 points
  4. Eventually from the First Screenshot ? „Beri več“
    2 points
  5. @androbey - adding the Slack logging option is definitely on my list. However, keep in the mind that I think a throttle is still probably important - I can see a situation where your Slack board is flooded with a lot of errors very quickly.
    2 points
  6. Drupal is built on top of Symfony, nothing bad about that and also Composer (which I use regurally in Processwire too). PHPUnit and Nightwatch: those two obscure strangers to me? I've been always keen to learn new technologies, as long as they had something I feel better from the ones I knew at the time and...let me say, Drupal is not even close to an improvement in any way for my tastes. Just a couple of further toughts after some more time spent on it: 1) You have to clear the cache every time (EVERY TIME) you change something to your twig template files. Added a variable? Flush that cache. Added a new file? Flush that cache. Imported something? No problem, but flush that damn cache. You can do it installing a CLI module (Drush) and type a string to do so but....come on.... 2) There is no concept of a Blank Site Profile (like my loved PW goto profile). Every site has to have a theme, and 99% of the time it has to extend from another one whom has tens of twig files (that MUST follow a strict naming convention based on regions, blocks and whatnot) to copy from. It's not my way to develop, never was. Yes, you are right and it's totally nonsense. I'm working on it. There is one site (a digital report) for a mid/large company I've made some time ago (http://novacoop.info) that has to be updated every year with new content and design. I will push to not change stack and do my best to expose PW potential then. I know, dammit! :)
    2 points
  7. Hey @Richard Jedlička thx again for your great module! I'd have a request: Would it be possible to add a second icon to the template edit button on the page editor so that when clicked it opens the corresponding file in the IDE? The link could easily be taken from tracy settings and the filename is easy to get via ReflectionClass: $r = new \ReflectionClass($page); db($r->getFileName()); Similar to the field edit links there could be a second icon on hover that, when clicked, takes you directly to the PHP file of the custom page class that is responsible for the currently viewed page's template ? What do you think?
    2 points
  8. This week I've been working on something a little different: developing a new site profile in ProcessWire. Actually, I should probably call it an application profile rather than a site profile, as it's not a website profile. Instead it's a profile for an invoicing application in ProcessWire. Though you would install and run it on a web server, but it would be an independent application rather than part of a website... perhaps something you run in a subdirectory, subdomain, or even localhost. This is something I've been wanting to build for awhile—ever since the invoice service I use raised their rates beyond my budget. So I thought I'd build a replacement that I could use, as well as share for others that might have a similar need. I think it might also be a pretty decent PW profile example in general, too. I'd originally considered building it as a Process module but decided not to for a few reasons. Though the biggest one is that a site profile enables the greatest potential for customization and expansion according to each person's needs. Since you can expand upon it by adding your own fields and templates, or editing existing ones, most can really tailor it to their own needs a lot more easily than they could if it were a Process module. Likewise, since the actual invoices (and invoice emails) are rendered from front-end pages, you can customize the look and feel of them to match your brand very easily. (This is something I always wished I could do with the invoice service I've been using previously) This invoice profile requires nothing other than the ProcessWire core. It has no 3rd party or Pro module dependencies. I've got it largely functional at this stage, though will be putting a couple more weeks work into it before releasing it. I'd like to build in the option for clients to pay an invoice with a credit card (via Stripe) for instance. Below are a few screenshots of the work in progress. First is the page-list which shows the current invoices in the system and their status. (click image to view larger) As you can see, there are also pages for Clients and Settings. The client pages contain all the information about each client that invoices can be created for. The Settings page is where you can edit your own company information, logo and billing preferences. Next is the invoice editor. Here we have a repeater for each line item in the invoice. We also have a repeater for payments. All of the totals add up automatically as you type (Javascript added via hooks). They are also calculated automatically at the server side, so that everything stays consistent whether working with the API or in the page editor. (click image to view larger) At the bottom of the invoice editor you'll see a collapsed input for "Invoice action". This is where you can select actions to apply to the invoice. The two we currently have are "Email invoice to client" and "Email invoice to another address". Next up is what we see when viewing the invoice on the front-end. This is just the output of a template file but it is optimized for printing, saving to PDF and sending through email. I've kept it intentionally simple but of course the logo would be replaced with your own and all markup/styles are fully under your control. (click image to view larger) What I plan to add next are payment options, enabling a client to pay by credit card right from the invoice URL or email. What do you think, is this type of PW profile useful to you or someone you know? I've initially built it towards my own client invoicing needs, but I'm curious what other features you would like it to have? Or do you think it's better to keep it simple so that people can more easily take it in different directions? Thanks for your feedback. Have a great weekend!
    1 point
  9. Hi, I don't know if this is the right place to ask this, but I hope so. Tracy Debugger is of course excellent and a must have for each site. Right now I am using the "email notification" feature, but with Tracy's "email-sent"-flag I'd have to manually check the log file, if some error ocurred in the meantime. I was wondering if there is any possibility to add an additional logger besides the log file, which has no "throttle", e.g. something like a Slack logger (https://tracy.nette.org/en/recipes#toc-custom-logger) (without the need to adjust the module myself). Hope this makes sense. Thanks in advance!
    1 point
  10. Not sure I fully follow the issue - but wouldn't it be easier to just use an email MSP like Mailgun to route all your emails. You can send 10's of thousands of emails at low cost this way and not have to worry about hitting limits? Plus the WireMailgun module works a treat ?
    1 point
  11. @pwired Now change "Drupal" with "Wordpress" and it's still remaining a valid sentence. :)
    1 point
  12. I just wanted to share a small module I just made, that can inherit values from pages, that are higher up in the page tree. This inheritance will only show for formatted output, so for example in listers or in the frontend. When using the unformatted value one will see, if a field is really set or not. <?php class FieldtypeInheritInteger extends FieldtypeInteger { public static function getModuleInfo() { return array( 'title' => 'Inherit Integer', 'version' => 101, 'summary' => 'If empty tries to get values of the same field from further above the pagetree. This does only work for formatted values so empty values won\'t ne overwritten by editing a page.' ); } public function ___formatValue(Page $page, Field $field, $value) { if(!$this->isEmptyValue($field, $value)) return $value; $parent = $page->parent("$field!=''"); if($parent->id) return $parent->getFormatted($field); else return $value; } public function ___markupValue(Page $page, Field $field, $value = null, $property = '') { return $this->___formatValue($page, $field, $value); } }
    1 point
  13. OMG, thank you very much it works great ? also the count numbers! ? Exactly what I needed. I need to save this for further use .. Thank you very much for help ? Much appreciated ? R
    1 point
  14. strftime() is deprecated, you shouldn’t use it anymore. You can use IntlDateFormatter to format localised dates: $weekdayFormatter = new \IntlDateFormatter('es_CO', \IntlDateFormatter::FULL, \IntlDateFormatter::NONE, null, null, 'eee'); $events = $pages->find('template=calendar-post'); $grouped = []; foreach ($events as $event) { $dayname = $weekdayFormatter->format($event->getUnformatted('Start_date')); $grouped[$dayname][] = $event; } I wouldn’t really do this because you may get unexpected results and maybe even characters that are illegal in URL fragments (?). For example with de_DE you’ll get “Mo.” and “Lun.” with es_CO. I would probably keep the URL fragments English and have a second localised string. Also, the method above will only give you days that actually have events, so maybe pre-populate the $grouped array with all 7 days.
    1 point
  15. You can use the new getPageListLabel() method of custom page classes to mimic a table-like list: <?php namespace ProcessWire; // placed in /site/classes/BasicPagePage.php class BasicPagePage extends Page { public function getPageListLabel() { return "<span style='display:inline-block;width:200px;outline:1px solid black;'>{$this->id}</span><span style='display:inline-block;width:300px;outline:1px solid black;'>{$this->path}</span>"; } } Brilliant new feature ?
    1 point
  16. I see, well, try this maybe? $events = $pages->find('template=calendar-post'); $grouped = []; foreach ($events as $event) { $dayname = date('D', $event->getUnformatted('Start_date')); $grouped[$dayname][] = $event; }
    1 point
  17. Please use code formatting with the correct language. It’s the „<>“ button in the comment editor. Here it is: <?php $events = $pages->find('template=calendar-post'); $grouped = []; foreach ($events as $event) { $dayname = $datetime->date('%A', $event->Start_date); if (isset($grouped[$dayname])) { $grouped[$dayname][] = $event; } else { $grouped[$dayname] = [$event]; } } ?> <div class="tabs movies"> <ul> <!-- Events by day START --> <?php foreach ($grouped as $dayname => $eventsingle): ?> <li> <a href="#<?= $dayname ?>"><?= $dayname ?></a> </li> <?php endforeach;?> <!-- Events by day END --> <li class="date"><span>Wednesday, 8 March</span> </li> </ul> <!-- Events by day END --> <?php foreach ($grouped as $dayname => $eventsingle): ?> <div id="<?= $dayname ?>"> <!-- EVENT START --> <?php foreach ($eventsingle as $p): ?> <div class="row movie-tabs"> <div class="col-md-2 col-sm-3"> <a href="<?=$p->url?>"><img alt="Movie title" src="<?php echo $config->urls->templates?>assets/images/movie-6.jpg"></a> </div> <div class="col-md-10 col-sm-9"> <span class="title">Action, Adventure, Fantasy</span> <h3 class="no-underline"><?=$p->title?></h3> <?=$sanitizer->truncate($p->body, 150);?> <p><a class="arrow-button" href="<?=$p->url?>">Beri več</a></p> <div class="row"> <div class="col-md-8 col-sm-9"> <hr class="space-10"> <span class="viewing-times"><i class="material-icons">access_time</i> Viewing times</span> <span class="time past">14:45</span> <span class="time">18:30</span> <span class="time">20:30</span> <span class="time">24:45</span> </div> <div class="col-md-4 col-sm-3 running-time"> <hr class="space-10"> 105 mins <span class="certificate">15</span> </div> </div> </div> </div> <?php endforeach ;?> <!-- EVENT END --> </div> <!-- Events by day END --> <?php endforeach ;?> </div> What is $datetime? Also, what is $event->Start_date? That is to say, what types are they?
    1 point
  18. Not a Drupal developer (unless a small course on D6 years ago counts...) so this is the best I can do. You've got this ? Honestly, my two cents would be to try to embrace Drupal properly before making decisions about whether you like it. In my experience every major platform has ins and outs, some of which may take a while to grasp. I'm sure there's a lot of good in Drupal as well; for an example it sounds like they have solid integrations with many development-oriented tools, from Symfony components to Composer, PHPUnit and Nightwatch for testing, etc. Silver lining: sounds like an interesting learning opportunity! As for pushing ProcessWire, that may indeed be hard, especially if they have a good flow with Drupal. In terms of sales Drupal likely has an edge as well: a lot of folks have the impressions that Drupal is the go-to system for "enterprise open-source" content management, which is can make it easier to sell to certain types of clients. Perhaps suggest doing some smaller or in-house projects with PW, and see where it goes? Pushing anything too hard, especially to other developers, has a tendency to backfire ?
    1 point
  19. My first thought was that Ryan is building his own rich text editor, maybe using a toolkit like ProseMirror. Let's keep guessing and maintain the hype ?
    1 point
  20. Let's not forget that CKEditor has many (returning) forum posts/questions about it's behavior and associated hard to find configurations Keep in mind that something like CKEditor5 will be just too much for many clients/end users/office workers/ who are in need for a more easy and intuitive to use editor: https://getcontenttools.com/demo
    1 point
  21. Loving it ? You can't do that ? What is it? https://github.com/quilljs/quill ? https://github.com/summernote/summernote/ ? Also, some insights on that part would be especially interesting ? Fingers crossed for a smooth transition! Thx for all your great work!!
    1 point
  22. @ryan did you consider https://imperavi.com/ products?
    1 point
  23. Same issue here, unable to log in using forum credentials (or any old information I can think of for that matter). This might need some attention from @ryan — or perhaps @Pete, as I seem to recall that it was him who originally set this part of the site up ?
    1 point
  24. Hi @bernhard, Honestly, I find the way in which browsers actually implement srcset and sizes to be really confusing. In the previous PageimageSrcset I included a bit of javascript for debugging, as I found it was sometime difficult to even tell which image was being used (if they were just different width variations). What complicates debugging is that the browser will use the largest image it has in the cache, so if you've loaded the page at desktop width and then try to see how it'll respond at a smaller screen size, it will still display the larger image. What happens if you add 1280 2x into the set? Cheers, Chris
    1 point
  25. https://bluefox.studio/ What makes this project cool: We rebranded the clients logo, turning it into a 3D, Three.JS intro presentation The client can mange all aspects of the site via ProcessWire populating their impressive showcase Custom front-end design and UI and full content management across evey aspect of the site. Modular system for page content providing maximum flexibility on page construction. SEO module with global editing section across all pages. Global shared content modules.
    1 point
  26. Thx for the feedback @dotnetic I put that into the video for everybody to see (realise) that it's really just one click to start using migrations. No other magic that needs to be done or has been prepared only for the video. Also the migrate.php file is created on install, so I thought that is an important thing for everybody to see who is not familiar with RockMigrations ? Thx, happy to hear that ? IMHO it is not only the best tool for migrations in ProcessWire. I've watched several videos about other migration tools in other CMSs and IMHO what we have in our PW world is much easier to use and sometimes also more powerful! The API based approach turned out to be a very reliable technique and it feels so much more natural to just add migration instructions to - for example - the migrate() of a pageclass than writing single migration files with an upgrade() and downgrade() somewhere and then end up with multiple files where you have no idea what they do (unless you inspect every single file). In RockMigrations you see what it does at first sight. And you get GIT diffs when anything changes. @netcarver do you still want to use file-based migrations or have you already changed your mind? I mean... you can also do that with RockMigrations - it's just not what I'm doing but that does not mean it's not possible or bad ? Maybe there are also good reasons for such an approach, so I'm happy to get input.
    1 point
  27. That's a brilliant idea, thanks for sharing! Nearly every site I work with has something along those lines at template level. While that works just fine, this helps avoid some pointless if-mess
    1 point
  28. Just $pageArray-> has("id=1001|1003") will do it.
    1 point
  29. As 1st of november the company I work for is going to be integrated into an another, bigger, one where Drupal is the main web driver other developers work with. This is something I have to adapt with, due to the fact that I'm the only one I know, and love, to work with Processwire for web development. I have plans to diffuse my knowledge with PW and convince to use it for all the sites we are going to develop, but right now I'm not very confident to be successful in the short/mid term. I've spent the last two days trying to figure out the mechanisms and the paradigms behind Drupal but the more I discover the sadder I get. Concepts likes regions, blocks and content types don't sound that bad, but bad and alien is their way to act together. Way more intricate and anti-logic as I'm used with PW, where its logic when working with data arises and shines. Moreover there are template files naming convensions, which you must stick with in order to build site pages and pay a good amount of attention to not reach to an "inception-like" structure, an announced mess. There is twig as template engine, which I don't know (yet) but that's the easy part I'm not worried about. Oh...and the design and UX of the backend sucks, IMHO. So, after this good amount of complaining I'm here to ask if some of you with previous experience with Drupal could give me some advices on how to grasp the basics and learn a workflow as similiar as PW can offer. Links, tutorials, modules and whatnot are very welcome from you (virtual hugs too ? ) Thanks in advice. Lorenzo
    0 points
×
×
  • Create New...