-
Posts
733 -
Joined
-
Last visited
-
Days Won
28
Everything posted by Jonathan Lahijani
-
Educational site for a non-profit organisation
Jonathan Lahijani replied to vadimmil's topic in Showcase
Nice writeup. You could use Page Image Manipulator to convert PNG to JPGs by the way: https://modules.processwire.com/modules/page-image-manipulator/ -
This is no different from using a CMS like WordPress or Drupal given their architecture. I'd recommend looking at the approach of Roots.io. More specifically reading their Twelve-Factor WordPress App series and adapting it accordingly with your preferred set of tools: https://roots.io/twelve-factor-wordpress/ #6 addresses file uploads: https://roots.io/twelve-factor-06-processes/ Relevant module: Hope this helps!
- 6 replies
-
- 6
-
-
- deployment
- git
-
(and 2 more)
Tagged with:
-
I went "crazy" quite a few times over all frontend churn as well, FOMO, etc. At the end of the day, use the best tool for the job. Right now, practically all of my needs are met with the following stack: ProcessWire UIkit3 (it's so good; but, but the horror of using UIkits classes in your HTML!) Some PW premium modules: ListerPro ProCache (it's become my build process tool; you can build UIkit3 with it perfectly fine; I'm dumping Node, Webpack, and whatever the "latest" way to do things is) FormBuilder Pulling in whatever packages I need via composer VueJS if needed (loading it via CDN, oh my god the horror!) Digital Ocean for hosting (manually configuring their Ubuntu LAMP 16.04 droplet... takes only a few minutes) If your clients want to use some crappy shared host, switch them to DigitalOcean; it's practically the same price. I develop all my sites on Windows (but technically it's Linux thanks to WSL). No VMs, no Docker (again, the horror of what happens if my server ends up being PHP v7.0.23 and my local machine is 7.0.22!). Simple and reliable 99.99999999999999% of the time. I deploy with a simple shell script (horror! not using Capistrano, Ansible, whatever the latest tool is). Sure, your site won't be able to handle all of earth's traffic if everyone were to visit your site at the same moment, but it'll be fine for 85.7% of the sites you most likely take on. I've built very complex sites with just those tools and I move extremely rapidly while keeping the site client-maintainable! Even if you became Mr. Expert on the latest frontend tools, it's going to change significantly by this time next year and the year after that. Perhaps sit on the sidelines for a bit. End rant.
- 11 replies
-
- 17
-
-
There's a commercial module for that:
- 9 replies
-
- 1
-
-
- inputfield
- dependencies
-
(and 1 more)
Tagged with:
-
Contact form stopped sending! :( :\
Jonathan Lahijani replied to bramwolf's topic in General Support
My approach for reliably sending out system-based/transactional emails is to signup for Mailgun.com. It's free if you're sending out less than 10,000 emails per month. It will require you to put a credit card on file. I then use the Swift Mailer module to customize the SMTP settings and such: https://modules.processwire.com/modules/wire-mail-swift-mailer/ Make sure to setup the TXT records as well that Mailgun recommends. For example, if your site uses G-Suite for regular email and Mailgun for transactional emails, then this is what you'd need (refer to what Mailgun tells you upon signup; replace the IP with your server IP address, or adjust accordingly): v=spf1 ip4:123.456.789.123 include:_spf.google.com ~all v=spf1 include:mailgun.org ~all I've found this method to be extremely reliable, quick, painless and I like that the account is not tied to what might be a site's overall email system like G-Suite. It keeps things separate to prevent situations like this. (definitely read that link) -
Building on what PWaddict said, you could optimize the code just a little bit more, like this: <?php foreach ($p->moments->find('yearofmoment=1969,sort=month') as $moments): ?> You can then remove the conditional you have: <?php if ($moments->yearofmoment == 1969): ?> ... <?php endif; ?>
-
For fun, you could also create a wp-login.php file in your PW root directory so that hackbots get confused (or redirected away, or just show a blank page). Here's an example of some random website that implements this technique: http://processwire.com/wp-login.php If you've ever looked at a website's access log files, you'll see that that URL is hit all the time. Easy way to prevent a bunch of 404s.
-
Add this to the array: 'currentLinkMarkup' => "<a class='page-link' href='{url}'>{out}</a>",
-
Add additional text input to existing options field.
Jonathan Lahijani replied to elabx's topic in General Support
Yea, it's going to create a lot of database tables. I don't see how any Profields would help in this scenario either. I suppose a custom field would be optimal, although I've never had to create one in my 4+ years with PW. But optimal might be a relative word... 100 questions might still be manageable? Also, one thing to be careful about is if you remove a question (as in remove the field from the template), it will delete any saved data associated with it, which you may need to keep. Maybe hiding it (but still keeping it assigned to the template) would be an alternative approach to preserve data. -
The sort box will go back to the default/first option, unless you program some basic logic to make it selected. Something like this should work: <?php $sort = $input->get->string('sort'); // sanitize url variable shorthand ?> <select name="sort"> <option value=""></option> <option value="title" <?php if($sort=="title"): ?>selected<?php endif; ?>>Title (Asc)</option> <option value="-title" <?php if($sort=="-title"): ?>selected<?php endif; ?>>Title (Desc)</option> <option value="price" <?php if($sort=="price"): ?>selected<?php endif; ?>>Price (Asc)</option> <option value="-price" <?php if($sort=="-price"): ?>selected<?php endif; ?>>Price (Desc)</option> </select>
-
Add additional text input to existing options field.
Jonathan Lahijani replied to elabx's topic in General Support
Are they filling out this form on the frontend of your site or through some sort of protected backend? If frontend, are you building the form using FormBuilder, the PW Form API, or custom? How many questions are there? If it's like 10-50, that means another 10-50 extra fields for the "Comments" fields related to the question field as you stated. Why not just make those individual fields in ProcessWire (assuming I understand your question correctly)? -
[SOLVED] urgent problem uploading large files - new insights?
Jonathan Lahijani replied to platko's topic in Getting Started
Try doubling the values above? How long does it take to upload 400mb on your server? -
[SOLVED] urgent problem uploading large files - new insights?
Jonathan Lahijani replied to platko's topic in Getting Started
When you changed the settings in php.ini, did they in fact apply? You might want to double check by outputting phpinfo(). -
I have a site that I oftentimes sync the live database to my dev database (I made a bash script to automate the process). I generally like to "clean" the database once it has been copied over to my dev machine, which involves running a script that deletes 15,000 pages (orders in my case), among other things. Doing this using $page->delete() in a script (which I'm running through the command line for added performance), takes about 30 minutes which is painful. I thought it through further and I came up with the following relatively simple script that can achieve the same result in a few seconds! It achieves this speed by running MySQL delete queries directly, bypassing PW's API. Here it is (modify accordingly): <?php namespace ProcessWire; ?> <?php include(dirname(__FILE__).'/index.php'); // bootstrap pw $order_ids = $pages->findIDs('parent=/orders/,template=order'); if(!count($order_ids)) exit; $order_ids = implode(",", $order_ids); $t = $templates->get("order"); foreach($t->fields as $f) { if( $f->type!="FieldtypeFieldsetOpen" && $f->type!="FieldtypeFieldsetClose" ) { $table = "field_".$f->name; $database->query("DELETE FROM $table WHERE pages_id IN ($order_ids)"); } } $database->query("DELETE FROM pages WHERE id IN ($order_ids)");
-
Modify "Custom Page Label Format" via hook/API
Jonathan Lahijani replied to Jonathan Lahijani's topic in API & Templates
Thanks Robin, this worked well and avoids the approach of having to hack PW and make InputfieldPage::getPageLabel hookable. Note: In order for it to work, you must edit the field's "Label field" under the "Input" tab. It must be changed from "title (default)" to "Custom format (multiple fields) ..." and a value must be put in the "Custom page label format" field, even if it's just a temp value (I put "x"). -
Looks like CKEditor 5 is on the way: https://ckeditor.com/blog/CKEditor-5-A-new-era-for-rich-text-editing/ https://news.ycombinator.com/item?id=15497972 (HackerNews comments of the above article) Home page: https://ckeditor.com/ Demo: https://ckeditor5.github.io/ Feature Video:
-
If a client is dead-set on WordPress, it's worth communicating to them that every developer has their own go-to approach with the system, to the point where I would say it's not even "WordPress" anymore. So even if another developer were to take over it, it's still foreign territory to an extent, followed up with continuously saying "why the hell did the previous developer do things in X way instead of Y?" and a lack of productivity. Just check out all the starter themes, mega themes (ugh... ... ... ugh), and different approaches to custom fields. It's pretty terrible. For me, ProcessWire + UIkit solves like 95% of my challenges, and solves them WELL.
- 18 replies
-
- 10
-
-
I have a script that deletes a bunch of pages and it's very slow too, but I'm not sure if it's normal or if something's wrong. In addition, I'm running it from Bash. Did you have any luck with improving the speed?
-
I have a Page Reference field (ASM Select) and I am utilizing the "Custom Format" for the "Label field". However even the custom format itself is a bit limiting for a particular use case I have. Is it possible to hook into it and modify the output cleanly with PHP? I can't seem to find a proper hook. Somewhat related... it's possible to do this for the Tree page labels via ProcessPageListRender::getPageLabel.
-
I just hit this same issue as well. My resolution was to break up my script into two separate files (first one deletes a bunch of pages, second one adds a bunch).
-
https://deliciousbrains.com/craft-cms-self-hosted-wordpress-alternatives/ This article came out today. Delicious Brains is known for some popular plugins. I dropped a reference to PW in the comments. Perhaps others here can add to the discussion.
-
New post: ProcessWire updates & new field types
Jonathan Lahijani replied to ryan's topic in News & Announcements
Ryan has a habit of developing features we didn't even know we needed! -
+1 for WSL. It works wonderfully and has a lot of resources behind it. Getting better all the time.
-
The Biology of Processwire Templates, Fields and Pages
Jonathan Lahijani replied to clsource's topic in Pub
Atomic Design: http://bradfrost.com/blog/post/atomic-web-design/ -
I tested out the new version and it works really well. Thanks @Robin S.