Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/28/2018 in all areas

  1. I usually post to the blog on Fridays, but I've been working on ProcessWire-based client projects this week, so nothing new to post today. I'm back to working on the core next week and continuing the 2FA development, so will have more next week. Thanks and I hope that you have a great weekend.
    5 points
  2. What you probably want to do is hook after Pages::saveReady instead. Something like this, perhaps: public function init() { $this->pages->addHookAfter('saveReady', $this, 'checkStateAndHide'); } public function checkStateAndHide($event) { $page = $event->arguments[0]; if(!$page->active){ $this->message("{$page->title} now hidden"); $page->addStatus(Page::statusUnpublished); } } Written in browser and not tested, but that's the general idea anyway. Note also the $this->page->addStatus() -> $page->addStatus() change: here you're trying to change the status of $page, not a class property $this->page. This should also work if you hook before Pages::save and just set the value there, but in my opinion saveReady is usually what you should use. If you hook after Pages::save, the page has already been saved, so you'd need to do another $page->save() or $page->save('field') in order to save any changes – but f you hook before Pages::save or to Pages::saveReady, the page has not yet been saved, so you can just set the value and it will be stored soon enough ? (By the way, you might want to check that the template of this page actually has "active" field – otherwise you could end up in a situation where pages without this field will be unpublished each and every time they're saved.)
    3 points
  3. Breadcrumb Dropdowns Adds dropdown menus of page edit links to the breadcrumbs in Page Edit. The module also adds dropdowns in Edit Template, Edit Field, Edit User, Edit Role, Edit Permission, Edit Language, and when viewing a log file at Setup > Logs. Configuration options Features/details The module adds an additional breadcrumb item at the end for the currently edited page. That's because I think it's more intuitive for the dropdown under each breadcrumb item to show the item's sibling pages rather than the item's child pages. In the dropdown menus the current page and the current page's parents are highlighted in a crimson colour to make it easier to quickly locate them in case you want to edit the next or previous sibling page. Unpublished and hidden pages are indicated in the dropdowns with similar styling to that used in Page List. If the option to include uneditable pages is selected then those pages are indicated by italics with a reduced text opacity and the "not-allowed" cursor is shown on hover. There is a limit of 25 pages per dropdown for performance reasons and to avoid the dropdown becoming unwieldy. If the current user is allowed to add new pages under the parent page an "Add New" link is shown at the bottom of the breadcrumb dropdown. If the currently edited page has children or the user may add children, a caret at the end of the breadcrumbs reveals a dropdown of up to the first 25 children and/or an "Add New" link. Overriding the listed siblings for a page If you want to override the siblings that are listed in the Page Edit dropdowns you can hook the BreadcrumbDropdowns::getSiblings method and change the returned PageArray. For most use cases this won't be necessary. Incompatibilities This module replaces the AdminThemeUikit::renderBreadcrumbs method so will potentially be incompatible with other modules that hook the same method. https://modules.processwire.com/modules/breadcrumb-dropdowns/ https://github.com/Toutouwai/BreadcrumbDropdowns
    1 point
  4. This week we’re going to discuss a new security feature that’s currently in development on the dev branch: 2-factor authentication. In this post we look at the benefits of 2FA, how it works, the coming implementation in ProcessWire, and more: https://processwire.com/blog/posts/2-factor-authentication-coming-to-processwire/
    1 point
  5. As threatened in the Pub sub forum in the "What are you currently building?" thread, I've toyed around with Collabora CODE and built file editing capabilities for office documents (Libre-/OpenOffice formats and MS Office as well as a few really old file types) into a PW module. If you are running OwnCloud or NextCloud, you'll perhaps be familiar with the Collabora app for this purpose. LoolEditor Edit office files directly in ProcessWire Edit your docx, odt, pptx, xlsx or whatever office files you have stored in your file fields directly from ProcessWire's page editor. Upload, click the edit icon, make your changes and save. Can be enabled per field, even in template context. Currently supports opening and saving of office documents. Locking functionality is in development. See the README on GitHub for installation instructions. You should be reasonably experienced with configuring HTTPS and running docker images to get things set up quickly. Pull requests are welcome! Here is a short demonstration:
    1 point
  6. Check out the created dates on the copies. There's obviously something not right there, but not sure what exactly. Hopefully someone who knows more about these things can shed some light. Would be worth seeing if you get the same issue with a new clean PW installation. Here is how my table looks for comparison:
    1 point
  7. Is the cropped copy still there after you save the page? If so then I don't understand how that's possible, because the inputfield gets the images it displays from the field value (in the database), so if you see two images in the inputfield then there should be two images in the field value. Have you had a look in phpMyAdmin to see if you can see the copy in the field table?
    1 point
  8. Works for me also. Screenshot below has crop saved from the first image: And if I try cropping an image in a field with max files = 1 then there is no "save copy" option in the cropping dialog (as expected).
    1 point
  9. Hi @szabesz I'm also on 3.0.108 and it works for me as expected. After cropping an image I have to images in Pageimages. What type of formatted value do you use for this field?
    1 point
  10. Ok, I just installed Ampps and imported a few website backups and started fiddling around. I must say that Ampps has a nice interface to work with, but it is clearly slower compared to Laragon.
    1 point
  11. If you go to the laragon website for downloads there are only windows installations. There seems to be a Mac project here: https://github.com/laravel/valet
    1 point
  12. I use Laragon also. Would be interesting to know which one works faster when using it for website development: Laragon or Ampps. Lets find out this weekend.
    1 point
  13. hi teppo, muchas gracias, i will try it on monday in office, but i think i could work. of course ?
    1 point
  14. I haven't used AMPPS in a while. I used to prefer XAMPP, but I switched to Laragon recently. Less bloat, and switching to another PHP version is easier.
    1 point
  15. Old thread and this is a bit off-topic, but this bit caught my attention, so I thought I'd mention it. The Link Checker module I released some time ago (it was never quite finished, hopefully I'll get a chance to work more on it soon...ish) makes use of a crawler script that is intended to run as a background process and (u)sleeps between external requests. Reading this made me wonder if I should rethink my strategy, but a quick Google search for "is php sleep always bad" resulted in this Stack Overflow thread discussing valid use cases for sleep – and sure enough, the first one raised was "some kind of a crawler". I guess there's at least the off chance that what I'm doing is not entirely evil ? That being said, though, I'll have to agree that there are very few valid use cases for sleep, and most situations could no doubt be better handled using a different approach. I'm also pretty sure that Link Crawler is the first piece of production code I've ever used sleep or usleep for ?
    1 point
  16. Check that you have AdminThemeDefault set as the default admin theme in /site/config.php $config->defaultAdminTheme = 'AdminThemeDefault';
    1 point
  17. At giving me an absolute headache! Sorry for the clickbait title, I just need some emotional support. Currently working on a website using WordPress as we needed eCommerce and their current platform is WordPress, didn't make sense to change them to a platform such as SnipCart that would take a percentage of their sales. WordPress is horrible! WooCommerce is horrible! ProcessWire things make sense, you only have to read the documentation for like a second and everything makes sense. WordPress, I'm sieving though WP_Query, the_post, the_loop, the_row, the_title. And stuff like getting an image size like $image['sizes']['large'] then in other cases you have to do $post->the_title() sometimes you do the_title(). Now I'm working with WooCommerce. the_type() returns "Simple" the_price() returns nothing, printing what $product is returning and everything is there. I'm going to pull my hair out. ??
    1 point
  18. Yeah keep on wp trolling, it feels good I know. But lets get real for a change, it's 2018 and not 2010 any more when wp was total crap. Plugins and safety have been improved since then. I know people who deliver websites faster than I do and make more money with wp than I do ! All they do is go to themeforest or envato and search for a cool looking template with forms, mail, client base and the whole shebang for around 50 or 80 dollar. It takes them less then a week to set it up and then sell it somewhere between 500 and 1500 dollar. And clients like the wp admin because it only takes simple mouse clicks for them to edit a wp site with new text, pics or prices. How I found out all this ? Simply because I get called by offices, real estates, photographers, etc. because their webmaster/developer took off, disappeared or they ended up with agreement conflicts. They need somebody to take over. No backups were made for half a year, cpanel access has gone, yearly domain registry has gone, etc. All they have left is the wp-admin login. So the more I got involved the more I started to see what is going on in wp land. The reason why I stick to pw ? Because working with wp dumbs you down to a copy and paster - drag and dropper. Working with pw upgrades your skills and you learn to webcode. But really, when it comes to working hours and making money, wp is the better choice.
    1 point
  19. If you have a lot of fields on the page/template in question it would be worth increasing max_input_vars to see if that solves it. https://www.virendrachandak.com/techtalk/big-forms-and-php-max_input_vars/
    1 point
  20. This. I think these two statements summ it up pretty well – @Knubbi's post is totally legit imho. Those who argue otherwhise (expect for @bernhard's point of PW becoming more popular not beeing a goal at all) miss the point I guess – yes you can do all things with PW and, yes we don't want a Drupal front-end-hell and for sure no second WP – BUT for people looking into PW there could be better ways to start: I think @joshuag provied a solution that has both worlds – but it involves both Developers and Ryan. A strong Site-Profile market: Profile should have a well visible market where they could also be sold … directly integrated into the PW setup and processwire.com Like Themes (which are often bundling other modules f.e. shopiing funcitonality etc.) they could be very powerfull, within their provided scope of Templates and Fields, as are WP Themes – Site Profiles come with the dependencies they need: for example Blog functionality etc. and provide a fast starting point for those who need what the profile combines. At the same time, they stay true to PW as they are just ready-made implementations of PW, not bloating the core or changing the way PW works One can still start with a blank site I think, what we miss is, that WP does not really work any different – there is a system and then there are some Themes on top of it providing basic functionality – But only well integrated with the Base-System. As soon as you want to add this or that – it requires manual work or it might look goofy or breaks stuff. We have the same situation with PW Profiles: We don't have to change the way PW works, what we need is strong support for readymade Sites, coming together with a few PW-Templates and Fields. Now this is not where most of us work as @joshuag said – but its a totally valid market and could easily life side by side with those crafting sites from the blank slate.
    1 point
  21. Wordpress has one thing different than ProcessWire, which enables them to have such a high quality default theme: Just three types of data, where two are quite similar. It‘s post, pages and comments. The rest is wysiwyg content all the way. In Processwire we don‘t have that and the power of it comes from not having that. Wordpress themes are just pretty frontends for a nearly non changing backend structure, which it had for years. In ProcessWire the first thing you probably do is creating your own content types (templates) and that‘s what no default theme can cater for. How should it know how to display that random blob of data you decided is a entity in websites domain? So there‘s not much incentive to spend a great amount of money on a high quality theme, which is unusable for just about any reasonable usage of processwire beyond „first impression“ after installation.
    1 point
  22. Hi, ProcessWire does not compete with the WordPress market... Thank the lord. ProcessWire is for developers with basic to advanced knowladge who need a tool to make their vision a reality, easier. A framework. Much like jQuery. You must have some knowledge of JavaScript to fully understand jQuery. Just like if you were to develop for WordPress, you'll need PHP knowledge. Well, unless you are looking to sell themes. I don't know why a PHP developer would touch WordPress. ProcessWire's API is so much easier. So to answer your question, in ProcessWire you start here - http://php.net/docs.php then here - https://processwire.com/docs/ In WordPress you start here - https://wordpress.org/plugins/ then here - https://codex.wordpress.org/FAQ_My_site_was_hacked Edit: Notice how the 'My site was hacked' question was in the Frequently Asked Question section... Should it really be a frequently asked question? Because I don't think I've seen it asked once on the ProcessWire forum. Edit2: Most people here just use the blank profile and see the other profiles as bloat.
    1 point
  23. It's very, very bad practice to use sleep() in a server side script, that is why documentation on working around the pecularities of PHP's buffering (and thread execution) is so sparse. sleep() blocks the whole thread it is called in, and under heavier load, it makes servers utterly unresponsive. There also fine differences in buffering behaviour depending on how PHP is executed (mod_php, FastCGI, classic CGI...) The usual solution to situations where you are tempted to call sleep() is to poll until the condition you need to wait for has been reached, either using classic reloads for the current page or with AJAX. Nowadays, websockets are also used to split off parts of the work to different processes and notify the "owning" session of changes of state in the backend.
    1 point
  24. Not mine but... .. lots of inspiration here: https://www.lapa.ninja/category/portfolio/ http://www.hixle.co/?s=portfolio .. some free templates here: https://html5up.net/ https://www.styleshout.com/ .. some premium stuff here: https://themeforest.net/category/site-templates
    1 point
  25. Have to make a little bit advertising a hero pw member that every iteration of his portfolio is a kind of inspiration for me personal: https://siebennull.com/ credits goes to http://www.mademyday.de/
    1 point
  26. mine is here: https://www.baumrock.com/portfolio/ but I'm not really happy with it so I also look forward to getting inspiration ?
    1 point
  27. I did try this and it did not work, because getById returns a PageArray, not a Page object in spite of the get part in the method name. Using something like first() on the returned result seems to give you the cashed (changed) version of the page. But there is a getOne option that managed to do the trick. So I could only get it to work like this: $oldPage = $this->wire('pages')->getById($page->id, array( 'cache' => false, // don't let it write to cache 'getFromCache' => false, // don't let it read from cache 'getOne' => true, // return a Page instead of a PageArray ));
    1 point
×
×
  • Create New...