Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/31/2015 in all areas

  1. Greetings Everyone, A friend just sent me this "data video," and I find it to be an amazing example of bringing data to life (or death in this case). Take a look... https://www.facebook.com/kulturologia/videos/825181334197148/?fref=nf Thanks, Matthew
    4 points
  2. Hi guys, I've been doing events sections for a few sites and for each I needed to make an iCal feed. I've wrapped up this functionality into a module now to make it a little easier for myself and anyone else that needs to make these feeds. The module is basically a simple wrapper around the iCalcreator library (a copy is included). It's modelled on the MarkupRSS module from Ryan, so anyone familiar with that should have a feed up and running in no time. Usage The module takes a PageArray and creates the feed from that. The [tt]->render[/tt] method will send the output to the browser with a generated filename and will automatically download. Because it will return HTTP headers, it has to be included before any html and is best in its own template or followed up by [tt]exit;[/tt] <?php $today = time(); $items = $pages->find("template=event, sort=start_date, start_date>$today"); $ics = $modules->get("MarkupiCalendar"); $ics->title = "Upcoming Events"; $ics->description = "Some upcoming events"; $ics->itemStartDateField = 'start_date'; $ics->itemEndDateField = 'end_date'; $ics->itemLocationField = 'location'; $ics->render($items); You can use the [tt]->renderFeed[/tt] method to return the output as a string instead, which is particularly useful if you want to debug or write the output to a file. <?php $today = time(); $items = $pages->find("template=event, sort=start_date, start_date>$today"); $ics = $modules->get("MarkupiCalendar"); $ics->title = "Upcoming Events"; $ics->description = "Some upcoming events"; $ics->itemStartDateField = 'start_date'; $ics->itemEndDateField = 'end_date'; $ics->itemLocationField = 'location'; $cal = $ics->renderFeed($items); echo $cal; I often put RSS and iCal feeds at the top of my listing pages so as not to clutter up the site tree with extra templates. This way /events/ may point to my events page, and /events/ical will point to it's feed. Here is an example: <?php // iCal feed if ($input->urlSegment1 == "ical") { $today = time(); $items = $page->children("sort=start_date, start_date>$today"); $ics = $modules->get("MarkupiCalendar"); $ics->title = "Upcoming Events"; $ics->description = "Upcoming events for my company"; $ics->itemStartDateField = 'start_date'; $ics->itemEndDateField = 'end_date'; $ics->itemLocationField = 'location'; $ics->url = $page->httpUrl; $ics->render($items); exit; } // Render the template as normal. include("./includes/head.inc"); Download and feedback You can download or fork the module here: https://github.com/f...MarkupiCalendar At the moment it only supports all day events (as these are all I have dealt with) but I hope to add time based events soon. Any feedback is warmly appreciated and feel free to report bugs or suggestions for improvement. Stephen
    1 point
  3. wireshell 1.0.0 is out See Bea's post -------- Original post ----------- Now this one could be a rather long post about only an experimental niche tool, but maybe a helpful one for some, so stay with me Intention Do you guys know "Artisan" (Laravel) or "Drush" (Drupal)? If not: These are command line companions for said systems, and very useful for running certain (e.g. maintenance, installation) task quickly - without having to use the Admin Interface, first and foremost when dealing with local ProcessWire installations. And since it has a powerful API and an easy way of being bootstrapped into CLIs like this, I think such a tool has a certain potential in the PW universe. It's totally not the first approach of this kind. But: this one should be easily extendable - and is based on PHP (specifically: the Console component of the Symfony Framework). Every command is tidily wrapped in its own class, dependencies are clearly visible, and so on. ( Here was the outdated documentation. Please visit wireshell.pw for the current one )
    1 point
  4. Some time ago I developed a module (FieldtypeImageExtra) which extends Fieldtype Image with the ability to add custom fields to an image. This worked well but it had a somehow restricted applicability and did not meet all of our needs. There of course are other useful image modules like CroppableImage or ImageFocusArea, but up to now there was no possibility to combine image cropping with custom fields support. So you had to decide whether to add image cropping or the possibility to add custom fields because each of those modules sets up their own field type (and input type) which cannot be combined. The new module ImageExtra allows you to have both functionalities. You can get the module from GitHub. For more informations have a look at this blog post. If you notice any problems or unexpected behaviour please let me know.
    1 point
  5. Just wanted to post it here for others that might look for an example. I'm currently working on importing a Site to PW2.1. Following code I figured is needed to create pages using the Bootstraped API: <?php include(./index.php) // bootstrap PW $p = new Page(); // create new page object $p->template = 'page'; // set template $p->parent = wire('pages')->get('/about/'); // set the parent $p->name = 'mynewpage_url'; // give it a name used in the url for the page $p->title = 'My New Page'; // set page title (not neccessary but recommended) // added by Ryan: save page in preparation for adding files (#1) $p->save(); // populate fields $p->image = 'path/to/image.jpg'; // populate a single image field (#2) $p->images->add('path/to/image1.jpg'); // add multiple to images field $p->save(); // testing echo 'id: '.$p->id.'<br/>'; echo 'path: '.$p->path; Note: in PW 3 with multi-instance support adding new Objects https://processwire.com/blog/posts/processwire-2.6.21-upgrades-comments-more-on-pw-3.x/#more-updates-on-processwire-3.0 [Edit by Ryan #1] Added first $p->save(); [Edit by Ryan #2] Changed $p->image('...') to $p->image = '...';
    1 point
  6. Hi guys, Been "kicking the tyres" on some UI tweaks to the PW image fields and modal windows. Many of these are in-progress designs and to be straight, none of the designs are entirely resolved. At this stage, I thought I'd throw them up (poor choice of words!) and maybe someone can take them further or offer some fresh eyes. I'm not a developer so making these a reality is impossible for me. They're flat designs. Why? PW is an amazing experience for editors. It's just so elegant and beautifully realised (especially with Reno Theme) that often, my training sessions with clients are very brief. One area which does cause friction though has always been concerned images, image fields and image modals. Especially with the latest image modules, I think a lot of inconsistency has crept into the UI. Hopefully these designs can help improve things a bit. A tiny part of the design work is influenced by a similar idea I had for MODX but which never progressed. 1A. Current Image Modal Editor has clicked 'Add image' icon in CK editor. Issues: I believe the Upload Image button can be better placed. It's not clear to users that they have a choice of two actions (Select an Image OR Upload one) To help solve this, I thought we could: Place available images under a Choose tab Create another tab titled Upload Rename modal to just Image (from Select Image) tweak slightly the Images on page path to be less prominent The following image illustrates the result. Clicking the Upload tab would result in: In the above image I've created toggle-able accordians for Drag and Drop and Manual upload. This follows closely the UI an editor is presented with when choosing Insert Link within CK Editor. IE Link to URL, Select Page and Select File and the extra Attributes tab. So overall, it's more consistent. 1B. Alternative to above - combined Select and Drag/Drop I thought it might be worth exploring what modal would look like with no tabs and a single UI for both Selecting an image and Drag/Dropping. 1C. The Image field I then moved onto looking at the Image field in PW. So currently it looks like this (below) for a simple image field called Image Gallery. So although the current Image field works great, I wondered if there was a way to simplify it by Making the drag/drop more visual and obvious Moving the Choose Files button and removing the No file chosen text and the file types allowed Here's the result. Admittedly, this treatment adds more height to the overall field. Here's how it looks when images are uploading (slightly smaller plus icon and "drag and drop..." text. To be honest, I can't recall what other changes I made there! And here's a proposed layout for when there are multiple images. This includes image titles grid layout mouse-over for edit and delete options/buttons 2. Cropping Next thing I looked at was cropping. Native cropping introduced recently is one of my clients favourite features and time-savers and I wondered if things could be improved a little. So heres the current layout (this may have changed further recently) And here's my proposal. Changes are: Width, height and X and Y fields are moved below the image Apply and Cancel placed bottom right of the image Save Crop should be titled Apply. I think that's less confusing as in some instances there are so many Save options Save and Replace should be greyed out further In addition to this, I thought it'd be neat if we had the free-form cropping function introduced by Ryan combined with some kind of list of pre-sets (displayed on right hand side). Forgive the croptions label (Crop + Options pun - I was tired!) The benfit of this I think is that Modules such as CoppableImage and native Crop would be unified in a single UI. Presets (on right) could be a few out-of-the-box presets which come natively. Croptions houses any crop ratios defined in image modules. if CopppableImage isn't installed, they just don't display.. That's it. I wish I'd more time to work on this but it's at the stage where it's ready for some initial thoughts. Hope you guys like.
    1 point
  7. when a PageListSelect is populated it looks like this: if you want to clear the value of this field rather than changing the referenced page, you have to do lots of clicking if your selected page is somewhere down the tree: it would be great to have a "clear" button right beside the "change" button
    1 point
  8. Also quite useful: When hooking ProcessPageEdit the edited page is $event->object->getPage();
    1 point
  9. Maybe it could be by choice in the field settings?
    1 point
  10. New to ProcessWire (came over from PyroCMS) and really liking it so far. The flexibility in page building is amazing! Anyway, as part of the first site I am building I need an Upcoming Events list. After looking through the forums and docs, I ended up building a page with children pages where each child is a different upcoming event. Each child has title, description, start and end date fields. I have the page working and displaying everything now and am very happy! However, I have one last piece that I cannot figure out. How do I filter the events? Specifically, how do I only show upcoming events and not ones that have already ended? I am displaying individual events with this: $events = wire('pages')->get("/events/")->children("sort=event_start_date"); $singleevent = $events->first; With a full list I can do a comparison in a for loop, but would prefer to just return the valid objects in the initial call. Basically, is there a way to add a "where" ("where event_start_date > $today") type statement?
    1 point
  11. If you look at the hooking method and you see the arguments it is always clearer. If theres a $page you need to use arguments. But in cases if you hook the class Page you get the page with $event->object.
    1 point
  12. This is even better as it's using less or at least more optimized database calls (depending on the exact selector): $events = wire('pages')->find("parent=/events/, event_start_date>today, sort=event_start_date");
    1 point
  13. Ah, so you can stack selectors! Cool! Liking PW more and more! Thanks for the quick responses!
    1 point
  14. You could use just "today" instead of "$today", see https://processwire.com/talk/topic/3290-sort-by-date-range/?p=32282 $events = wire('pages')->get("/events/")->children("event_start_date>today, sort=event_start_date");
    1 point
  15. Hi- this is a very basic version, i can provide more details later, but in short you first define today as a timestamp and then add your selector. $today = date(); $events = wire('pages')->get("/events/")->children("event_start_date > $today, sort=event_start_date");
    1 point
  16. I also built a trip site with PW. I would probably suggest keeping the booking records in their own separate part of the page tree with a hidden parent page. Then have a Page field on the booking record which selects the Tour Date it is for. This would be the more traditional database method, though there are probably +/- to both ways of doing it. I used an integer field on the tour date to hold the number of slots available as well as the current number of bookings for that date, and automatically closed a date if it was full.
    1 point
  17. Just a heads-up: As mentioned, lot's on the plate these days. But I've made a decision regarding the module going forward. When the next one or two PW minor stables come out, I'm going to start making Jumplinks 2.6-only. Lots of goodies I want to use, and as stated earlier in this thread, Jumplinks is mostly for new sites resulting from migrations. Of course, Jumplinks won't upgrade for anyone using it on 2.5.3. Also, and because of this decision, I'll be switching over to some kind of autoload solution so I can split up logic etc. It's essentially going to be a rewrite. Nonetheless, it will function exactly the same, sans the 404 Monitor, which I'll try to release at the same time. Speaking of the 404 monitor, I've already drawn out some blueprints and flow charts - ideas have come to mind, and I think it's going to be a really helpful module. As said, it will mesh well with Jumplinks. Edit: Okay, I see that 2.6.1 is already on stable (of course, it should be). I'll need some time before I start this up.
    1 point
  18. To answer: definitely possible. https://www.tripsite.com/ is quite a big tour site powered by PW, with bookings availability etc, and developed by Ryan. I'm not sure if there is some kind of case study anywhere or maybe Ryan has some pointers if he reads this.
    1 point
  19. Well, instead of counting the number of free seats every time a tour page is viewed, I would recalculate the number of free seats (and update the field) once a new booking is made. But maybe that's exactly what you were planning to do and I just misunderstood it.
    1 point
  20. Doh! Somewhere in the back of my mind, I remembered solving this issue with session locking before. session_write_close() is what I needed. I'll post back here with a full solution to keep the topic relevant.
    1 point
  21. This issue is what Migrator (https://github.com/adrianbj/ProcessMigrator) aims to solve (although not for users just yet). It works very well in most scenarios - there are just a few situations that still need some tweaking. It works by converting page IDs to named json records, named assets folders etc so that they can be imported into a new site without causing clashed with existing page IDs. Unfortunately for your purposes of migrating user accounts, there are currently several checks to exclude pages under Admin (I wanted to prevent it messing with this stuff), but I do think they can probably be removed - carefully! Anyway, not a complete solution for you right now, but something for you to investigate. I haven't found much time to work on it of late, but I am still intending on finishing it up sometime soonish.
    1 point
  22. This shouldn't be difficult to do. You just need to add the checkbox to your template so that each story has a checkbox or "Complete" button or such. Use some jquery: $('#checked').click(function(){ $.ajax( '/change_complete_status.php?pageid=<?php echo $page->id; ?>'); }); Although maybe you need to inject an article id, rather than the entire page id - not sure how you have things set up. Then in change_complete_status.php <?php include("./index.php"); //bootstrap PW $page_id = (int) wire('input')->get->pageid; $p = wire('pages')->get($page_id); $p->of(false); $p->checked = 1; $p->save("checked"); Or something along those lines.
    1 point
  23. As vagely mentioned the LanguageSupportPageNames module is the problem here, as it doesn't load in a Bootstrap it seems. There's no page rendering happening so ready() method of it will never get called. I'm using heavy page creation importing with multilanguage and also ran into this, and also need a solution sooner or later, so i tried again. A solution I found is to add a hook yourself in the script on Pages::saveReady and delegate that to the LanguageSupportPageNames which usually seem to handle this part of page name saving. So if you add this code above your bootstrap, it will work as if in a page template. wire()->addHookAfter("Pages::saveReady", null, "hookPageSaveReady"); function hookPageSaveReady($event){ wire("modules")->LanguageSupportPageNames->hookPageSaveReady($event); }
    1 point
×
×
  • Create New...