Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/03/2020 in all areas

  1. v0.3.0 released. Notable changes in this version: 1. Fix for page clone issue reported by @a-ok in the post above. 2. The module now hooks Pages::save() and Pages::saveField() instead of Pages::saveReady() and Pages::saveFieldReady() in order to work around this core issue. Hopefully that issue gets resolved and then the module can go back to saveReady hooks because those would be preferable, but for now something had to be done because the issue was making page changes unsaveable when "single" Page Reference fields were configured in this module.
    2 points
  2. UPDATE 2020-03-03 SnipWire 0.8.4 (beta) released! This update improves compatibility for Windows based Systems (thanks @bernhard for your help!)
    2 points
  3. @astock, you don't have the lists you mention anywhere in your code. $abgestimmt = []; foreach ($datenbank->query($sql) as $row) { $teilnehmer = $users->get($row['user_id']); $antwort = $pages->get($row['vote_id']); echo "<tr>"; echo "<td>".$teilnehmer->nachname.", ".$teilnehmer->vorname."</td>"; echo "<td>".$antwort->title."</td>"; echo "</tr>"; // This first part works nice! // And here we fill the list of users who have already voted $abgestimmt[] = $teilnehmer; } $alleUser = $users->find("start=0"); // Now we remove the users who have voted and iterate // over the rest foreach($alleUser->removeItems($abgestimmt) as $nutzer) { $nu = $nutzer->nachname.$nutzer->vorname; $tn = $teilnehmer->nachname.$teilnehmer->vorname; echo $nu; }
    2 points
  4. Another perspective: The API acts as the model, with the $page / Page class giving you access to page data through a generic interface. By default, the PHP template file for the current content type / template acts as Controller and View, though you can easily seperate Controller and View by using, for example, a frontend templating library like twig. That's close to my usual setup: View: Twig acts as a View layer, since it gets pretty privileged access to API variables, you can get anything done you'd usually do in a PHP View class. Controller: The PHP template file acts as the Controller, for example processing input and rendering the correct Twig template. Usually, I just keep the template logic procedural, because ProcessWire already does a lot of work in determining the correct template file and setting up API variables. Though you could also use a custom Controller class and just use the template file to instantiate it. Model: As mentioned above, the $page API variable is already a kind of generic model for your data, and for sites that are mostly brochure sites / presentational in nature, this is really all you need. But if you want to go further, you can create custom page classes by extending the Page class and set your template to use that, this way you can make your model as smart as it need to be. I have written two tutorials on how to integrate Twig if you're interested ? Part 1: Extendible template structures Part 2: Custom functionality and integrations
    2 points
  5. SnipWire - Snipcart integration for ProcessWire Snipcart is a powerful 3rd party, developer-first HTML/JavaScript shopping cart platform. SnipWire is the missing link between Snipcart and the content management framework ProcessWire. With SnipWire, you can quickly turn any ProcessWire site into a Snipcart online shop. The SnipWire plugin helps you to get your store up and running in no time. Detailed knowledge of the Snipcart system is not required. SnipWire is free and open source licensed under Mozilla Public License 2.0! A lot of work and effort has gone into development. It would be nice if you could donate an amount to support further development: Status update links (inside this thread) for SnipWire development 2020-07-03 -- SnipWire 0.8.7 (beta) released! Fixes some small bugs and adds an indicator for TEST mode 2020-04-06 -- SnipWire 0.8.6 (beta) released! Adds support for Snipcart subscriptions and also fixes some problems 2020-03-21 -- SnipWire 0.8.5 (beta) released! Improves SnipWires webhooks interface and provides some other fixes and additions 2020-03-03 -- SnipWire 0.8.4 (beta) released! Improves compatibility for Windows based Systems. 2020-03-01 -- SnipWire 0.8.3 (beta) released! The installation and uninstallation process has been heavily revised. 2020-02-08 -- SnipWire 0.8.2 (beta) released! Added a feature to change the cart and catalogue currency by GET, POST or SESSION param 2020-02-03 -- SnipWire 0.8.1 (beta) released! All custom classes moved into their own namespaces. 2020-02-01 -- SnipWire is now available via ProcessWire's module directory! 2020-01-30 -- SnipWire 0.8.0 (beta) first public release! (module just submitted to the PW modules directory) 2020-01-28 -- added Custom Order Fields feature (first SnipWire release version is near!) 2020-01-21 -- Snipcart v3 - when will the new cart system be implemented? 2020-01-19 -- integrated taxes provider finished (+ very flexible shipping taxes handling) 2020-01-14 -- new date range picker, discount editor, order notifiactions, order statuses, and more ... 2019-11-15 -- orders filter, order details, download + resend invoices, refunds 2019-10-18 -- list filters, REST API improvements, new docs platform, and more ... 2019-08-08 -- dashboard interface, currency selector, managing Orders, Customers and Products, Added a WireTabs, refinded caching behavior 2019-06-15 -- taxes provider, shop templates update, multiCURL implementation, and more ... 2019-06-02 -- FieldtypeSnipWireTaxSelector 2019-05-25 -- SnipWire will be free and open source Plugin Key Features Fast and simple store setup Full integration of the Snipcart dashboard into the ProcessWire backend (no need to leave the ProcessWire admin area) Browse and manage orders, customers, discounts, abandoned carts, and more Multi currency support Custom order and cart fields Process refunds and send customer notifications from within the ProcessWire backend Process Abandoned Carts + sending messages to customers from within the ProcessWire backend Complete Snipcart webhooks integration (all events are hookable via ProcessWire hooks) Integrated taxes provider (which is more flexible then Snipcart own provider) Useful Links SnipWire in PW modules directory SnipWire Docs (please note that the documentation is a work in progress) SnipWire @GitHub (feature requests and suggestions for improvement are welcome - I also accept pull requests) Snipcart Website ---- INITIAL POST FROM 2019-05-25 ----
    1 point
  6. --- Module Directory: https://modules.processwire.com/modules/privacy-wire/ Github: https://github.com/blaueQuelle/privacywire/ Packagist:https://packagist.org/packages/blauequelle/privacywire Module Class Name: PrivacyWire Changelog: https://github.com/blaueQuelle/privacywire/blob/master/Changelog.md --- This module is (yet another) way for implementing a cookie management solution. Of course there are several other possibilities: - https://processwire.com/talk/topic/22920-klaro-cookie-consent-manager/ - https://github.com/webmanufaktur/CookieManagementBanner - https://github.com/johannesdachsel/cookiemonster - https://www.oiljs.org/ - ... and so on ... In this module you can configure which kind of cookie categories you want to manage: You can also enable the support for respecting the Do-Not-Track (DNT) header to don't annoy users, who already decided for all their browsing experience. Currently there are four possible cookie groups: - Necessary (always enabled) - Functional - Statistics - Marketing - External Media All groups can be renamed, so feel free to use other cookie group names. I just haven't found a way to implement a "repeater like" field as configurable module field ... When you want to load specific scripts ( like Google Analytics, Google Maps, ...) only after the user's content to this specific category of cookies, just use the following script syntax: <script type="text/plain" data-type="text/javascript" data-category="statistics" data-src="/path/to/your/statistic/script.js"></script> <script type="text/plain" data-type="text/javascript" data-category="marketing" data-src="/path/to/your/mareketing/script.js"></script> <script type="text/plain" data-type="text/javascript" data-category="external_media" data-src="/path/to/your/external-media/script.js"></script> <script type="text/plain" data-type="text/javascript" data-category="marketing">console.log("Inline scripts are also working!");</script> The data-attributes (data-type and data-category) are required to get recognized by PrivacyWire. the data-attributes are giving hints, how the script shall be loaded, if the data-category is within the cookie consents of the user. These scripts are loaded asynchronously after the user made the decision. If you want to give the users the possibility to change their consent, you can use the following Textformatter: [[privacywire-choose-cookies]] It's planned to add also other Textformatters to opt-out of specific cookie groups or delete the whole consent cookie. You can also add a custom link to output the banner again with a link / button with following class: <a href="#" class="privacywire-show-options">Show Cookie Options</a> <button class="privacywire-show-options">Show Cookie Options</button> I would love to hear your feedback ? CHANGELOG You can find the always up-to-date changelog file here.
    1 point
  7. ProcessWire Dashboard Download You can find the latest release on Github. Documentation Check out the documentation to get started. This is where you'll find information about included panel types and configuration options. Custom Panels The goal was to make it simple to create custom panels. The easiest way to do that is to use the panel type template and have it render a file in your templates folder. This might be enough for 80% of all use cases. For anything more complex (FormBuilder submissions? Comments? Live chat?), you can add new panel types by creating modules that extend the DashboardPanel base class. Check out the documentation on custom panels or take a look at the HelloWorld panel to get started. I'm happy to merge any user-created modules into the main repo if they might be useful to more than a few people. Roadmap Panel types Google Analytics Draft At a glance / Page counter 404s Layout options Render multiple tabs per panel Chart panel load chart data from JS file (currently passed as PHP array)
    1 point
  8. Whoa, @Robin S that’s really awesome. Is there a way to donate to the module’s development or to yourself?
    1 point
  9. Have you tried looking into Repeaters/Repeater Matrixes? A user can add many repeater items, but the fields defined within are set by the admin (or an account with the correct permissions).
    1 point
  10. Just on this. I think it's due to the client duplicating a page (and thus not changing or 're-setting' the field)? Do you know if it's meant to work with duplicating the page?
    1 point
  11. It would be great if "required if" conditions in repeaters inputfield dependencies will work in the future. At the moment only "show if" conditions work. Today I have implemented the new fieldset (Page) type, which works like a repeater. But unfortunately I had to remove it because of the non working "required if" conditions. In my case I need the "required if" condition and therefore I had to switch back to a default fieldset (which supports the "required if" condition dependency). But it was more work and I needed more fields. So this feature would save a lot of time. Maybe it will be possible in the near future. Would be great!
    1 point
  12. I think the question should be what type of application are you looking to build that requires MVC ? because I find PW appropriate for making proper CMS sites, anything other than that, then you should be using a proper MVC for such, there will be scenarios you will encounter, I doubt you would want to tweak PW to fit uncovered scenario.
    1 point
  13. Hi @ryan thank you very much - that will be a tiny but very helpful addition! ? You might be right about it belonging to files instead of config - I really don't care about that. One thing that might be helpful would be a second parameter wheter it should return a trailing slash or not: $less = __DIR__ . "/my/great/file.less"; if(is_file($less)) echo $files->url($less); // /site/templates/my/great/file.less $dir = __DIR__ . "/blocks"; // see comment 2 $blocks = ['file1.php', 'file2.php', 'file3.php']; foreach($blocks as $block) { $file = $files->path($dir, true).$block; // see comment 1 if(!is_file($file)) continue; echo "<link rel='stylesheet' href='{$files->url($file)}'>"; } // comment 1 // see how that is better compared to something like this: $file = "$dir/$block"; // this could fail when $dir is dynamic (eg user input from module config) $file = rtrim($dir, "/")."/".$block; // better, but tedious // and finally, what if somebody used DIRECTORY_SEPARATOR --> it could fail on windows because of the backslash Comment 2: This could also be a relative path, eg $dir = "blocks" (being the blocks folder of the current module). Checking for is_file() can then become tedious as you might have to add $config->paths->whatsoever. $files->path($dir, true) would make sure to return the path with a trailing slash. Or maybe it would be better if the trailing slash was returned by default? I'd really vote for $files->url(...) and $files->path(...) instead of diskPathToUrl/urlToDiskPath; I know one should not be too short in variable/method names, but we already have the equivalents $config->paths and $config->urls that do the same, so I think this would be perfectly reasonable. ? And yes, I think you are right about it being a file tool, therefore we'd better use $files->url(...) instead of $config->url(...) ? Really looking forward to that, thank you again! ---------- Regarding my datetime request: Please disregard this one. First, I didn't know about the WireDateTime at all (Sorry!) and second, the reason why I didn't like PHP's features was that it doesn't provide a nice and easy to understand API. But that's solved when using carbon and that can perfectly be built into a 3rd party module (not bloating the core).
    1 point
  14. @bernhard While that need hasn't often come up here, it sounds like it might be a common need elsewhere (?) per what you said, so I think it sounds worthwhile. Though I'm thinking maybe off the $files API variable as more obvious $files->diskPathToUrl() and $files->urlToDiskPath() type functions, but it would also be simple enough to have the $config methods respond to them too, so long as there's a at least one slash present in the value. Back to date/time API methods, were there any in particular that you thought were commonly needed but missing from PHP's built in set of tools? The two I found over time were the ability to produce relative date/time strings like "1 hour ago", and a common function that could accept different types of format strings (like those from date and strftime) so that's why PW's $datetime has those.
    1 point
  15. @Gadgetto has fixed it - it also works for me now ? Thx @Jens Martsch - dotnetic
    1 point
  16. It works fine here with PW 3.0.148 (almost a fresh installation). No errors.
    1 point
  17. I have been able to track down the issue, the cause of the crash was my own module – TextInputAwesomeplete which was not compatible with the new custom fields on images feature. I have pushed a fix, but i wonder about the core, in terms of it being able to be resilient against a pagefinder query that incorporates one of the 'virtual' fields. https://github.com/processwire/processwire-issues/issues/1104
    1 point
  18. Have you tried it? There is already support for strtotime strings for datetime fields in PageFinder selectors, and your example query works just as you wrote it. ? For in-memory (WireArray) selectors you have to use a timestamp in the selector.
    1 point
  19. UPDATE 2020-03-01 SnipWire 0.8.3 (beta) released! In this new release the installation and uninstallation process has been heavily revised! The module and its submodules should now uninstall perfectly. To preserve the full products catalogue and products data, all fields with the custom field type FieldtypeSnipWireTaxSelector are now converted to FieldtypeText on uninstall. If yo want to reinstall SnipWire and reuse your previous products catalogue, you simply need to change the taxes field back to FieldtypeSnipWireTaxSelector. Here is the complete list of changes: Updated products package installer to add specific module config on install The uninstallation process is now much more reliable FieldtypeSnipWireTaxeSelector is now uninstalled properly (existing fields are converted to FieldtypeText) Refactored ExtendedInstaller class to be more reliable Extended resources installer page is now more user friendly Fixed product price JSON output if a currency field is missing Small fixes and code enhancements Updated apexcharts.js vendor plugin to version 3.15.6
    1 point
  20. You cannot have two pages that reference each other via "single" Page Reference fields: https://github.com/processwire/processwire-issues/issues/572 Also watch out for: https://github.com/processwire/processwire-issues/issues/1092 Workarounds include the Page IDs module or use "multiple" Page Reference fields instead of "single". I feel that the convenience of getting a Page object back as the value of a single Page Reference field is sadly outweighed by the frustration of these issues. I'd rather just get an ID that a Page object can then be loaded from if/when needed.
    1 point
  21. Just to clarify this a bit: 1. No (out of the box). 3. ProcessWire doesn't enforce any specific architecture on you; instead you can utilise just about any architecture/strategy you want. If you haven't yet had the chance to read https://processwire.com/docs/front-end/output/, I'd suggest checking it out — learning about direct output and delayed output (and their differences) should clear some things up. As @szabesz pointed out above, there are ways to use MVC (or something very similar) on ProcessWire powered sites/apps. In my opinion MVC is great for a lot of stuff, but as always, by design ProcessWire makes zero assumptions: for some use cases simple direct output approach is quite enough, and makes things more straightforward (to build, but also to maintain) ?
    1 point
  22. Admin on Steroids has an option where you can map CTRL + S to the save function. That way you don't even have to care about the button's position (but might be a bit overkill if you only need this module for only this feature).
    1 point
  23. A little hack like this for site/ready.php might be enough for that (only tested on desktop and not perfect when it comes to alignment): $this->addHookAfter('ProcessPageEdit::execute', function($event) { $event->return .= "<script> $('#pw-content-head-buttons').css('position', 'fixed'); $('#pw-content-head-buttons').css('right', '5%'); </script> "; });
    1 point
  24. I today integrated the multi-language support for all the config fields.
    1 point
  25. Maybe a directory traversal attack (to install backdoors or whatnot). I would immediately contact the hosting company, and also check for suspicious files. Lock down your forms, or any other potential areas that allow user-input.
    1 point
  26. Hi guys, I was very excited for this module, but my life took a huge direction change and I no longer have the time to invest in module development. I am gonna leave the files here. You guys can take it and run. Maybe there might be something useful here. Maybe not. I still think it's a good idea to do drag and drop modal building in PW. So hopefully one day something like that can come to light. I love this community and I love ProcessWire. Live long and prosper. - Joshua Designme 2.zip
    1 point
  27. Thank you @dragan, very constructive critic! Sorry you didn't like SnipWire... There is a single page under admin > setup which has the system flag (I decided to use the system flag because if this page is deleted SnipWire won't work). I just have not yet implemented the uninstall routine for this special page in the beta. #todo If you have a look at the docs: https://docs.bitego.com/snipwire/getting-started/install-uninstall/ the following is stated: All other SnipWire components are uninstalled perfectly here (just tested)!
    1 point
  28. I think, what you might be looking for is the 'Family' settings for templates. Here you can define, what child templates are allowed for a parent page with a specific template. So, for example, your parent page 'Blog' for your blog items might have the template 'blog' and the child pages (your blog entries) have the template 'blog-item'. In the template's 'Family' settings for template 'blog' you can define to only allow template 'blog-item' as child template. And in the template 'blog-item' you can define to only allow template 'blog' as parent template. Now when an editor adds a page to 'Blog' in the page tree, the new page will automatically get template 'blog-item' assigned.
    1 point
  29. A word of advice: Forget everything you learned about Wordpress. PW's technical concept and philosophy has little to do with how WP handles things. Make yourself familiar with the PW API, selectors, what a PW page is (or can be), and how pages, templates and fields work together. If you've got the basics down, I suggest you take a look at page reference fields, and how they can be used: for creating/defining cross-references, categories + relations - of any kind: not just in a classic sense of "frontent page A relates to page B". It's a very powerful concept.
    1 point
  30. I would suggest using the blog site profile as suggested above, even if just to learn your way around. Once you get a feel for it you will see it is relatively straightforward to set up the ability for a user to make a specific type of page (post/portfolio item etc.). Starting with the blank profile makes sense if you already understand this process and want to build something very different. The site profiles are pretty flexible and serve as good starting points for everything else (including what I feel you want).
    1 point
  31. @kongondo Great module!!! Just have one question or maybe feature request: Is there a way to add a marker with a text (textfield and a title) only and without linking to a page? I have a project where there is no page to link to and there should be only a few annotations on an image. Thanks!
    1 point
  32. UPDATE 2019-06-15 The taxes repeater field in module config editor was updated: changed to a grid view for more flexibility added field validation prepared the taxes-repeater field code to become a standalone flexible Inputfield module for general use (Array/JSON repeater input field which stores its values in a single text field) The taxes handling is completed! SnipWire now acts as a full flexible taxes-provider for Snipcart (we use Webhooks for this). No configuration needed in Snipcart dashboard. SnipCart orders are now fully working (except shipping handling). The sample shop templates got an update: customer login/logout customer dashboard link/button to view orders history and subscriptions editing of customer profile Other updates and fixes: The SnipWire Dashboard was updated (Charts, Orders, Customers, ...) --> see screenshot below. The Dashboard fetches its data from Snipcart via CURL multi - the response time for a fresh load is now under 2 seconds The Webhooks handler now supports all Snipcart events via hookable methods. Snipwire now supports all major Admin themes (Uikit, Reno and Default) All module classes/files are more structured (e.g. separate helper and service classes) Under the hood many bugs are fixed and code is updated to prevent unexpected errors. Added a crispy SVG logo for all SnipCart back-end pages ? Screen-recording of updated taxes-repeater: Screenshot of SnipWire Dashboard:
    1 point
  33. UPDATE OK, after I've faced that for and against again, I've decided to make the module freely available. If you are interested, you can test the current state of development. I already put the module on GitHub. Please note that the software is not yet intended for use in a production system. (Alpha version). For example, the configuration and handling of the VAT rates are still missing. Also the dashboard is still incomplete. And many other things needs to be improved and implemented... ? If you like, you can also submit feature requests and suggestions for improvement. I also accept pull requests. https://github.com/gadgetto/SnipWire
    1 point
  34. Hi @gottberg There is a bit of work to get images, as the way you are doing return Images Objects and not array. You can have a look at this file to see the "complexity" to retrieve those objects : https://github.com/microcipcip/processvue/blob/master/site-processvue/templates/inc/pagefields.php#L236 Or you can build your own images array before assigning it to the API answer : See updated ImageHelper.php file at the bottom of this post. /* route : 'page' => [ ['GET', '{id:\d+}', Example::class, 'getPage', ["auth" => false]] ] */ // get page route answer function public static function getPage($data) { $data = RestApiHelper::checkAndSanitizeRequiredParameters($data, ['id|int']); $response = new \StdClass(); $p = wire('pages')->get($data->id); if(!$p ->id) throw new \Exception('Page not found'); $response->id = $p->id; $response->name = $p->name; $response->title = $p->title; $response->body = $p->body; $response->sidebar = $p->sidebar; $response->summary = $p->summary; // our own images array $images = array(); foreach ($p->images as $image) { array_push($images, array( $image->name => array( 'url' => $image->url, 'filename' => $image->filename, 'width' => $image->width, 'height' => $image->height // ... ) ) ); } $response->images = $images; return $response; } Result : --- Edit : The image class helper : <?php namespace ProcessWire; /** * InputfieldImage Helper * Use for single image * * Usage : * $image is your ProcessWire PageImage * return ImageHelper::get($image, [400, 800, 1200, 2000, 2500]); */ class ImageHelper { public static function get ($image, $widths = [400, 800, 1200]) { $response = new \StdClass(); $response->focus = ["x" => $image->focus['left'], "y" => $image->focus['top']]; $response->urls = []; $response->description = $image->description; $response->name = $image->basename; $response->width = $image->width; $response->height = $image->height; foreach ($widths as $width) { $croppedImage = $image->width($width); $url = new \StdClass(); $url->url = $croppedImage->httpUrl; $url->width = $croppedImage->width; $url->height = $croppedImage->height; $url->ratio = $croppedImage->height / $croppedImage->width; array_push($response->urls, $url); } return $response; } } /** * InputfieldImage Helper * Use for multiple images * * Usage : * $images is your ProcessWire PageImages * return ImagesHelper::get($images, [400, 800, 1200, 2000, 2500]); */ class ImagesHelper { public static function get($images, $widths = [400, 800, 1200]) { $response = new \StdClass(); $response->images = []; $img = new \StdClass(); // our own images array $imagesArr = array(); foreach ($images as $image) { $img->focus = ["x" => $image->focus['left'], "y" => $image->focus['top']]; $img->urls = []; $img->description = $image->description; $img->name = $image->basename; $img->width = $image->width; $img->height = $image->height; foreach ($widths as $width) { $croppedImage = $image->width($width); $url = new \StdClass(); $url->url = $croppedImage->httpUrl; $url->width = $croppedImage->width; $url->height = $croppedImage->height; $url->ratio = $croppedImage->height / $croppedImage->width; array_push($img->urls, $url); } array_push($response->images, $img); } return $response; } }
    1 point
  35. $designers_person = $pages->find("parent=/designers/, designers_lastname!=''")->each(function($designer){ $designer->custom_sort = $designer->designers_lastname; }); $designers_group = $pages->find("parent=/designers/, designers_lastname=''")->each(function($collective){ $collective->custom_sort = $collective->title; });; $all = $designers_person->add($designers_group)->sort('custom_sort');
    1 point
×
×
  • Create New...