Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/08/2020 in Posts

  1. Super! Love reading those long feature lists for the new master versions! I usually read every week's posts too. But by the time a new master is out, I forget a half of new cool things that were added. So they come as new and bring the joy once again, like finding a banknote in a pocket of pants you didn't wear for while ? Great release for ProcessWire once again!
    5 points
  2. This week we’re proud to announce the newest ProcessWire master version 3.0.164. Relative to the previous master version (3.0.148) this version adds a ton of new and useful features and fixes more than 85 issues, with more than 225 commits over a period of 7 months. There were also a lot of technical changes in the core, including some pretty significant refactoring of several classes to further optimize and improve upon our already solid core, making it that much better. I’m confident this master version is one of our best and if you are running an older version I’d encourage you to upgrade when convenient to do so—I think you will really like what this version brings! Read all about what’s new in the latest blog post: https://processwire.com/blog/posts/pw-3.0.164/
    4 points
  3. This is great stuff! Got a question. Who is maintaining the PW Demo site? It would be nice to have these new features incorporated into the skyscrapers. Also, the demo is still on version *.101 and not using ssl.
    3 points
  4. Hey @eydun! While this could indeed be a potential addition at some point (not making any promises, but will keep this in mind), it's also already doable with a bit of code: if you hook after getItems(), you can add new items to the returned array ?
    2 points
  5. I 've done a pull request against the v2 branch, only three underscores added ? This is how I hooked it in ready.php (these are theme specific overrides, so I want to keep them in the /site/ folder somewhere): // If I want to do something with front pages (old code) //if (strpos($_SERVER['REQUEST_URI'], $config->urls->admin) !== 0) { // my front pages are all extending a FrontPage class // see https://processwire.com/blog/posts/pw-3.0.152/#new-ability-to-specify-custom-page-classes if (is_subclass_of(page(), 'Processwire\FrontPage')) { // [...] $wire->addHookBefore('PrivacyWire::render', function($event) { $event->replace = true; $privacywire = $event->object; $isProCache = modules()->isInstalled('ProCache') && modules()->get('ProCache'); $jsFilePath = getModuleFile($privacywire, 'js/PrivacyWire.js', true); if ($isProCache && $privacywire->use_procache_minification) { $jsFilePath = modules()->get('ProCache')->js($jsFilePath); } $output = wireRenderFile(getModuleFile($privacywire, 'PrivacyWireBanner.php'), [ 'module' => $privacywire ]); $output .= "\n<script>var PrivacyWireSettings={version:'{$privacywire->version}',dnt:'" . ((int) $privacywire->respectDNT) . "'};</script>"; $output .= "\n<script defer src='{$jsFilePath}'></script>"; $event->arguments(0)->return = str_replace("</body>", "{$output}</body>", $event->arguments(0)->return); }); // [...] } /** * checks for a module file override in the path defined * @param object $module the module needing a file overriden * @param string $file_path the override file path, from the module folder, i.e. "js/PrivacyWire.js" * @param boolean $is_url switch for outputting a path or an URL, by default the function outputs a path * @return string the override path is it's readable or the initial file path if it's not */ function getModuleFile($module, $file_path, $is_url = false) { // we're putting module overrides in /site/templates/modules/ $override_dir = 'modules/' . $module->className() .'/'; $override_path = paths()->templates . $override_dir . $file_path; // we're overriding files in the module's folder $default_path = paths()->$module . $file_path; if (is_readable($override_path)) { return $is_url ? urls()->templates . $override_dir . $file_path : $override_path; } return $is_url ? urls()->$module . $file_path : $default_path; }
    2 points
  6. Well this was a great one to do. The Beyond Banglatown site is the public facing site for a report conducted by researchers at the London School of Economics and the University of Manchester, and published by the Runnymede Trust. The aim is to present the findingsof the report in a publically accessible way that can be used by teachers and students and well as the general public. It covers the changing face of the neighbourhood around Brick Lane in East London. https://beyondbanglatown.org.uk/ Technically this was the first project we used ProcessWire on - although what with one thing and another it's taken 18 months to get the site launched, so we've managed to get a few others out before this one. It was certainly jumping in at the deep end though and we learned a lot. The site involves a fair amount of ajax driven content and we had to get to grips with importing the data used for the maps and graphs as well as sorting out how best to manage templates and assets. As far as modules that we used there's nothing too exciting, but certainly we made good use of TracyDebugger as we fumbled about. A special mention also needs to go to the PW documentation, the API references and of course this forum which provided a great deal of help. Anyway - we're really pleased with the site and it's already been getting very good coverage. Hopefully the first of many PW sites. s.
    2 points
  7. Hello friends! I have another module for you, which will make your daily work as a Processwire developer easier. Introducing: AppApi This module helps you to create api-endpoints, to which an app or an external service can connect to. Features Simple routing definition Authentication - Three different authentication-mechanisms are ready to use. Access-management via UI Multiple different applications with unique access-rights and authentication-mechanisms can be defined The documentation has become quite extensive, so have a look at the Github repository for details: Installation Defining Applications Api-Keys PHP-Session (Recommended for on-site usage) Single JWT (Recommended for external server-calls) Double JWT (Recommended for apps) Creating Endpoints Output Formatting Error Handling Example: Listing Users Example: Universal Twack Api Routes Page Handlers File Handlers A special thanks goes to Thomas Aull , whose module RestApi was the starting point to this project. This module is not meant to replace this module because it does a great job. But if you want to connect and manage multiple apps or need other authentication methods, this module might help you. I am already very curious about your feedback and would be glad if the module helps you a little bit.
    1 point
  8. Render oEmbed data from YouTube/Vimeo URLs... or TextformatterVideoEmbed for power users. https://github.com/nbcommunication/TextformatterVideoMarkup The use case... On an upcoming project, we want to be able to render YouTube/Vimeo URLs as thumbnail images, that when clicked open up in a (UIkit) lightbox. Additionally, we want to be able to specify the thumbnail image - as part of a RepeaterMatrix block which contains a URL field (video) and an Image field (thumb). The result is this module, which allows you to specify the markup used to render the oEmbed data: The formatter can be used on any Text field e.g. Text, Textarea (CKEditor or not), URL etc. Global configuration options are available (e.g. rel=0), based on TextformatterVideoEmbedOptions. An 'empty value' can be specified for URLs that do not return data from the oEmbed endpoint The render method is hookable, allowing you to customise rendering on a per page, per field basis Plenty more information here ? https://github.com/nbcommunication/TextformatterVideoMarkup/blob/master/README.md Back to the use case... How do we render the thumbnail and then use the image from our Image field? In the module config Markup field: <figure data-uk-lightbox> <a href="{url}" data-poster="{thumbnail_url}" data-attrs="width: {width}; height: {height}"> <img src="{thumbnail_url}" alt="{title}"> </a> </figure> Then in site/ready.php <?php $wire->addHookBefore('TextformatterVideoMarkup::render', function(HookEvent $event) { // Arguments (for info) $tpl = $event->arguments(0); // string: The markup template $data = $event->arguments(1); // array: The oEmbed data $url = $event->arguments(2); // string: The requested URL $emptyValue = $event->arguments(3); // string: The empty value used if no data is returned // Object properties (for info) $page = $event->object->page; // Page: The page $field = $event->object->field; // Field: The field $html = $event->object->html; // bool: Is it HTML being parsed, or plain text? // Replace the thumbnail image if($field->name == 'video' && $page->hasField('thumb') && $page->thumb) { $data['thumbnail_url'] = $page->thumb->url; $event->arguments(1, $data); } }); The module requires PW >= 3.0.148 and PHP >= 7. It probably doesn't need to, but the expectation is that power users will be able to meet these requirements! The module is also Beta - please don't use in production yet. I suspect there will be edge cases related to the changes I made to the URL regexes from TextformatterVideoEmbed - so far though they are working for me. If you come across any issues please let me know! Cheers, Chris
    1 point
  9. Hello @benbyf, Do you plan to update and maintain this plugin? Thanks, Andrei
    1 point
  10. Thank you for the PR and the idea! Of course it's a good think to have the render function hookable. I also like the idea of @horst with an hookable output file. I would definitely like to spend some time soon to refactor / optimize PrivacyWire.
    1 point
  11. Hi, The next time a client is going to ask you to build his website in WordPress, you could show him this: https://www.ic3.gov/media/2015/150407-1.aspx
    1 point
  12. Couple of other notes: Quote: "All $config->ajax does is checking for the request header "X-Requested-With", which is not even a real standard. It is included in jquery's ajax tools by default, but most modern ajax libraries don't do that anymore. There's nothing more to it." Quotes: "Make sure your post url ends with a slash." "Otherwise the .htaccess (or php not sure) will do a redirect, which essentially strips all the headers sent with the request." Also, use $this->halt() instead of exit() or die(), read more on it here. (such as: note that return $this->halt(); must be called from directly within the template file, outside of any function or class scope) Use Tracy Debugger to ease the pain ? https://processwire.com/talk/topic/12208-tracy-debugger/page/31/?tab=comments#comment-135558
    1 point
  13. https://www.urbandictionary.com/define.php?term=reiska A very beautiful girl with a gorgeous smile, very confident, honest, and smart. Even though others don’t really value her as much, she will be very independent and also not interested in what others say or feel. She must come first regardless of how others treat her. ?
    1 point
  14. u.can do on anyee page template like .this if($config->ajax){ // u do.ajax $data=['status'=>'ok', 'massage'=>'hi whirld']; header('content-type: application/json'); echo json_encode($data); exit; }else{ // u.do html }
    1 point
  15. Hi @Youbility, yes I did. It's working on production at https://www.brightline.org/ Here's a slightly different version of that one: https://gist.github.com/sjardim/d74fae71b5bfe6a44ab88efc9aaa5279 Hope that helps!
    1 point
  16. 1 point
  17. Ah, but of course! How could I forget about hooks! Thank you, @horst! I realize now that I could probably keep all my overrides in a single place, depending on the presence of the hooks, of course. @joshua, please make the render() function hookable. Sometimes I wish ProcessWire could be more restrictive, my /site/ folder is a frankensteinish patchwork of code snippets, because I used whatever the search cat dragged in first ?
    1 point
  18. Good news! We are live now! AppApi has been approved and now appears in the modules directory: https://modules.processwire.com/modules/app-api/ Thank you for your many reactions to the release - I hope it helps you build the best apis you can imagine!
    1 point
×
×
  • Create New...