-
Posts
716 -
Joined
-
Last visited
-
Days Won
26
Everything posted by Jonathan Lahijani
-
[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.
-
Shouldn't it actually be this? $form->insertAfter($field, $form->getChildByName('tags'));
-
Yea there's a trade-off here. Personally, I think inserting the IDs is the best route since IDs do not change (while text does). Unless there's a really fancy way to satisfy both needs through some sort of richer CKEditor widget?
-
When making a new booking, you have the 'room' dropdown (well perhaps it should be "Rooms" since one customer may be able to book more than one room) as I described, however you obviously don't want to a room to be double-booked, meaning that dopdown should only show available/unbooked rooms. You can determine that by writing a custom query for that ASM-select field (using PW's Custom PHP Code feature). I think the selector would be something like (well you'd need to finish it off and also make it handle whether the current booking has a room selected): // this will find all the unbooked rooms of the selected boat $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->name == 'rooms') { $booking = $this->pages->get($this->input->id); $cruise = $booking->cruise; $boat = $cruise->boat; $allRooms = $boat->children; $availableRooms = new PageArray(); foreach($allRooms as $room) { if( ! $this->pages->count("write query here to determine if the room has been booked") ) { $availableRooms->add($room); } } $event->return = $availableRooms; } }); Hope this helps.
-
Sounds like you would want to handle 5 data types: boats rooms cruises customers bookings A boat I'm assuming has a fixed number of rooms. Perhaps start with a data model like this which takes everything into consideration: Boats (boats.php) Boat A (boat.php) Room 1 (room.php) Room 2 Room 3 ... Boat B Room 1 Room 2 ... Customers (customers.php) Customer 1 (customer.php) Customer 2 ... Bookings (bookings.php) Booking 1 (booking.php) Booking 2 ... Cruises (cruises.php) Cruise 1 (cruise.php) Cruise 2 ... Cruise template fields: title date boat (page-select to /boats/, boat.php) Customer template fields: first name last name (other typical fields) Cruise template fields: title boat (page-select to /boats/, boat.php) date Booking template fields: customer (page-select to /customers/, customer.php) cruise (page-select to /cruise/, cruise.php) rooms (based on cruise->boat, select for the rooms that the boat has) I'm assuming the interface would be PW's admin. Perhaps use some hooks and ListerPro to tie it all together. Make it as user-friendly as possible. Maybe have a page within the admin outputs each cruise with which rooms have been booked vs. unbooked which would be friendly to the site admins.
-
To what extent are you storing a customer's information as part of booking a room? Or do you simply just need to indicate whether a room is taken?
-
The page exporter/importer sounds very exciting. I think it would be pretty slick if you can choose access the export/import action from within the page tree itself (next to the new, edit, view etc. page action buttons). I'm also curious to know how merging would occur and the options around it. Can't wait!
-
Let's say you're doing a redirect like this in your template: $session->redirect( $pages->get("/some-page/")->url ); Would halting be good practice after redirecting or does it not make a difference? return $this->halt(); It wasn't clear in the blog post that introduced halting: https://processwire.com/blog/posts/processwire-2.6.8-brings-new-version-of-reno-admin-theme-and-more/#new-this-gt-halt-method-for-use-in-template-files
-
how to arrange content in bootstrap grid in ckeditor ?
Jonathan Lahijani replied to adrianmak's topic in Dev Talk
@adrianmak I would strongly consider you don't put divs in CKeditor fields as this is a very fragile and error-prone approach. My solution to this is either (a) use HannaCodes to represent opening and closing of divs or (b) use RepeaterMatrix. -
Custom link for view button in admin/edit mode possible?
Jonathan Lahijani replied to simonGG's topic in General Support
Shouldn't return $this->halt(); be used instead of exit(); ? -
Unrelated to what you're experiencing, but when I upgrade PW on my WAMP setup AND if I have a project open in Sublime Text containing that PW instance, the upgrade will "fail" at the last step whereby it renames the directories. Not a bug, but something to be careful for. It's easy to fix however if that occurs... just rename the 'wire-3.x.xx' directory to 'wire'.
-
CMS Critic Powered by ProcessWire (again) + Case Study
Jonathan Lahijani replied to ryan's topic in News & Announcements
Hi Andreas, You'd have to ask Mike Johnston (@cmscritic) of CMS Critic that question. J