Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/29/2018 in all areas

  1. Last night my cat bit my hand for no apparent reason while he was sitting in my lap. He's a very friendly cat, but also very old and I think may be getting a little senile. It was a deep bite, though didn't seem like all that big of a deal. But this morning my hand was hurting pretty bad, then it swelled up, and then a swelling red line appeared on my skin that went from my hand to my shoulder. I went to the doctor and he said it was a bad one, and if I hadn't come in today I would have been in the hospital tomorrow. Apparently cats have some mean bacteria in their teeth and these kinds of cat bites can get pretty bad, quickly. They shot me with a bunch of antibiotics and now I've got to go see another doctor and get an x-ray because they think that there's a possibility the cat's tooth broke off and may be stuck inside my hand (I hope not!). If the antibiotics do their thing, all should be fine in a few days. I'd planned on writing a blog post today about ProcessWire 3.0.115, but it looks like that's not going to happen (and one of my hands doesn't work so well), so I'll write about it next week in combination with 3.0.116 updates. But if you want to see what's new in 3.0.115 before that, be sure to check out the dev branch commit log. Thanks for reading and have a great weekend!
    4 points
  2. This is an old thread, but just wanted to point out at least one major benefit of Slack: it is extremely popular among web devs. IRC is obviously popular as well, but – and this is just my opinion, so take it with a grain of salt – mostly among folks who've been using it for a long time, and of course those who've got a problem with using proprietary platforms in general. In my experience new users tend to very much prefer the slick interface and easy setup of Slack, and since a lot of us are already using Slack for in-company stuff, client communication, and even for other (open source) projects, it'd be easier if ProcessWire had an official Slack workplace as well. In some ways it's the same question as for why use GitHub even when there are decent (and even more powerful) free/open alternatives: because it makes ProcessWire easier to approach for new users. Because that's where the users are, and that's how they find us. At least that's how I see it ? (Note: I've been an IRC user since the 90's, although not so much during recent years, so in my case it's not that I can't use IRC. It's just that all my other dev-related discussions currently happen in Slack, and I'm not too keen on getting back to IRC. I guess I've grown accustomed to what Slack is and how it works, and I see a host of benefits in it.)
    3 points
  3. @ryan don't rush yourself, Take a few days off and get a proper rest. Hope you will feel better soon.
    3 points
  4. It is not bad for SEO. Duplicate Content on the same page will not be penalized. Only if you have it on different pages. Search engines ignore hidden content. ? User agent detection on the other hand could be bad for SEO I guess.
    3 points
  5. This week I was lured to the dark side (my client's own words) to work on a CMS that's not PW or WP. I didn't stay long and it reconfirmed by love of PW but that's beside the point. A problem I encountered was not directly related to the CMS but to PHP itself and how it handles Json serialize/unserialize. Everything functioned for a while then crashed monumentally without any discernible reason. A Google search turned up the following article: https://davidwalsh.name/php-serialize-unserialize-issues Seems to me not only does this solve the problem, base64 encoding data stored in the database would add an extra level of security/privacy. Just sharing...
    2 points
  6. Related good article on Android app development at i-programmer.info : https://www.i-programmer.info/news/193-android/12177-android-studio-32-released-more-cruft-than-substance.html quotes: "So what is the latest revolution we have to suffer?" "Who knows what is Android best practice any more? The one thing we can all be sure of is that our old apps, of even six months ago, are all probably legacy." "The bottom line is that the Android forest has grown so much that not only can you not see the trees any more, all you can see are the weeds. If you go to the documentation you usually can't determine what is best practice and it is quite possible to spend months working on implementing something only to discover that there is some completely different way of doing it that is now the only way to do it."
    2 points
  7. Ouch! Let's keep fingers crossed that PW 3.0.115 "Cat bite" is not follewed by PW 3.0.116 "Emergency room" !!? IOW: get well soon!
    2 points
  8. Creating a support topic for this action now that the new actions-as-modules feature has been added to Admin Actions. Unordered List to Pages An action for the Admin Actions module for ProcessWire CMS/CMF. Creates a structure of new pages from an unordered list entered into a CKEditor field. The nesting of further unordered lists within the list will determine the nesting of the created pages. Created pages get a default template that you select, and you can override this default template per list item by specifying a template name between [[ ]] delimiters. This action can be useful to quickly create a page structure; especially so if you are rebuilding an existing non-ProcessWire site that has a Sitemap page that you can copy and paste from. Usage Install the Unordered List to Pages module. Visit the Admin Actions config screen and enable the "Unordered List to Pages" action for the roles who are allowed to use it. Navigate to Admin Actions > Unordered List to Pages and fill out the config fields: Source Enter/paste an unordered list in the Source field. There is a "cheatsheet" field above that explains the syntax you can use to set some template options for each list item. If you want to override the default template for an item you can specify a template name after the page title between double square brackets. If the template doesn't already exist it will be created. Example: Page title [[staff_members]] You can also specify one or more allowed child templates for a template like so: [[staff_members > manager tech_support]]This would create the page using the staff_members template, and set the allowed child templates of staff_members to manager and tech_support. Alternatively you can specify one or more allowed parent templates for a template like so: [[manager < staff_members]] This would create the page using the manager template, and set the allowed parent templates of manager to staff_members. Parent page Select a parent page that the new pages will be created under. Default template Select the default template to use for the new pages. Screenshots Action config: Result: https://github.com/Toutouwai/AdminActionsUnorderedListToPages https://modules.processwire.com/modules/admin-actions-unordered-list-to-pages/
    1 point
  9. Hey Ryan, hey friends, we, Mobile Trooper a digital agency based in Germany, use ProcessWire for an Enterprise-grade Intranet publishing portal which is under heavy development for over 3 years now. Over the years not only the user base grew but also the platform in general. We introduced lots and lots of features thanks to ProcessWire's absurd flexibility. We came along many CMS (or CMFs for that matter) that don't even come close to ProcessWire. Closest we came across was Locomotive (Rails-based) and Pimcore (PHP based). So this is not your typical ProcessWire installation in terms of size. Currently we count: 140 Templates (Some have 1 page, some have >6000 pages) 313 Fields ~ 15k Users (For an intranet portal? That's heavy.) ~ 195 431 Pages (At least that's the current AUTOINCREMENT) I think we came to a point where ProcessWire isn't as scalable anymore as it used to be. Our latest research measured over 20 seconds of load time (the time PHP spent scambling the HTML together). That's unacceptable unfortunately. We've implemented common performance strategies like: We're running on fat machines (DB server has 32 gigs RAM, Prod Web server has 32gigs as well. Both are running on quadcores (xeons) hosted by Azure. We have load balancing in place, but still, a single server needs up to 20 sec to respond to a single request averaging at around about 12 sec. In our research we came across pages that sent over 1000 SQL queries with lots of JOINs. This is obviously needed because of PWs architecture (a field a table) but does this slow mySQL down much? For the start page we need to get somewhere around 60-80 pages, each page needs to be queried for ~12 fields to be displayed correctly, is this too much? There are many different fields involved like multiple Page-fields which hold tags, categories etc. We installed Profiler Pro but it does not seem to show us the real bottleneck, it just says that everything is kinda slow and sums up to the grand total we mentioned above. ProCache does not help us because every user is seeing something different, so we can cache some fragments but they usually measure at around 10ms. We can't spend time optimising if we can't expect an affordable benefit. Therefore we opted against ProCache and used our own module which generates these cache fragments lazily. That speeds up the whole page rendering to ~7 sec, this is acceptable compared to 20sec but still ridiculously long. Our page consists of mainly dynamic parts changing every 2-5 minutes. It's different across multiple users based on their location, language and other preferences. We also have about 120 people working on the processwire backend the whole day concurrently. What do you guys think? Here are my questions, hopefully we can collect these in a wiki or something because I'm sure more and more people will hit that break sooner than they hoped they would: - Should we opt for optimising the database? Since >2k per request is a lot even for a mysql server, webserver cpu is basically idling at that time. - Do you think at this point it makes sense to use ProcessWire as a simple REST API? - In your experience, what fieldtypes are expensive? Page? RepeaterMatrix? - Ryan, what do you consider as the primary bottleneck of processwire? - Is the amount of fields too much? Would it be better if we would try to reuse fields as much as possible? - Is there an option to hook onto ProcessWires SQL builder? So we can write custom SQL for some selectors? Thanks and lots of wishes, Pascal from Mobile Trooper
    1 point
  10. You have two accounts here at the forum? The first post in this topic is from a different user. Usually this kind of page list error is due to some error message (e.g. PHP notice) being returned in the AJAX response used to build the page list instead of the expected JSON data. You can debug by checking the AJAX response in your browser dev tools. It should look like this when it's working normally:
    1 point
  11. Besides the multi-instance thing, Ryan brought to my attention recently another reason to prefer $this->wire('config') or $this->wire()->config over $this->config... If you are doing this inside a class (e.g. a module) then it's less efficient to do $this->config because PW has to first check to see if you have a property or method in the class named config, and only after that go to the $config API variable. With $this->wire('config') or $this->wire()->config there is no uncertainty. Personally I prefer $this->wire()->config over $this->wire('config'), only because it's easier to paste it in or do a find/replace when updating older code, and easier to assign a shortcut to $this->wire()-> in my IDE and have my cursor end up in the right place after I've typed the API variable name. ?
    1 point
  12. I think so, although typically I see: $this->wire()->scripts rather than $this->wire->scripts although I don't honestly know if it makes a difference. OT, but note that in the Console, I need to use $module instead of $this for the name of the module, but otherwise you can test all these options there.
    1 point
  13. For module development you should actually use: $this->wire('config')->scripts->add($this->wire('config')->urls->$this Take a look at Ryan's Github repo (https://github.com/ryancramerdesign/) for his most recent modules and you'll see that is the approach he takes. @LostKobrakai has an excellent post on when it's ok use: $config vs $this->config vs $this->wire('config') but I can't find it right now.
    1 point
  14. Welcome to the forums @Spiria. It could be a cache issue. Have a look here: This too may be of interest:
    1 point
  15. @psy thanks for the link and info. As I use(d) (un)serialize a lot, I never encountered that problem myself. Maybe I simply had luck that the processed data mainly were key/value pairs and no long strings or texts. But I don't get the context with JSON in the title? Only thing that directly comes to my mind is to use json_encode and json_decode instead of the (un)serialize functions. JSON_encode/_decode seems to be free of workarounds with extra steps of base64 encoding or others. (And I don't think base64-encoding is a plus in regard of privacy/security.) Until now, I mainly preferred the (un)serialze functions. But now, with this information, I will switch to only use json_encode / _decode. So, thanks again for sharing! ?
    1 point
  16. Hi AndZyk Thanks for clarifying and the link, youtube is a great resource. I probably will play around with php a bit and dive into css display: good conversation by the way on that clip
    1 point
  17. No, that would not be duplicate content. Search engines (or Google as far as I know) are smart and see websites like humans. If there is some content invisible, they ignore it. Google uses for their search engine an older version of Chrome, so it can interpret JavaScript and media queries: Hiding/Showing content for different viewports with media queries is a common practice. For example take the Microsoft website: They use two navigations with the same content. One for desktop and one for mobile. You should do that, because as mentioned on the article I linked before: ?
    1 point
  18. Hope everything heals smoothly, Ryan, and that they'll find nothing wrong in the x-ray. Sounds like you just scraped past a sepsis, which would really have been no fun, so it's good to hear you went to the doctor in time.
    1 point
  19. Just a quick not to mention that Admin Actions now supports two additional properties: $executeButtonLabel $icon I am sure both are self-explanatory, especially when you see them in action. I think both are useful additions for your custom actions.
    1 point
  20. I like the following intro to the picture element: http://web.simmons.edu/~grovesd/comm333/modules/responsive-media/srcset/#art-direction the article links to a simple but good responsive demo page: http://web.simmons.edu/~grovesd/comm333/demo/responsive-media/srcset/art-direction.html Try using CSS Grids if you are concerned that google thinks using display:none is bad for SEO. I've read articles which say it is OK to use them. It is a controversial topic, some say google will penalize the site, some say it does not matter.
    1 point
  21. I completely agree. The functions API may not even be turned on for the user's PW install. That said, you could still use: $this->wire('config')->urs->$this as the safest short URL.
    1 point
  22. My wishes for a speedy recovery Ryan.
    1 point
  23. I think most of the developers are lazy. That is the reason why I like Emmet. ? But Emmet can't rename the matching closing element, as far as I know. For that I use CMD + D or CTRL + Left Click on macOS for selecting the closing element. Thats a cool feature of the Auto Close extension. By the way, if you are not familiar with Emmet, I would recommend you to checkout the introduction. Especially for CSS it is a real time saver and easy to learn. Just type a few letters + tab. For example: bgc + tab = background-color. You can find all on the cheatsheet.
    1 point
  24. I would do this: Backgrounds Use media queries, as you are already doing. Images Use the picture element for art directed images with media queries. That is what its meant for. Content Output all versions of the content in your template and use media queries to show/hide the versions for different devices. If you are using a framework, there are components for this use case: UIkit: Visbility Bootstrap: Display I would strongly avoid user agent detection. ?
    1 point
  25. IMHO not without AJAX (which breaks SEO). The (first) request for the page's html happens before any information about screen sizes can be transferred. If it's just images you could: use placeholder images and delay load the correct images through js -> this runs the danger of multiple redraws of the page, which can get really ugly with slow connections or go in the direction adaptive images does by setting a cookie with the screen width (or a resolution indicator) and route all page image requests through a custom PHP script that determines the exact image to serve -> harder on the server and its memory and likely to break caching strategies I'm generally not happy with such approaches, as even screen width (not just browser width) is a dynamic value. The moment I rotate my phone/tablet/monitor, it changes. In the middle of browsing. So to me, adaptive content is mostly a client side problem that needs a client side solution. AJAX loading the relevant content is a possibility where SEO is not a goal (like in corporate intranets).
    1 point
  26. Just want to note that in case of multi-instance usage $this->wire("config")->paths->templates != config()->paths->templates So in modules developement you should avoid using function API.
    1 point
  27. Very nice set of classes and all that in only 23 kb ! Good find. Some nice templates too: https://www.w3schools.com/w3css/tryw3css_templates_portfolio.htm
    1 point
  28. I've added support for this in v0.2.0.
    1 point
  29. Hey @bernhard - glad you're enjoying it. Clearing of Tracy cookie settings (like sticky selected panels) when saving the module settings is intentional: https://github.com/adrianbj/TracyDebugger/commit/f26a46724f8d36b33a637835581128875b756e1e The trouble is that I am not sure why I did it ? I'll have to have a think about why I did this - I distinctly remember doing it for some reason but maybe that reason is no longer relevant due to other changes. I'll get back to you on this. Of course you can enable the panel permanently in the config settings, but I am pretty sure that's not what you mean.
    1 point
  30. There is also this: https://modules.processwire.com/modules/fieldtype-select-file/
    1 point
  31. @horst I finally got around to test some stuff now regarding the focus points and orphaned image files. I actually had a problem with the version of the function in my tutorial above; because the function accessed the original image, the generated images always had the same aspect ratio of the original image, instead of the aspect ratio of the image I passed in. So I forewent using the original image for the tests. As for the focus points, I did some testing on how Processwire handles this. My takeaways (someone correct me if I'm wrong): Image variations are only saved to disk, not to the database. So the only permanent record of an image variation is the physical file on the disk, identified by the appended height and width and suffix string. Whenever I change the focus/zoom of an image and save the page, all variations are automatically regenerated. In combination with my responsive image function, this actually lead to a curious problem. I uploaded a 1920x1080 image to an image field, then created an 800x800 variation through the API. Then I passed that one into the responsive image function, at this point a couple of square-sized variations were created. However, since I only specified a width, the height-parameter in the filename was set to "0". So when I changed the focus point of that image, the variations were recreated in the original 16/9 format instead of the desired square format. I'm not sure if this is intentional or a bug, for now I've restructured the responsive image function to take both a width and a height parameter so that the aspect ratio is fixed, and added shortcut functions that only take height / width as an argument. That should solve the focus point problem. Regarding the cleanup of orphaned files, I'm still not sure if there is an elegant solution. I've added a suffix 'auto_srcset', but the generated images are still spread across multiple folders corresponding to the page id. I feel like cleaning those up all at once would rather be a job for a cleanup script than a single function. Something like the script ryan posted here: Anyway, I can't posted the updated code right now (I'm in the process of writing a small utility library for which I converted all those helper functions into static object methods), but I'll try to post that second part soon and include the updated functions; I might only get to that after my vacation though.
    1 point
  32. This module is great, very useful and i'm using it on a project; I guess my PHP version (7.2.10 ) doesn't like this: (FieldtypeConfigForm, line 69) if(count($values)){ but this works if(wireCount($values)){
    1 point
  33. https://www.baumrock.com/portfolio/individuelles-crm-und-controlling-tool/ I'm happy to share my biggest and most interesting ProcessWire project so far with you It's a 100% custom office-management solution that helps my client to keep track of all their contacts, projects and finance/controlling stuff. Conception was done back in 2016 and the software is productive since begin of this year. My client is very happy with the result and so am I. Some technical insights: Everything is done inside the PW Admin. I'm using the Reno Theme with some custom colors. In the beginning I was not sure if I should stay with the pw admin or build my own admin-framework but now I'm VERY happy that I went with PW Almost all of my custom Process Pages use my RockDatatables module - there are still some limitations but without it, this project would not have been possible For the charts I used Google Charts and chartjs - both play well together with the datatables and make it possible to display filtered data instantly: also my handsontable module was created for this project to have a nice and quick option for matrix data inputs: Lister and ListerPro were no options as i needed much more flexibility regarding data presentation (like colorization, filtering and building sums of selected rows): invoices are highly customisable as well and easy to create. PDFs are created by php and mPDF by the way: all data is dummy data populated via my Module RockDummyData have a nice weekend everybody
    1 point
  34. Ok, we got it! Final code: $pages->addHookAfter('saved', function($event){ $pages = $event->object; $page = $event->arguments(0); if($page->template != 'single-comment') return; $total = array_sum($pages->find("template=single-comment, indice_01!=''")->explode('indice_01')); $pages->get('/comments/')->setAndSave('totale_indice_01', $total); }); Basically I had to insert "$event" as parameter of the function and correct an "_" to "-" in the template declaration Super-many-giga thanks to LostKobraKai, you are my new hero for today
    1 point
×
×
  • Create New...