Leaderboard
Popular Content
Showing content with the highest reputation on 06/07/2016 in all areas
-
Basic implementation of the Simple MDE as an Inputfield. https://simplemde.com/ Module developed in reply to request from @OrganizedFellow (https://processwire.com/talk/topic/13474-found-a-handy-js-based-markdown-editor/) Modules Directory: http://modules.processwire.com/modules/inputfield-simple-mde/ Github: https://github.com/outflux3/InputfieldSimpleMDE Editor example: Preview mode: Frontend output (using Markdown/Parsedown textformatter and Image Tags) Limitations etc: This has been tested with multiple instances on 1 page and seems to work fine. Toolbar is not configurable, but you can edit the JS file; In the spirit of keeping this simple, there are no module settings. If you want the spellchecker, you can enable it in the JS file. If is seems that there is a need for configurable instances, it could be added, but so far this works fine and can't see any reason to complicate it further.15 points
-
$byColor = array_reduce($children->getArray(), function($carry, $child){ $carry[$child->color][] = $child; return $carry; }, array()); $toTextBlocks = array_map(function($color, $children){ $childrenPA = (new PageArray)->import($children); return "$color (" . $childrenPA->implode(", ", "title") . ")"; }, array_keys($byColor), $byColor); $line = implode(", ", $toTextBlocks);4 points
-
$pageArray = $page->your_field; $total = $pageArray->count(); $limit = 20; $pageNum = $input->pageNum - 1; // make it zero based for calculation $start = $pageNum * $limit; $paginatablePageArray = $pageArray->setStart($start)->setLimit($limit)->setTotal($total); This way you'll get a PageArray, which will work like any $pages->find() one in terms of pagination.3 points
-
3 points
-
I can really recommend http://adamwathan.me/refactoring-to-collections/ if you're curious (has a free sample as well). Brought a lot of light into all those functions and their usefulness.2 points
-
Thanks! Glad to hear you can make use of it. Just tried the ctrl-s combo and I got it working. Here is a snippet I have atm if you can't wait: $(document).ready(function () { var saveButton = $('#submit_save'); CKEDITOR.on('instanceReady', function (evt) { var editor = evt.editor; editor.document.on('keydown', function (e) { if (e.data.getKeystroke() == CKEDITOR.CTRL + 83) { e.data.$.preventDefault(); saveButton.trigger('click'); return false; } }); }); });2 points
-
Filtering for filenames with images will / is be one of the most used functions of all for me. If you have done the images your self and use a naming convention, this is the fasted way to find specific images / images groups out of hundreds. Also, with an own naming convention, (and knowing the images), you don't need to tag the images. Thanks @tpr!2 points
-
2 points
-
I've encountered this bug a number of times when launching, finally got around to looking into it and submitted a pull request. Not the most elegant fix, but it seems to work. My fork is available here: https://github.com/deeplypixelating/pw-admin-custom-pages2 points
-
@pmichaelis + @chugurk maybe my answer help both of you... i use MapMarker Field only in backend to get lat and long data from adresses and use them with leaflet cluster maps to generate frontend output from the geodata... in your main template or header add needed scripts: <!-- set extra scripts to load if there was a map on the page --> <script type="text/javascript" src="<?php echo $config->urls->templates?>theme/js/jquery.min.js" ></script> <script src="<?php echo $config->urls->templates?>theme/js/leaflet.js"></script> <script src="<?php echo $config->urls->templates?>theme/js/leaflet.markercluster.js"></script> <link rel="stylesheet" href="<?php echo $config->urls->templates?>theme/css/leaflet.css"> <link rel="stylesheet" href="<?php echo $config->urls->templates?>theme/css/MarkerCluster.css"> <link rel="stylesheet" href="<?php echo $config->urls->templates?>theme/css/MarkerCluster.Default.css"> in your template to show the map with many markers using marker cluster output you could use something like this: //set output $map = ''; $addressPoints = ''; //get all addresspoints for the JS of the MarkerCluster $items = $pages->find("template=entry, map!=''"); foreach ($items as $m) { if ($m === $items->last()) { $addressPoints .= '['.$m->map->lat.', '.$m->map->lng.', "<a title=\"'.$m->title.'\" href=\"'.$m->url.'\">read more</a>"]'; } else { $addressPoints .= '['.$m->map->lat.', '.$m->map->lng.', "<a title=\"'.$m->title.'\" href=\"'.$m->url.'\">read more</a>"],'; } } //render cluster map with all items //centered to bavaria lat/long!! //set the needed inline JS for the map content $inlineJS = " <script> var addressPoints = [$addressPoints]; var tiles = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { maxZoom: 18, attribution: '© <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>' }), latlng = L.latLng(48.1835,11.8570); var map = L.map('map', {center: latlng, zoom: 8, layers: [tiles]}); var markers = L.markerClusterGroup(); for (var i = 0; i < addressPoints.length; i++) { var a = addressPoints[i]; var title = a[2]; var marker = L.marker(new L.LatLng(a[0], a[1]), { title: title }); marker.bindPopup(title); markers.addLayer(marker); } map.addLayer(markers); </script> "; $map .= '<div id="map"></div>'; $map .= $inlineJS; $content .= $map; This should render a map like the developer locations map http://directory.processwire.com/map/ with marker clusters... for single marker output there should be a lot of information in the topic if you search or read for it.... https://processwire.com/talk/topic/9711-map-marker-map/page-2#entry18338 https://processwire.com/talk/topic/9711-map-marker-map/page-2#entry21061 https://processwire.com/talk/topic/9711-map-marker-map/page-3#entry28913 since post #98 you could use MarkupGoogleMap too render a map on frontend: https://processwire.com/talk/topic/9711-map-marker-map/page-5#entry41984 please read carefully before asking and provide code examples if you get stucked.... best regards mr-fan2 points
-
AdminOnSteroids Various admin tweaks to enhance ProcessWire admin. http://modules.processwire.com/modules/admin-on-steroids/ https://github.com/rolandtoth/AdminOnSteroids1 point
-
Hi there, I'm currently starting out with some already quite big projects in cooperation with a partner agency in Munich. There are different scopes of work from rather simple-in-structure content websites to a quite complex SaaS webapp in the pipeline. Therefore I'm looking for possible partnerships with at least one freelancer to assist in these projects, possibly as long-term collaboration. Some proximity to our office in munich would be preferable, but is not required, as is knowledge of the german language. Please drop me a line on the forum if you're interested, so we can get into the details. Greetings, Benjamin1 point
-
i'm sure this is nothing fancy for all the pros here, but at least i did that a lot more inconvenient for a long time and maybe it will help someone else... $lines = array(); $lines[] = $page->company; $lines[] = $page->forename . ' ' . $page->surname; $lines[] = $page->address; $lines[] = $page->zip . ' ' . $page->city; $lines[] = $page->country; echo implode("<br>", array_filter($lines)); // or like this $lines = array( $page->company, implode(" ", array_filter(array( $page->prefix, $page->forename, $page->surname, $page->suffix ))), $page->address, $page->zip . ' ' . $page->city, $page->country ); echo implode("<br>", array_filter($lines)); it will skip all empty lines automatically (for example if there is no "company" or no country) and it's a whole more readable then with lots of IFS and ECHOS1 point
-
Very thorough of you Adrian to raise the issue in Github! Your absolutely right in doing so as one would be expecting such a highly favoured / liked module such as AIOM to work with all the profiles in a fresh site install. That backspace trick of yours sure is really handy to know should we / anyone else run into a similar issue of class not found! Thanks again mate!1 point
-
Hi Adrian! Great diagnosis there! Yes I was using PW3 latest dev version when trying this. Adding the backspace fixes the problem Adrian! Thanks for that. From what I see Adrian, when we install ProcessWire 3 dev version, the basic profile is not namespaced whilst the default profile is namespaced. As I was using the latest dev version and the default profile Adrian, the template files were already namespaced. I am not too sure if that's what you mean by manually adding the namespace. Also I assume the file compiler is on but I have to admit I don't know how to check if it is on or not! Anyways, just to clarify Adrian, if we install a fresh pw3 site with the default profile that already has namespaced template files and we then install the AIOM module, what should we do to solve this issue? Just add the backspace as you have done? Or remove the namespaces from the default template files? What is your suggestion? Anyway thanks again for the fix, Adrian. Brilliant! Cheers!1 point
-
Looks like you have a namespace issue - I am using AIOM on a PW3 site without any problems - the file compiler is properly taking care of things. That error is coming from the uncompiled version of _main.php though - are you using PW3? Do you have the filecompiler on? Are you manually specifying the ProcessWire namespace? I am guessing the latter - you are manually specifying the namespace, but AIOM is not namespaced, hence the problem. What happens if you do: <link rel="stylesheet" type="text/css" href="<?php echo \AIOM::CSS('css/stylesheet.css'); ?>"> Note the backslash to request the class in the global namespace.1 point
-
About the Inputfield names you're mostly correct, but it's ASM not Asn As php doesn't even allow you to extend of of multiple classes you would rather use those module's to render themselves as part of your module. The piece you'll need to add to allow both Inputfields to interact would be mostly JS work, but I'd say you need a good PHP understanding as well as InputfieldSelector is one of the most complex Inputfields we have in pw.1 point
-
I cannot find any request to getting those default config settings while installing the module. The problem I got from the topic is that getModuleConfigData() will return no value for as long as the module's settings weren't (manually) saved once after a successful install, which is imho bad handling of an edgecase. And since the module can pick up any defaults to supply them to $this->configValue calls, I cannot see why we would need anything new to make getModuleConfigData() return a useful result right from the start.1 point
-
yes - it autosaves it in local storage, which is why the module init would need to ID each field with it's page id and instance id... so by default the autosave is off (and probably not necessary)...1 point
-
v016 is uploaded to GitHub, containing the datalist feature for filterbox + a display bug fix reported by matjazp.1 point
-
I would prefer drag-and-drop to ckeditor, but atm this is on the very end of the list1 point
-
seems the init state does not show the lines/words counter - this is a documented issue with the plugin, see https://simplemde.com/ you can force it to update on load by enabling autosave; (adding these to the init call) autosave: { enabled: true, uniqueId: thisID, delay: 1000, }, spellChecker: false the plan is to make each instance individually configurable, but for now this is a very bare-bones implementation. i'm going to add those options to the js init, but maybe leave them commented out, and let users uncomment to disable spellcheck, and enable autosave; BTW - the autosave is interesting and works, not sure how useful it is or even if it makes sense in the context of a CMS. if it were to be enabled, additional configuration would be required to change the way it works so as to have a unique id for the page and the field though.1 point
-
1 point
-
Well, for filtering items E.g if you have many images or documents uploaded and you would like to find a specific one. Or if you go to the Language Translator, there can be many translation files and it can be hard finding the one you need without filtering.1 point
-
maybe a silly question... how (what for) do you use this filter functionality? one other thing: i think a kind of shortcut "add this image to the ckeditor field" would be really great. like here: https://processwire.com/talk/topic/13471-better-ckeditor-image-insertion-at-least-for-me/1 point
-
1 point
-
Hi, mh, does it also 'not work' without this options module? Maybe there is something wrong with the TextformatterVideoEmbed/Inputfield setup already because the link didn't get transformed in the first place. This module, the TextformatterVideoEmbedOptions only applies the embed options to the embedded object. Also make sure that the VideoEmbedOptions module is run after the VideoEmbed module. (Though it might actually be that it doesn't matter) Is the url transformed into an <a> link?1 point
-
It's a class on the button. Just remove it to prevent the cloning.1 point
-
https://github.com/NextStepWebs/simplemde-markdown-editor "A simple, beautiful, and embeddable JavaScript Markdown editor. Delightful editing for beginners and experts alike. Features built-in autosaving and spell checking. https://simplemde.com " --- Would love to see this as a module!1 point
-
Not sure, but I think it is by design. You never can pull something from a DB without first having to save it into the DB. Or do I get something wrong with the issue?1 point
-
1 point
-
I've already thought of a filter box. Here's a screencap of its current state but it's still in an early stage. It's capable of searching image names, descriptions (multilanguage) and tags, and multiple strings at once (separated by spaces). Filtering worked fine only until name/tag/description were unchanged because filter targets were added on load. I solved this by clicking or focusing on the filter box re-adds all the filter targets. In fact all the filters are added only on the first click so if you don't use the filter it won't add too much overhead.1 point
-
Excellent write-up Ryan! Here's a quick tip. If you are processing large amounts of data, you should always use PW's field joining options to achieve maximum performance. Even if you only use a single field, you should get around 50% faster execution when the field is joined straight away. With two fields joined, the execution time will be cut into half (i.e. 100% increase in speed). Let's say you need to export the e-mail addresses of thousands of customers. Here's a simplified example using "on-demand" join // Prepare a pointer for writing the output $fp = fopen('customers.csv', 'w') or die('Failed opening the file for writing'); // Ask PW to join two fields (the regular find() also supports this). $options = ['loadOptions' => ['joinFields' => ['customer_email', 'customer_number']]]; // Searching for imaginary customers $selector = 'template=customer'; // Find the pages using the new method foreach($pages->findMany($selector, $options) as $page) { // Write the data in CSV format fputcsv($fp, [$page->customer_number, $page->customer_email]); } // Free the pointer fclose($fp); As a reminder, you can also force some fields to be always joined (through PW admin). @Joer: That is pretty much what the implementation of findMany() does behind the scenes. However splitting the job into smaller batches still makes sense if you use multiple workers to process the data (e.g. for MapReduce or whatever) or if the execution time of your script is limited.1 point
-
1 point
-
Tutorial now available on Tuts+ here: http://webdesign.tutsplus.com/tutorials/how-to-create-an-ajax-driven-theme-for-processwire--cms-26579 for Ajax site temp laying in PW.1 point
-
Hi, I found this forum thread that you might find interesting. It contains a post by Mr. Cramer himself, It's a little old but still work checking out when you have a chance. https://processwire.com/talk/topic/3118-crowd-fund-new-tutorials/#entry31001 If you haven't seen this already, you might find it helpful : http://wiki.processwire.com/index.php/Small_Project_Walkthrough This one also to help with searching the forums for specific topics / tutorials https://processwire.com/talk/topic/6196-easy-search-on-pw-forums-with-google/ For example, try using this search on Google 'site:https://processwire.com learn php' . You know, the Readme.txt file that comes with the Processwire install in the templates folder? It's actually worth a read Though it has nothing to do with PHP in terms of Processwire, if you are new to programming, and you haven't done so already, I'd suggest you get familiar with debugging techniques pertaining to php. Find some tutorials on on the subject. Xdebug will come up. Look into it, There are also php debugging addons for both Firefox and Chrome. Also have a look at Tracy Debugger http://modules.processwire.com/modules/tracy-debugger/ There are also articles in the PW forums on debugging. Start creating a collection of code snippets for yourself as you go along. It doesn't have to be fancy. Just something you can go to when you need an example of how you coded something in that past. Might save you a little Googling time. Lastly, try to get in the habit of writing what is usually referred to as 'clean code'. Use comments wisely. Don't leave dead/unused code in a module. It only clutters things up and is a distraction. Take the extra time to give variables meaningful names.. etc etc. Nothing sucks worse than having to go back to something you yourself wrote, say 6 months ago, and you find yourself staring at the screen silently cursing yourself out, because you can't remember what you were trying to accomplish. Bottom line - Google on 'Writing clean PHP code' and go from there. Best wishes on your coding endeavors.1 point
-
Hi, 1. Is PW 3.x compatible with PHP 7? I"m not yet using PHP7, however ProcessWire 3.x runs on it and I've been reading reports in the forum to confirm it. But watch out for modules you might have that might have trouble running on it, e.g.: https://processwire.com/talk/topic/9507-php-7-coming-soon/ 2. Would you recommend PW 3.0.18+ in production? E.g. is it too "dev" or already "prd"?) Probably it also depends on the modules you use, such as anything not compatible with the new ImageField module: https://processwire.com/blog/posts/major-images-field-upgrade/ 3. Any known PW-related issues with migration from myisam to innodb? Here is the related blog entry: https://processwire.com/blog/posts/pw-3.0.15/ Older post from Ryan: https://processwire.com/talk/topic/10287-database-scheme-includes-no-foreign-keys/#entry97876 4. Pros/cons of switching to nginx + mysql + php-fpm? (apart of lack of support, e.g. need to maintain config manually with each upgrade) Never used it, so I skip this one1 point
-
Better late than never. I'm almost done with my WordPress vs. ProcessWire series. I have about ~8 videos left to make. I will be uploading all the videos to YouTube in a playlist. Need a couple more weeks to finish them off and add a little polish. Here are the videos in the series (not yet in the final order): Installation Pages Page Templates Custom Fields Custom Post Types Blog Documentation API Updates Client Help Plugins Forms Shortcodes Page Order Images Videos Themes Widgets Menus Global Settings and Options Page Caching Search Engine Optimization XML Sitemaps JSON Data Search Users and Roles Config File Multi-Language Data Migration Ecommerce Community Comments Revisions Admin Themes Command Line Interface Hosting Multisite Admin Section Performance Visual / WYSIWYG Editor Bootstrapping Admin Bar Composer Debugging Front-end Editing Page Builders Each video is about 3-10 minutes long and compares a feature in WordPress with the same or analogous feature ProcessWire quickly and concisely. For example, Shortcodes vs. HannaCode, Gravity Forms vs. FormBuilder, WP-CLI vs. Wireshell, WP Rocket vs. ProCache, WP's Menu Builder vs. Menu Builder, etc. Some are a little more in-depth than others. I do give WordPress a fair shake, try to remain objective and let ProcessWire's superior approach to features speak for itself. I will most likely be adding an intro video that explains the series as well with some background as to why I use ProcessWire instead of WordPress and the philosophical differences between the two. The goal is to get people, particularly advanced developers and web firms who know how to code and who are on the fence about switching to a new CMS, to quickly see all the analogous features that they are used to in WordPress done in ProcessWire. Hopefully they will get the warm and fuzzy feeling and explore our community further. If there are any topics you feel that I have missed, please let me know. Make sure the topic is specific enough to warrant a video of its own, as this series is a feature-to-feature comparison. Thanks1 point
-
@Juergen, obviously I missed your post half a year New Edition But finally I found it and redesigned the template file I provided in post 88 of another thread It is working now properly according to the google guidelines. It comes with 301 redirect to the path version that lacks the language segment which works in PW 3.0 up but not in 2.7. In this case you need to uncomment the code line which forces the redirect. Template detects if the translation is checked 'active'. Furthermore you can easily adjust selectors for the page array where the pathes are taken from. Feel free to try and use it. multilang-sitemap-xml.php.zip1 point
-
An easy way if you wanna build a big list would be to just make a little array with all the rules and use that to filter. $excludeArray = array( "include=hidden", "parent!=2", "id!=1009", "parent!=1047", "id!=27", "id!=7", "parent!=7", "id!=1047", "id!=4945", "template!=items", "template!=antique-items", "template!=publication", "template!=publication_type", "template!=publication_section", "template!=404", "id!=2947", "path!=/processwire/" ); $exclude = implode(",",$excludeArray); $children = $page->children($exclude);1 point