Leaderboard
Popular Content
Showing content with the highest reputation on 01/09/2017 in all areas
-
Last year I discovered Processwire (after the summer). I don't know why, but I had an immediate connection with it. Now I produced my new website with it. You can check it here: http://www.projectweb.be6 points
-
There's no absolutely right or wrong way - if you asked 10 people you'd probably get 10 different answers. It comes down to what you find most comfortable to read, write and maintain. Personally I like a single auto-appended main.php containing the HTML head, body and any "framework" markup that will appear on all pages. For blocks of content I use variables defined in an auto-prepended init.php and overwritten in template files where needed. I like to use output buffering when populating my "block" variables: <?php ob_start(); // $side_col ?> <div class="side-col"> <p>Something else here.</p> <?php // some PHP here ?> </div> <?php $side_col = ob_get_clean(); ?> Generally my approach would be to use main.php for all templates including the home template - anything unique to the home template would be inside the main "block" variables. But here's another way: I have a $use_main variable defined as true in init.php, and at the top of main.php I have if(!$use_main) return; So if I don't want the contents of main.php appended I can set $use_main to false in a template and then use alternative markup. You could do this in your home template. I think in this case I would create a different template for this ("article_categories"), but it would "extend" the parent articles category so I'm only changing the parts that need to be different. I do this by including the template to be extended at the start of the template file. // template extends... include './articles.php'; Then in article_categories I overwrite the variables I want to change from what is defined in the articles template. Alternatively you could use a single template for both articles and article_categories and use some logic inside it to change the output. if($page->parent->name === 'articles') { // then this is one of the article category pages } This is probably the result of template "Family" settings.3 points
-
I am a big fan of Forklift: http://www.binarynights.com/Forklift/ dual pane finder replacement ftp/sftp directory synchronizer2 points
-
It was a 3rd party module even before the upgrade and there's no decent alternative / updated version of the plugin, which would be compatible with the new forum's version.2 points
-
Properties are also useful for the places, where one might use the result in any getMarkup() calls (e.g. what to show in the page list). $pageArray->explode('<a href="{editUrl}" target="_blank">{lastModifiedStr}</a>');2 points
-
They look quite different to me (the examples). addHookProperty does just that; adds a property. The property is available to the object you are attaching it to. You can't pass it any arguments to manipulate what it returns. addHookMethod/addHook allows you to add a method/function to an existing class or object. You can have the method you've 'created' accept arguments that inform the method's logic. Although the examples are similar, they are not identical. addHookProperty example. We cannot change/alter the output since this is a property (variable) unless we 'manually' assign it a new value // Accessing the property (from any instance) echo $page->lastModifiedStr; // outputs: "10 days ago" addHookMethod/addHook example. We can add as many arguments as we want to lastModified() since it is a method. In the example in the docs, the method accepts only one boolean argument. This allows us to alter what lastModified() returns. Hence, it offers more flexibility. echo $page->lastModified(true); // returns "10 minutes ago" echo $page->lastModified(false); // returns "2013-05-15 10:15:12" echo $page->lastModified(); // returns "2013-05-15 10:15:12" That's my understanding of it anyway...2 points
-
2 points
-
The following solution with 2 separated rules should produce only one redirect. RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ https://%1%{REQUEST_URI} [L,R=301] RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] This one should work for your domain with a single rule RewriteCond %{HTTP_HOST} ^www\.grantdb.ca$ [OR] RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://grantdb.ca/$1 [L,R=301] The issue in my suggestion above was that the first condition fills the variable %1% with the trailing slash which results in redirecting to https:///2 points
-
FieldtypeFileS3 https://github.com/f-b-g-m/FieldtypeFileS3 The module extends the default FieldtypeFile and InputfieldFile modules and adds few extra methods. For the most part it behaves just like the default files modules, the biggest difference is how you get the file's url. Instead of using $page->fieldname->eq(0)->url you use $page->fieldname->eq(0)->s3url(). Files are not stored locally, they are deleted when the page is saved, if page saving is ommited the file remains on the local server until the page is saved. Another difference is the file size, the default module get the file size directly from the local file, while here it's stored in the database. There is an option to store the files locally, its intented in case one wants to stop using S3 and change back to local storage. What it does is it changes the s3url() method to serve files from local server instead of S3, disables uploading to S3 and disables local file deletion on page save. It does not tranfer files from S3 to local server, that can be done with the aws-cli's through the sync function. Files stored on S3 have the same structure as they would have on the local server. -------------------------------------------------------- -------------------------------------------------------- Been struggling with this for quite a while, but i think i finally managed to make it work/behave the way i wanted. All feedback is welcome!1 point
-
Please update the download link on the website http://de.processwire.com as it points to an old ProcessWire 2.7 repository.1 point
-
Just added a new "Email Batcher" action, which has the following features: Select recipients by user role, or using a pages selector for any pages on the site Parsing of field tags in the body so you can do something like: Dear {first_name} Option to send a test email HTML body, with automated text only version also sent Special {fromEmail} and {adminUrl} tags. Ability to hook EmailBatcher::parseBody to apply other custom replacements Don't forget TracyDebugger's Mail panel when testing - it will capture the outgoing emails (so they won't actually be sent): http://processwire.com/blog/posts/introducing-tracy-debugger/#mail-panel1 point
-
Hi @FrancisChung This is my favourite: http://www.scootersoftware.com/features.php Not just for source files, but: " SYNCHRONIZE FOLDERS ...You can efficiently update your laptop, backup your computer, or manage your website, and Beyond Compare will handle all the details. You can copy to and from disks, FTP servers, and zip files, all using the same interface. Anything you don't want affected can be easily filtered out, and all of the powerful comparison techniques are available, making the backup as fast or robust as you need. You can automate repetitive tasks using a flexible scripting language, and any script can be called from the command line, allowing you to schedule your syncs for when it's most convenient." It is also fast via FTP, and it can handle 10 simultaneous connections if needed, turning it to be the fastest diff/merge tool ever but this is only one example. I rarely usef the synchronize folders feature, but that one works well too.1 point
-
I have a cheap digital ocean droplet with CentOS 7, and on it I installed ispconfig3 http://www.ispconfig.org/ I use it for a development server as well as a private git repository. This probably isn't the way to go if you're not comfortable with linux1 point
-
1 point
-
Consider these 2 options: https://processwire.com/api/modules/multi-site-support/ Option 1 would mean multiple databases. Option 2, single database is what you seem to be after. I use Option 1 for my own sites.1 point
-
The beta of UIkit 3 is out now. Sadly there is no Sass version yet, but I think it is on the way.1 point
-
@adrian Do you plan to extend the batch install module to include built-in modules? I just installed about 10 modules from the modules directory which saved me a lot of time. Being able to install built-in modules like AdminThemeReno, LanguageSupportPageNames, LanguageTabs etc would be great.1 point
-
1 point
-
@Harmen, for years I had my own servers, also located at transip, I ended up scrapping that, on the transip vps I still run my own OS (freebsd in my case) and the performance is as good (or better - transip keeps upgrading stuff) as on my own servers (which only is top of the bill the first year, I changed them after three years for the latest and best - go figure what that costs in depreciation) Costwise I now pay for the vps what I used to pay for the colocation. And lastly, I had to go to the transip datacenter at least once a year mostly to deal with a clusterf*ck of my own doing, but also sometimes to swap out a burned out hotswap disc. That is all gone, I ALWAYS have remote access as if I am physically there and transip deals with all the hardware. I now say I should have done this way earlier.1 point
-
I don't think ProcessPageEditLink is the correct way to enable users to create such markup, especially the group syntax. Personally I wouldn't even use CKEditor for that. Just imagine the syntax does change a bit in a newer version. You'd need to edit all the textfields using that markup. If you really need to use CKEditor I'd rather go for a class or something and use a textformatter to generate the necessary data attributes based on that class(es).1 point
-
It's because the events are being triggered too early, before the Color Picker's HTML is even added to the DOM, and also the event was missing for the standard repeater (which I've added). This version of InputfieldColorPicker.js is working now. I can't confirm it works for the repeater matrix, but if the class names used in the JS code above are correct, it should just work. I also added safeguards so that multiple events are not applied to the same elements. /** * An Inputfieldtype for handling Colors * used by the FieldtypeColorPicker/InputfieldColorPicker * * created by Philipp "Soma" Urlich * ColorPicker jQuery Plugin by http://www.eyecon.ro/colorpicker/ * * Licensed under LGPL3 http://www.gnu.org/licenses/lgpl-3.0.txt * */ function initColorPicker() { $('div[id^=ColorPicker_]:not(.color-picker-init)').addClass('color-picker-init').each(function(){ var $colorpicker = $(this); $colorpicker.ColorPicker({ color: $(this).data('color').toString(), onShow: function (colpkr) { $(colpkr).fadeIn(500); return false; }, onHide: function (colpkr) { $(colpkr).fadeOut(500); return false; }, onChange: function (hsb, hex, rgb) { $colorpicker.css('backgroundColor', '#' + hex); $colorpicker.css('background-image', 'none'); $colorpicker.next('input').val(hex).trigger('change'); } }); }); $('a.ColorPickerReset:not(.color-picker-init)').addClass('color-picker-init').on('click',function(e){ e.preventDefault(); var color = $(this).data('default') && $(this).data('default') != 'transp' ? '#' + $(this).data('default').toString() : 'transparent'; $(this).parent().find('input').val($(this).data('default')).trigger('change'); $(this).parent().find('div[id^=ColorPicker_]').ColorPickerSetColor($(this).data('default').toString()); $(this).parent().find('div[id^=ColorPicker_]') .css('backgroundColor', color) .css('background-image', 'none') .attr('data-color', $(this).data('default').toString()); if(color == 'transparent') { var modurl = $(this).data('modurl'); $(this).parent().find('div[id^=ColorPicker_]') .css('background-image', 'url(' + modurl + 'transparent.gif)'); } }); /* additions (swatches) by @Rayden */ $('div.ColorPickerSwatch:not(.color-picker-init)').addClass('color-picker-init').on('click',function(e){ e.preventDefault(); var color = $(this).data('color') && $(this).data('color') != 'transp' ? '#' + $(this).data('color').toString() : 'transparent'; $(this).closest('.ui-widget-content, .InputfieldContent').find('input').val($(this).data('color')).trigger('change'); $(this).closest('.ui-widget-content, .InputfieldContent').find('div[id^=ColorPicker_]').ColorPickerSetColor($(this).data('color').toString()); $(this).closest('.ui-widget-content, .InputfieldContent').find('div[id^=ColorPicker_]') .css('backgroundColor', color) .css('background-image', 'none') .attr('data-color', $(this).data('color').toString()); if(color == 'transparent') { var modurl = $(this).closest('.ui-widget-content, .InputfieldContent').find('.ColorPickerReset').data('modurl'); $(this).closest('.ui-widget-content, .InputfieldContent').find('div[id^=ColorPicker_]') .css('background-image', 'url(' + modurl + 'transparent.gif)'); } }); } $(function(){ /** * Looks like its due to events being fired too early. */ function delayedInit(event) { console.log(event.type); setTimeout(initColorPicker, 500); setTimeout(initColorPicker, 1000); } $(document).on('opened', '.InputfieldRepeaterItem', delayedInit); $(document).on('repeateradd', '.InputfieldRepeater .InputfieldRepeaterAddLink', delayedInit); $(document).on('repeateradd', '.InputfieldRepeaterMatrix .InputfieldRepeaterMatrixAddLink', delayedInit); initColorPicker(); }); Hope that helps.1 point
-
Harmen, I've used TransIP before and I only had to change the .htaccess: Options +FollowSymLinks to # Options +FollowSymLinks If you have modified the .htaccess, I suggest you try a clean .htaccess from the ProcessWire github repo and apply the above change.1 point
-
YES! The second option works perfectly! Thank you so much! Cheers! PS: I can't find the “Mark Solved” button at the bottom-right of the relevant post.??1 point
-
Just wanted to add that you can override an automatically prepended/appended file for a template on the Files tab of Edit Template. If you know you never want those automatically prepended/appended files for the template then this is the way to go. The $use_main approach is more suitable when some of the time you want the appended file and some of the time you don't (for an AJAX-loaded page, for instance).1 point
-
@kongondo I didn't fix this . BTW you don't need npm to use VueJS (although recommended). ATM I am not at home for a week but when I come back I'll create a VueJS+Router starter kit template for ProcessWire and share it on github, as I think other PW users may have this problem.1 point
-
1 point
-
It works for me (all work). Tested in a template file (added at the very top - PW 2.8). I'd also tried an in-memory selector but it was returning the wrong result. // $wire as a variable $wire->addHookProperty('Page::lastModifiedStr', function($event) { $page = $event->object; $event->return = wireDate('relative', $page->modified); #$event->return = $page->children->last()->title;// just a test; works }); // Accessing the property (from any instance) echo $page->lastModifiedStr; // outputs: "1 month ago" // wire as a function wire()->addHookProperty('Page::intro', function($event) { $page = $event->object; $intro = 'Hello World'; $event->return = $intro; }); echo $page->intro;// outputs "Hello World"1 point
-
Unless I misunderstood you, I don't think either would work since selectors at their basic level query the database. Both code should throw an exception that field 'lastModified' and field 'lastModifiedStr' do not exist. In this particular case, I don't see how an in-memory search would be helpful (or even feasible?).1 point
-
@szabesz Thanks very much for the info. My guess is that I am more like a guy that looks at examples and finds the interesting approaches, so the ghost clone seems like another perfect example to dig in and squeeze some knowledge from the more skilled and advanced coders.1 point
-
Exactly . Had the same thoughts. On the face of it, it would seem like one is just an extension of the other (see also this example under addProperty - the one that returns an intro of a body copy). However, the same question could be asked when developing a class (PHP or otherwise). When should I use a class property versus a class method? If we are going to use something repetitively, especially when some degree of flexibility is required, we go with a method. If we need to stick with some value, we might as well use a property. So, I guess, IMO, it is about what best works for your present needs.1 point
-
Hi, This is my preferred way of organizing things: So I prefer using wireRenderFile() in the first place. Also, the pattern used: https://github.com/NinjasCL/wire-render-pattern is a good example of separating the "controller functions/template files" from the "template views". An important note on using wireRenderFile(): So if you start using it, you might want to pass $page along instead of managing lots of individual variables like it is implemented in the above mentioned Ghost Blog Clone.1 point
-
When you request $page->url, ProcessWire generates it on the fly, kind of: it's a combination of $config->urls->root and the path of current page. Root URL is defined when the system is started, and $page->path is constructed from the names of parent pages. Similarly $page->httpUrl is a combination of protocol, hostname and $page->url1 point
-
@FrancisChung Is this for a search you want to kick off via a page on your PW site - where the user can enter some variable search term? If so, how about a Click() handler on the submit button that issues 3 distinct ajax searches against the backend? Here's some pseudo-JQuery to illustrate the idea. To keep it shorter, this example kicks off two async ajax calls to the back-end to get search results as JSON and then renders the output once both calls have returned (either with or without data.) $('#submit-button').click(function () { var searchA = false, searchB = false; // Kick off asynchronous call to get results for search A... // return results as JSON jQuery.ajax({ url: '', // Construct a url to trigger search A success: function (result) { searchA = true; // Add code to store result JSON... rendezvous(searchA, searchB); } }); // Kick off asynchronous call to get results for search B... // return results as JSON jQuery.ajax({ url: '', // Construct a url to trigger search B success: function (result) { searchB = true; // Add code to store result JSON... rendezvous(searchA, searchB); } }); }); function rendezvous(A, B) { if (A & B) { // Use JQuery to combine, format & render search results in your current page } }1 point
-
Thanks! Such minor UI tweaks can add a lot to the overall feel and they were easy to add. I just took the opportunity to harvest some glory with minimal effort1 point
-
1 point
-
Hello Fellow forum members. I wanted to share two links to a guide and a cheatsheet concerning Crontab and Cronjobs. This is a result of me doing some research in how Cronjobs work and how to use it and i thought i share for other beginners use. So the guide that got me started and is a good reference is: A Comprehensive Crash Course Into Cronjobs (sitepoint) And also i found this sort of cheatsheet and database of cronjob configurations handy: Corntab - the Crontab GUI I hope these tips can help any beginners like myself get up and running with cronjobs.1 point
-
The Console Panel now has a History stack and a separate Snippets stack! Hi everyone - this has been a long time coming. It was originally suggested by @bernhard back in early November. I want to thank @bernhard for the idea and feedback on draft versions, and @tpr who has contributed many ideas, style suggestions, and code to this functionality - sincere thanks to both of you! Snippets are automatically saved to the tracy config settings entry in the modules database table so that they are available on other browsers/computers have a dedicated save button - they are not saved automatically when running code save button only available when loaded snippet code is different from saved version so you know whether you have made changes has the ability to sort alphabetically or chronologically (date modified) no limit of number of snippets stored snippets can be deleted - a ✖ icon appears when you mouseover a snippet in the list History items are saved to local storage automatically saved when you "run" code comes with "Back" and "Forward" arrows for moving between history items currently stores maximum of 25 items - let me know if you think this needs adjusting Some other miscellaneous changes when running code, output is now appended to the results panel (like your browser dev console) you can used ALT/OPT+Enter keyboard shortcut to Clear and Run the "Clear" button now clears the results panel, but leaves the code intact Future ideas ability to easily export/import snippets to stack your ideas Please let me know if you come across any bugs or weirdness with anything - it's still pretty early stages!1 point
-
Ok, here's a screenshot showing the tooltip that indicates double-clicking the "Tracy" icon opens the module settings. Currently it opens the module settings in a different tab. I am not usually a fan of this, but in this case where we are using double-click and there is no way to user initiate a new tab, I think this is best for now. I'll commit along with the new console history/snippets stuff - hopefully shortly1 point
-
Maybe I do not get what you are aiming to do, but it is possible to get pages by defining more than one template in your selector, so you do not have to put your pages under the same parent, just to get them with $page->children: eg.: $pages->find("template=article|news|faq"); https://processwire.com/api/selectors/#finding1 https://processwire.com/blog/posts/processwire-3.0.13-selector-upgrades-and-new-form-builder-version/#building-a-selector-string-with-user-input-example You might also want to check out @LostKobrakai's Paginator module to list and paginate pages from different templates easily.1 point
-
It would just depend on what's being worked on. I generally don't push stuff to GitHub until I know it's solid. If working on something that's going to take a couple weeks to get to that point, then I'll avoid having it appear on GitHub because it wouldn't be ready. Since plans for 2017 include a focus on some things that may go beyond the usual weekly timeline focus, I'd say that weekly activity on the GH repo would reduce a lot when these things are being developed. Of course, activity on the core code wouldn't be reduced at all (likely increased), but the frequency of commits that appear on GitHub would be reduced. Plans are to keep it roughly as-is. But since it's now ~130 posts, it's time to add a few more things like categories, related posts, next/prev post links, etc. I also want to upgrade it to be more guest-author friendly, so that it includes authorship information like we have in the tutorials (example).1 point
-
Thanks @szabesz - I really appreciate everyone's positive feedback and support for this module - glad it's been useful for everyone! Good luck with your new project.1 point
-
This functionality is now available via the "Delete Unused Fields" action in my new Admin Actions module:1 point
-
The username sanitizer (wire('sanitizer')->username("string")) is currently deprecated in favor of the using the pageName sanitizer because users are stored internally as pages. From a code readability standpoint it is more self-documenting to use a "username" sanitizer, not a "pageName" sanitizer. If, for whatever reason, the underlying implementation as pages changes there is no problem when using "username". If, for whatever reason, the allowable character set is different for usernames than page names there is no problem when using "username". The only benefit I can see that comes from removing the username sanitizer is the removal of a very small bit of code. Hence, my suggestion for keeping the username sanitizer and decoupling the API from the implementation.1 point
-
1 point
-
1 point
-
Stay sober - can be a challenge. Go up to soho and drink guiness in the basement at The Toucan - it is a Guinness themed pub and is small, cramped, smelly and the wonderful. They also have the best collection of Irish Whiskey anywhere. If Colin still runs it (I haven't been there for years) ask for one of the Pre-1960 Middleton. It used to be £25 per shot! But gorgeous. And tell him hi. While you are up in Soho, I suggest a night at Ronnie Scotts jazz club is in order. Famous and stunning. You might want to go to Gerard Street or Lyle Street (the tiny China Town). Go to one of the smaller restaurants and have roast pork and rice or a plate of Dimm Sum. If you are very, very, very brave, there is Comptons in in compton street - they used have a really good drag cabaret, but it can feel dangerous in there. Put it this way, I am straight, but even gay friends were scared of it! https://www.facebook.com/pages/Comptons-of-Soho/157845687574555 In the same area is the French House - I used to go in there and buy large bottles of French cider and a couple of glasses. Nice atmos http://www.frenchhousesoho.com/ My FAVOURTITE dive, however, was the Blues Bar in Kingly Street, near Oxford Circus (all still in the same area). http://www.aintnothinbut.co.uk/ When I lived in central london I used to go there a couple of times a week and even played there a couple of times (when people got me drunk enough to persuade me to sing). I have had some fantastic times in there. Outside of alcohol, depending what you are into, I suggest the Tate Modern on the south bank, the National Theatre (also on the south bank) and the Globe Theatre, though that is open to the elements! (no roof). The Natural history Museum and the Science museum are still wonderful for quiet days. The Natural History is a simply spectacular building. http://www.nhm.ac.uk/ However, their website is boring - try and get some work while you are there! Food? Well, London is the food capital of Europe with some of the best restaurants - and at a high price. But there are places like Efes on great Titchfield street for great turkish food. Owned by Kassim who is a letch, but my flat was dead opposite - best flat I ever had. Also Topkapi on Marylebone high street (still the west end) https://plus.google.com/102240451418416030908/about?gl=uk&hl=en Best take-away kebab ever. Nice people too. I am a bit out of touch with the food now - Langhams and Odins were two of my favourites. Langham's is owned by Michael Cane. http://langansbrasserie.com/ I think Odins might have closed. That will get you started. To be honest, once you start drinking at the Toucan and the Blues Bar, you will never be seen again. I didn't get out of there for five years!1 point