Jump to content

Jonathan Lahijani

Members
  • Posts

    734
  • Joined

  • Last visited

  • Days Won

    28

Everything posted by Jonathan Lahijani

  1. I tested out the new version and it works really well. Thanks @Robin S.
  2. Shouldn't it actually be this? $form->insertAfter($field, $form->getChildByName('tags'));
  3. 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?
  4. 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.
  5. 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.
  6. 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?
  7. 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!
  8. 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
  9. @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.
  10. Shouldn't return $this->halt(); be used instead of exit(); ?
  11. 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'.
  12. Hi Andreas, You'd have to ask Mike Johnston (@cmscritic) of CMS Critic that question. J
  13. Given that the ProcessWire Upgrade module has been updated as well, shouldn't it be able to upgrade an installation that's on 3.0.33 (for example) to 3.0.35? It seems to not detecting the latest version.
  14. Regarding the video tutorials, what I have completed so far is just a 50-video series of straight-up comparing WP to PW feature-by-feature, so I don't think you'd personally benefit from that since you're already a ProcessWire guru. I will release them however there's some further editing I need to do as well as making it part of an overall content marketing strategy. I haven't had time for that yet, but at least the really hard part of recording the videos is done. In regards to something like a full training series, the idea is still in my head (on paper too), however I don't have any plans yet to go full force on that as I'm focused on other ventures.
  15. Somewhere between 60-80 hours, which includes the general consulting, coding, communication and other issues that came up. I didn't track time like I normally do so this is an estimate. Superusers have full access as usual. General users, authors and vendors have access to the pages they are creators of (posts, products). In Ryan's case study from a few years ago, he implemented a hook that prevents users from accessing other user's data in the admin. That part is key. Some CSS is also being used to hide what's not necessary for non superusers to see (along with permissions enforcement). It's easy to load a custom CSS file in the admin based on whatever condition you want it to meet. For example, the following in /site/templates/admin.php if($user->hasRole("author")) { $config->styles->append($config->urls->templates."author.css"); } Thanks for catching that typo. I also updated the chart to link to the various PW modules.
  16. A note about speed... we switched the hosting from ServInt to KnownHost a couple days ago and now the site is fast... like scary fast. (note: the WordPress site was neither on ServInt or KnownHost, but rather a WP managed hosting provider which one would expect to have decent speed)
  17. Although you were experiencing this issue before enabling xdebug, xdebug itself really slows down PW. But that doesn't seem to be the issue in your case. Some things to try: try running the site on a production server and see if it's slow. if it's not, there's some issue with your local server. if you're using an old version of wamp-server (like v 2.4), try upgrading to a newer version. i hit an issue a couple years ago on an older version that was plaguing me. perhaps you're doing some crazy stuff with your code that you may not realize. keep trying to selectively remove various parts of your code and refreshing your site to see if you get a moment where everything clears up. then analyze the problematic code. Let us know how it works out.
  18. NIce work Francesco! I just left a comment on the article singing praises to generate even more excitement.
  19. Sometime after 3.0.21, PW had modifications that has messed up how PW's "Markup" field renders descriptions with HTML in them, which also affects MenuBuilder. I've created an issue on the PW Github: https://github.com/ryancramerdesign/ProcessWire/issues/1932
  20. When editing a template, you can add fields to it using the Fields dropdown. However, it can be tedious to perfectly scroll to the needed fields everytime you add one, especially if your site has a lot of fields. Is it currently possible, or would it be possible, to enable auto-complete on the fields dropdown?
  21. I developed modernrealestatesf.com which utilizes MLS listings. The approach I took was to have my client sign up with simplyrets.com which provides a clean and straight-forward way of accessing the needed listings. I then wrote a script which processes the data to our needs. The script runs a couple times a day. I'm not storing any images in ProcessWire since the images that are in the feed are already stored on Amazon which makes things convenient.
  22. Another way is to insert it via JavaScript. Note, this example is tested for the default admin theme, not Reno. First place the following in your admin.php file above the require controller line, inside your templates dir: $config->scripts->append($config->urls->templates."admin.js"); Then place the following in a file called admin.js in your templates dir: $(document).ready(function(){ $('#topnav').append('<li><a href="https://example.com/" target="_blank">Example</a></li>'); }); I'm sure the jQuery could be more elegant, but the point is it can be done via JS as well, which I ended up doing for a recent project for reasons I can't remember. In my specific example, I linked it to a Google Doc which contained help documentation for a site.
  23. Coming from a Rails background years ago, I think it's best to stick with web application frameworks for any web applications that will have heavy iterations and multiple team members. With a webapp framework, you get a testing suite, migrations, ORM, REST, MVC, specific deployment tools and many other necessities. You would have to re-do all those with ProcessWire. Furthermore, using pages to act as a router doesn't feel right. "Use the best tool for the job" and all that.
  24. $config->urls->templates will give you the relative URL, not the absolute URL containing "http://mysite.com/" part. Is there are slick way to get the absolute URL? If not, what's the next best approach?
  25. You could do this in admin.php (above the line that brings in controller.php): $wire->addHookAfter('AdminTheme::getExtraMarkup', function($event) { $extras = $event->return; $extras['head'] .= '<link rel="shortcut icon" href="'.wire('config')->urls->templates.'favicon.png">'; $event->return = $extras; });
×
×
  • Create New...