Leaderboard
Popular Content
Showing content with the highest reputation on 02/05/2018 in all areas
-
4 points
-
Version 2.1.0 of VersionControl was just pushed to the 2.0 branch at GitHub. Note that this update changes the field-level UI quite a bit (see screenshot below). Personally I like this UI better anyway, but the main reason for the change was that it would've been a major pain to get the old UI to work with both the (current) default admin theme and AdminThemeUikit – let alone any third party admin themes. The colour theme is currently hardcoded, so it doesn't adapt to whatever changes you might've made to your admin theme. It's also exactly the same for both built-in admin themes. I could make some parts configurable at some point, but for the time being this is better than nothing. Next up: more testing. I'm pretty sure that there are a few bugs here and there that I've managed to miss, and I'd like the core features of this module to be as solid as possible. I'm also contemplating giving the History tab a major facelift, but that's not exactly the first item on my list right now4 points
-
2 points
-
2 points
-
Little bit chuffed with this new function. You can adapt it to create thumbnail images of external web pages. In my case, it creates a thumbnail image of the publicly viewable Eventbrite event page and attaches it to the PW event page. The $ebResponse is the json_decoded data returned from the webhook call to Eventbrite. /** * Calls the pagepeeker.com API to generate a thumbnail of the Eventbrite public page * @param $ebResponse- the json decoded response from Eventbrite * @param $options = refer pagepeeker API doc - * $options['entrypoint'] - Free 'free'. That makes it: http://free.pagepeeker.com/ * Unbranded 'api'. That makes it: http://api.pagepeeker.com/ * All paid accounts 'api'. That makes it: http://api.pagepeeker.com/ * * $options['size'] - The size of the thumbnail. Available sizes: * 't' Tiny, 90 x 68 pixels * 's' Small, 120 x 90 pixels * 'm' Medium, 200 x 150 pixels * 'l' Large, 400 x 300 pixels * 'x' Extra large, 480 x 360 pixels * * $options['code'] - Your API key. This is optional and recommended to use only for server side calls. * Client side usage does not require it, as we automatically show the thumbnails only * for the domains added in your account. * For the free branded accounts, this parameter is ignored, as we provide the free branded * service for anybody, free of charge. * * Warning * Never use this code on client side pages. We use it for counting your API calls, so having * it used by third parties will count against your monthly quota. * $option['template'] - your PW page template * $option ['field'] - your PW page template image field * $option['page'] - the page to retrieve and attach the image to * * @return mixed * @throws WireException */ public function ___pagePeeker ($ebResponse, $options) { $entrypoints = array('free', 'api'); $options['entrypoint'] = in_array($options['entrypoint'], $entrypoints) ? $options['entrypoint'] : 'free'; $options['size'] = !empty($options['size']) ? $options['size'] : 'l'; $p = $this->wire('pages')->get($options['page']->id); if (!$p->id) throw new WireException($this->className() . _(' invalid page supplied in pagePeeker options')); $templateName = $options['template']; $tpl = $this->wire('templates')->get("name=$templateName"); $imagesField = $options['field']; if (!$tpl->hasField($imagesField)) throw new WireException($this->className() . _(' the template you supplied does not have the image field as specified in pagePeeker options')); $ebLiveUrl = urlencode(str_ireplace("https://www.", "", $ebResponse['url'])); $http = $this->wire(new WireHttp()); // http://{entrypoint}.pagepeeker.com/v2/thumbs.php?size=m&refresh=1&url=wikipedia.org $peekerUrlMake = 'http://' . $options['entrypoint'] . '.pagepeeker.com/v2/thumbs.php?size=' . $options['size'] . '&url=' . $ebLiveUrl; // Get the contents of a URL $response = $http->get($peekerUrlMake); if($response !== false) { $responseObj = json_decode($response); if ($response['error'] == 1) { // error generating thumbnail throw new WireException($this->className() . _(' problem generating pagepeeker thumbnail')); } // OK no errors but thumbnail not ready. Try every pagepeeker server $response = $http->get('http://' . $options['entrypoint'] . '.pagepeeker.com/v2/thumbs_ready.php?size=' . $options['size'] . '&url=' . $ebLiveUrl); $response1 = $http->get('http://' . $options['entrypoint'] . '1.pagepeeker.com/v2/thumbs_ready.php?size=' . $options['size'] . '&url=' . $ebLiveUrl); $response2 = $http->get('http://' . $options['entrypoint'] . '2.pagepeeker.com/v2/thumbs_ready.php?size=' . $options['size'] . '&url=' . $ebLiveUrl); $response3 = $http->get('http://' . $options['entrypoint'] . '3.pagepeeker.com/v2/thumbs_ready.php?size=' . $options['size'] . '&url=' . $ebLiveUrl); $response4 = $http->get('http://' . $options['entrypoint'] . '4.pagepeeker.com/v2/thumbs_ready.php?size=' . $options['size'] . '&url=' . $ebLiveUrl); /** * Finally, thumbnail is ready * Download the image: http://{entrypoint}.pagepeeker.com/v2/thumbs.php?size=m&url=wikipedia.org * Check all the available pagepeeker servers to speed up the download **/ if ($response) { $fromUrl = "http://" . $options['entrypoint'] . ".pagepeeker.com/v2/thumbs.php?size=" . $options['size'] . "&url=" . $ebLiveUrl; } elseif ($response1) { $fromUrl = "http://" . $options['entrypoint'] . "1.pagepeeker.com/v2/thumbs.php?size=" . $options['size'] . "&url=" . $ebLiveUrl; } elseif ($response2) { $fromUrl = "http://" . $options['entrypoint'] . "2.pagepeeker.com/v2/thumbs.php?size=" . $options['size'] . "&url=" . $ebLiveUrl; } elseif ($response3) { $fromUrl = "http://" . $options['entrypoint'] . "3.pagepeeker.com/v2/thumbs.php?size=" . $options['size'] . "&url=" . $ebLiveUrl; } elseif ($response4) { $fromUrl = "http://" . $options['entrypoint'] . "4.pagepeeker.com/v2/thumbs.php?size=" . $options['size'] . "&url=" . $ebLiveUrl; } else { throw new WireException('Did not get a response from PagePeeker'); } $imgName = "eb-preview-" . $ebResponse['id']; $toFile = $this->wire('config')->paths->assets . "files/" .$p->id .'/'. $imgName . '.jpg'; $p->of(false); $img = $http->download( $fromUrl, $toFile); // OK we have the downloaded file, now add it to the page database info for the images field $imgUrl = $this->wire('config')->urls->assets . "files/" .$p->id .'/'. $imgName . '.jpg'; $pwImage = new Pageimage($p->$imagesField, $toFile); $pwImage->description = $ebResponse['name']['text']; $pwImage->tags = "eb-preview"; $p->$imagesField->add($pwImage, $imgUrl); return $img; } else { throw new WireException("HTTP request failed: " . $http->getError()); } }2 points
-
- You can organize your images the way you want and not necessarily per page / repeater-item. For example using Media Library. - You can access the same image from different pages. No need to upload it several times. This can be done in CKEditor, but there was no single field type for this. One example is a repeater for an image-carousel. You can now put all the images in a Media Page called e.g. "Carousel" and then just pick them up in the repeater's ImagePicker. - You can also fill in an external Image URL and you will see a preview in the backend. - You can have an overview of all images in all pages of your site. (Not in Repeaters and Pagetables though) - Website admins can give backend users (editors) a predefined set of images for a certain field which they can choose from by defining selectors. - Picking up images is fast with ImagePicker. Thank you.2 points
-
Maybe you better should collect an array, and leave it as is? $address_rev = wire('users')->find("roles=revisor"); $emailcc = array(); foreach($address_rev as $one){ $emailcc[] = one->email } $options = array( 'sendSingle' => true, 'cc' => $emailcc );2 points
-
New version just committed that is a must for Windows users - a huge thanks to @matjazp for the report and also local access to his dev machine so I could find and fix all the issues. You Windows guys need to speak up when you see issues - the Console, Snippet Runner, and Captain Hook panels in particular were a mess Please let me know if you see anything I have missed. Other changes include: Add custom register_shutdown_function() for Console and Snippet Runner panels - especially important for PHP 5.x. PHP 7 handles most errors as non-fatal. Fix AJAX panel updating for Console/Snippet Runner when SessionHandlerDB not installed. A few styling fixes.2 points
-
@Mijo Try this: //Grabbing the news list $posts = $page->children("limit=10"); //Rendering each news post foreach($posts as $post) { echo "Lorem Ipsum..."; //Rendering selected tags inside each post foreach($post->tags as $tag) { echo "<li><a href='{$tag->url}'>{$tag->title}</a></li>"; } }2 points
-
Hey @Robin S - I thought since I've been mucking about with a lot of modules and code I would do a clean install and see what happened. I did a 100% clean install on a site that has literally never had anything on it (I owned the domain but have never used it). Only added one field for images with one template. Created a page and got this error: I'll send you a message with login details to the new site. Thanks!1 point
-
@hezmann, if you can give me access to your dev site (send me a message) I would be happy to take a look. Otherwise I'm out of ideas sorry.1 point
-
Sure, you can create a ProcessModule only for that purpose like shown in my blogpost and then restrict this module to your desired roles.1 point
-
I haven't used their new PWA toolkit, but I have used PW as a backend for an Ionic app before. Might be worth taking a look: https://blog.ionicframework.com/announcing-the-ionic-pwa-toolkit-beta/1 point
-
1 point
-
Thanks! These sort of cryptic patterns ARE very useful but only after I have implemented them properly1 point
-
The issue you are seeing is actually the missing pipe (|) between the name and the format. Try this: /*Hungary*/ hungaryAreaCodeOnly | {([phoneAreaCode])}-{[phoneNumber,0,3]}-{[phoneNumber,3,4]}1 point
-
I think I figured it out, I am missing the first pipe character and that is why I got the warning.1 point
-
Wow @theo I like very much!! This work perfectly with Media Library!! I think a lot of people will benefit from it, so, thanks you a lot!! About some possible changes, honestly I do not see. Yes multiple images could be good but not essential, it's possible use the Repeater Field. Maybe could better when click on in the image, instead of the link to the media, have the possible to delate the image or have the box for edit the image. But I think this will be more difficult because in this way needs also save the new image and not edit the original. But anyway this module is very very helpful! Thank you again!1 point
-
1 point
-
Hi, me again - queen of the ProcessWire API Wrapper. Why re-invent the wheel when there are so many great, well-supported apps out there that don't impact on the core of PW? Almost see PW as a portal. Latest endeavour is a PW module for Eventbrite v3 API https://www.eventbrite.com/developer/v3/ The EB webhooks are a easy-peasy-lemon-squeezy. Love it! Can do any of the API GET calls providing they don't include any parameters, eg: $eb = $modules('EventbriteAPI')->login(); $ebUser = $eb->client->get('/users/me/'); $ebUserId = $ebUser['id']; // /users/:id/owned_events/ $result = $eb->get("/users/$ebUserId/owned_events"); Problem I'm having is with using parameters in the actual API, eg: $eb = $modules('EventbriteAPI')->login(); $ebUser = $eb->client->get('/users/me/'); $ebUserId = $ebUser['id']; $ebPath = "/users/$ebUserId"; $token = $sanitizer->text($eb->access_code); $pageSize = $sanitizer->int(5); $expand = array(); $result = $eb->client->get( $ebPath . "/events?&token=" . $eb->access_code . "&page_size=" . $pageSize ); Every time I use a parameter, I get the EB error message for the last one, in the example below, the paging limit: "There are errors with your arguments: page_size - Enter a whole number." Even stranger is if I manually create the URL, eg https://www.eventbriteapi.com/v3/users/2425020999999/events?&token=WNU7SPIEUUUIXXXXXX&page_size=5 in the EB API test environment, I get the correct result. Fairly certain it's an EB issue but wanting to double check I've got everything right and the PW API isn't doing anything too clever with the $_GET vars. Any help/suggestions most welcome. Thanks psy1 point
-
Hi @Chris, you PM'ed me with the question if I once had written a module that creates one page per uploaded image. No, I never had. But those questions are better asked directly to our friendly and helpful community. I remember too that there was something, but was it somas images manager? or does anyone else has written something among that line? If there isn't anything else around here, you may strip out the upload and page creation process from somas module.1 point
-
1 point
-
1 point
-
Shadow DOM sounds like the ideal treat for Tracy bar encapsulation headaches, when it will widely supported: https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM1 point
-
Another useful update - the File Editor panel now remembers and reopens the folder tree to the currently open file and highlights that file. Should make navigation to related files much simpler after save when the page reloads.1 point
-
@Nick Belane, the issue with multi-language fields is hopefully fixed in v0.1.2. Please update and let me know if you are still seeing an issue. Thanks @adrian for debugging help.1 point
-
I've tried several URL's from various places - all get the same error I get it with every URL so yes, reproducable. I have not been able to save any images this way. Saving the image and then uploading works fine. Not inside a repeater or anything special, just a normal Images field Full Error: Source Code1 point
-
I think they're counting each variation of an icon (solid, light, etc) as a separate icon, but these variations use the same class name. Typical marketing stuff to puff up the numbers. Maybe the brands font should be loaded by default rather than being optional, because if it isn't loaded it leaves unrendered icons in the list which might confuse users about what the problem is.1 point
-
something interesting to make the backend faster without modifying everything: https://m.signalvnoise.com/stimulus-1-0-a-modest-javascript-framework-for-the-html-you-already-have-f04307009130 code: https://github.com/turbolinks/turbolinks https://github.com/stimulusjs/stimulus1 point
-
To be honest, I'm having a hard time understanding exactly what you need to accomplish . Even a simple mockup would help. Anyway, to your question. I'm having a hard time understanding your setup. For instance, you say: Do you have a single page called walks? (you say has a multi-selected page reference) OR you have multiple pages called walks. (you say I then have pages...). Secondly, where is this "walks"? Is the multi-select page reference field attached to the templates of both Continents and Countries? And more? I'm asking in order to give you a definitive answer. Irrespective, I believe what you want is either $pages->count("selector here") OR $page->numChildren("selector here"). Please note the differences as per the docs below: http://processwire.com/api/ref/page/num-children/ http://processwire.com/api/ref/pages/count/1 point
-
It's been out for about 10 days now, but I never really announced the changes here - wanted to see if there were any issues before publicizing. The new 4.9.x version is now available. Here's a list of the main changes: 1) New File Editor Panel Supports editing all files in your PW install (you can define the root as /, /site, or /site/templates Can be used as the handler for opening editor links from the debug bar (errors, log files, Captain Hook, ToDo, Template editor, etc), rather than your code editor. Can be enabled as the link handler for live sites only, or local as well if you prefer. Has "Test" functionality for all files so if you make a change, it will only appear for you and not other users. Makes a backup of the old version each time you save a change and provides a "Restore Backup" button to instantly revert. Supports in-code search & replace with CMD+F Syntax highlighting/linting for PHP, CSS, and JS This replaces the Template Editor panel, so that one has been removed. Handles fatal errors gracefully - this is the biggest feature in my opinion. The problem with most online file editors is that if you accidentally make a code change that results in a fatal error, it can be impossible to fix and resave because the system is not functional. This editor gets around this problem by using Tracy's custom error handling which allows debug bar panels to continue to work, so you can manually fix the problem, or click the "Restore Backup" button. Of course if you used the "Test" option, you don't even need to worry, because you are the only one to see the version with the error anyway. As a follow up to that last point. I have used the excellent ProcessFileEdit module for helping to debug some issues on other people's sites without needing FTP access, but a couple of times I have made a fatal error mistake and had to get them to restore the file, so this really is a huge feature for me! 2) Support for Process File Edit If you prefer ProcessFileEdit to this new File Editor Panel, so you can use it for handling debug bar links. Note that this won't give you the "Test" and "Restore" options, or the fatal error protection, so it's not really recommended. I added support for it before building the File Editor panel so decided to leave in case others prefer it. 3) Revamped Console Panel The code and results sections are now a "split" screen so you can adjust the size of one relative to the other with the bar in the middle. Handy for working, but especially handy when you want to post a screenshot to the forums "Large and "Small" versions of the panel - click the arrows at the top right of the panel - the large version can be very handy when you have lots of code or results to display Supports in-code search & replace with CMD+F 4) New maxDepth and maxLength shortcuts and new barDumpBig() method You can now replace dump or barDump calls like: bd($var, array('maxDepth' => 7, 'maxLength' => 500)); with: bd($var, [7,500]); You can also make use of the new: bdb($var); as a shortcut to: bd($var, [6,999]); 5) New SQL Query column in the Selector Queries section of the Debug Mode panel This is a great learning tool to see the selector queries that are run for a given page request, and what SQL query these selectors are translated into: 6) Removed old Legacy version of Tracy core It was getting too painful to maintain support for this old version. This means that TD now requires PHP 5.4.4+ 7) Namespacing and refactoring lots of Javascript code No feature changes, but code is now easier to follow and is much less prone to any name conflicts with your site 8) Reduced loading of unnecessary code Lots of refactoring here too - should see some performance gains 9) New default server type indicator in the debug bar Not a big deal, but if you want a server type indicator and don't want the full height/width bar, you can now have one in the debug bar - I think it's a handy visual clue when looking at /working on live vs dev/test versions of a site at the same time. 10) Lots and lots of bugs fixes, layout, and styling improvements It's amazing what you find when you're buried in the code for a couple of weeks solid 11) The new docs site that I mentioned earlier is now fairly complete - I just need to work on the Tips & Tricks section https://adrianbj.github.io/TracyDebugger Feel free to make a PR for improvements to the docs - everything is under the /docs folder in the main Github repo. There are also "Edit on github" links on each page so you can use those as well.1 point
-
Hi @huhabab, Welcome to the forums. Glad you find the module useful. Yes, they are. What events are you missing? Have you seen the ones listed in the docs under Callback Options ? I have tested a couple and they work as advertised. The Callbacks section of the API Docs is also a good read in this regard. Maybe you can show us some code?1 point