Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/13/2018 in all areas

  1. It's never overkill to create the fields you need to achieve the functionality you want. For efficiency PW sorts pages when it gets them in the SQL query. So when you get pages from the database whatever you want to sort on must exist as a column in the database. You can sort a PageArray independently of this but it's less efficient and will be problematic when you have a large number of pages or want to add pagination to your results. Also, think about the sorting of names like "Anthony van Diemen" if you were to try to sort without an explicit "last name" field. There is no need to enter anything twice. There are a few different ways you could go about it - here is the one that I prefer because it's simple and intuitive even if it does involve some minor redundancy of data... This assumes you have a template team_members that allows children of template team_member. 1. Install the core PagePathHistory module if you haven't already (a must-have for every site). 2. Install the Page Rename Options module. 3. Add text fields first_name and last_name to template team_member, right after the title field. Make them required fields, and a width of 50% would make sense. 4. In template team_member re-label the title field to "Full name" and set the field visibility to "Open when populated + Closed when blank + Locked (not editable)". 5. In the Family tab of template team_members set "Name format for children" to "Y/m/d H:i:s". This allows new pages added under this template to skip the first step of the "Add New" process. New pages will get a name according to the date/time they were added but this is only temporary until they are published or saved for the first time. 6. Add the following hook to /site/ready.php $pages->addHookAfter('saveReady', function(HookEvent $event) { $page = $event->arguments(0); // Only for the team_member template if($page->template != 'team_member') return; // Skip if this page is brand new and doesn't have any data yet if(!$page->id) return; // Derive the title (Full name) from the first_name and last_name fields // The Page Rename Options module will take care of updating the page name to match $page->title = $page->first_name . ' ' . $page->last_name; }); Now in your template files you can get and sort on the first_name and last_name fields independently. If you want the full name you could output those fields together, but why bother when you also have the full name in the title field. Having the full name in the title field is nice because things in the PW admin (Page List, Page Edit headings, admin search) continue to work without needing any special settings or additional hooks.
    8 points
  2. Continuing from last week's post, ProcessWire 3.0.108 is now available on the dev branch, and it adds support for a new, more powerful live search in the admin. This week we will take a closer look at how it works, as well as how module developers can make their modules searchable too. https://processwire.com/blog/posts/pw-3.0.108/
    5 points
  3. Hello, I need some help with changing the URL for default language pages. I have two languages one is hidden at the moment for future use. Now I would like the default language URL to be only the site name and a page without /en how can I achieve that. I want my URL to be like www.mysite.com/jobs and not www.mysite.com/en/jobs. Now only the home page has the right URL all other have /en. ... I looked through the forum but no luck so far. Thank you R Ok, I got it, I just had to delete the EN in my homepage setting and now it is working, I found it on a forum. Thank you anyway
    2 points
  4. Hi all, Introducing a new GDPR Cookie Management Banner module. https://github.com/adrianbj/CookieManagementBanner https://modules.processwire.com/modules/cookie-management-banner/ This module was sponsored by VentureWeb in Squamish, BC, Canada. I converted a Drupal module written by Oliver Walker from VentureWeb into what you see here. The Drupal module requires jQuery so at the moment, this module also requires jQuery. I will probably remove this sometime soon. This module certainly has similarities to MarkupCookieConsent but provides the user with the following features: The user can accept all cookies or they can choose to not accept tracking/marketing cookies. Module config options allow you to: define all text and button labels (multi-language support) manually increment the cookie policy version which forces the user to review their consent again select whether users can manage their cookies, or just accept all option to limit display of banner to users only in European Union (by IP address) position selection (top or bottom overlay, or content pushed down from the top) It comes with basic default styling which is easily overwritten by site CSS The module sets various values to the dataLayer array which works together with Google Tag Manager - please read through the code in /assets/js/CookieManagementBanner.js to get a better idea of how this works and what is made available for GTM. You can wrap your tracking/marketing cookie code in a check for the localstorage key of: pwcmbAllowCookies if(localStorage.getItem('pwcmbAllowCookies') == 'y') You can also provide a link on your site (probably in the footer) like this that will allow the user to show the banner even after they have saved their preferences / accepted. <a href="#cookies" class="js-pwcmb-notice-toggle">Manage Your Cookies</a> Would love to hear feedback from anyone who gives this a go.
    1 point
  5. Hey guys, Thought I would share a quick preview of Designme. A module we (Eduardo @elabx and I) are building for visually laying out your templates/edit screens. ? This is a really quick, zero polish screen grab. FYI. Video #2 - UPDATE This new video shows the following features in Designme: Re-arranging fields via Drag & Drop Re-sizing fields via Dragging. Adjusting field settings - with live refresh. Working on "hidden" fields while Designme is active. Creating New fields. Deleting fields. Creating/Deleting Tabs. Dragging fields between tabs. Creating fieldsets. Tagging/Un-tagging fields. Fields without headers expand when hovered (like checkboxes). Live filtering of fields in the sidebar. Ability to adjust (all) Template settings without leaving Designme. Template File Tree Editing Template files source code with ACE Editor. Editing Multiple files with ACE Editor. (New Tabs) Saving files. Techie stuff Fields load their own js/css dependancies. *ready to use on creation (*most fields) Everything happens via Ajax to ProcessPageEdit (via module + hooks). Designme has a JS api that you can use. All actions trigger events. We would love any detailed feedback on what you see so far. If you are interested in testing Designme. Let me know below. ? Video #1.
    1 point
  6. Thank you Rick, your tip helped me much. I used $page->cat->id; Now it works ?
    1 point
  7. https://www.i-programmer.info/news/83-mobliephone/11963-ten-years-of-the-apple-app-store.html some highlights for TL;DR readers: "...if it was a free market, then Apple would not have made more than an estimated $100 billion over the time, but programmers would be that much better off." "No right of appeal and if you talk to journalists then Apple has no intention of helping you at all. That this is an authoritarian regime isn't a point that you can argue against." "Windows Apps are almost as locked down as iOS apps. Only Google made the stupid mistake of letting Android go open source and it has been working steadily to take control back ever since. Assuming Android is still around in ten years time, my bet would be that the Play store will be just as much a walled garden as the others." "The App Store is mostly full of small apps that do frivolous things - it's a trinket store. Let's get back to real computing."
    1 point
  8. You also have to edit your site/config.php, mainly the database credentials and perhaps the allowed $config->httpHosts array. You can temporarily set $config->debug to true, to see error messages, should they occur.
    1 point
  9. This article has helped me. It's still incomplete (commented at the end) but I think there is enough information to solve the issue.
    1 point
  10. Thank you @theo, I'm sorry but I don't know how to make the var_dump or debugger in module. so, I will study how do it and I will try to make the check. yes, I have upload the module to the last version. Thank you again.
    1 point
  11. These two spring to mind: $user->isLoggedin() $user->isSuperuser()
    1 point
  12. Thank you for developing this useful module, now i can send email to certain user from admin easily, inspired from here : For those who need more explanation: Button is actually <a href> to template which will open new page (yes very ugly behaviour, read below) contain custom php code , not inside <form> action because <form> not allowed inside textarea. To prevent opening new page when click the button, make an <iframe> inside the template as a target button, that's it, beautifully execution like native form in admin page.
    1 point
  13. Move files to new server, import database, point domain to the new server, wait for the domain to propagate.
    1 point
  14. Working fine here with AdminThemeUikit. Yes, this module adds features to a PageTable field, so you need to have FieldtypePageTable installed and add a PageTable field to your template. In v0.1.1 I have made FieldtypePageTable an install requirement for the module to avoid any confusion about this.
    1 point
  15. Thanks for this! I had forgotten how to do this ?
    1 point
  16. @dragan & @theo – very interesting concept. Thanks for showing this to me, I hadn't seen it before now. I am excited to see how it evolves. visual building is always very exciting!
    1 point
  17. In this demo video, it is working from the existing 'home' template. All Ajax requests are going directly to the existing ProcessPageEdit url. there are no 'dynamic templates', but very shortly, you will have the ability to create templates on the fly from the page tree and start editing directly in Designme to speedup template/data model creation. So you can start with a completely blank template/editscreen and start throwing in fields as fast as possible. (hope this makes sense).
    1 point
  18. I've been thinking PW could do with something like this for a long time but your implementation is way better than anything I had imagined - great work! ?
    1 point
  19. Here is way to get most viewed posts today: https://processwire.com/talk/topic/2868-count-views-of-post/?do=findComment&amp;comment=28641 for a pagelist you have to asign a page field to a user and you save added pages via click like you described. This module could also be interesting: http://modules.processwire.com/modules/page-bookmarks/ regards mr-fan
    1 point
  20. In this post we preview a new feature coming in ProcessWire 3.0.108, which is a major upgrade to our live search feature in the admin. In this update, PW’s search becomes a lot more versatile and powerful while remaining just as easy to use. Plus, there are some fun and useful power-user features that we’ll cover here too. https://processwire.com/blog/posts/processwire-3.0.108-preview/
    1 point
  21. @neosin Sorry for the slow response to this, but I just updated both the 2-Factor authentication module (for PW3+) and the CryptoPPP library module (switched it to OpenSSL.) If you still want to, try grabbing the latest version 3.1.1 and that should work under PHP 7.2.
    1 point
  22. 1 point
  23. So we're over half way through the year. How are we getting on with this @ryan? I don't see much of a discussion around it? I think this is a really important first step to making ProcessWire part of the larger web development community and really increasing its popularity. (And sales of pro modules!).
    1 point
  24. Ok then go to Software/Services section of the cPanel home screen, click Select PHP Version and select the version you want (you should use the last stable release). For the extension (you need to enable pdo_mysql extension here), it should be located in PHP Settings or something like that. Please refer to your host's online documentation.
    1 point
  25. Hi, looking at the phpinfo, there is not a PDO extension loaded. Ensure that the required extension are loaded - locate and check the php.ini for the following extension and uncomment it if needed : ;extension=pdo_mysql.so Updating this file or enabling an extension can be done in different way, please give us more info about the host (server managed by a Panel ? lamp on vps/ssh, etc). Also, as the hosting provider updated their configuration, you could check if everything required by ProcessWire is installed/loaded by running the first step of this file : Download https://github.com/flydev-fr/Duplicator/blob/master/Deploy/installer.php Upload the file on the root directory Navigate to http://yourwebsite.foo/installer.php Click on "Get Started" and check the "Step #1 - Compatibility Check" result
    1 point
  26. Works fine with FormData object and without set Content-Type Header... var body = new FormData(); body.append("name", "Bob"); body.append("age", 27); fetch("http://127.0.0.1/fetch.php", { method: "post", body: body }).then(function(response) { console.log(response); return response.JSON(); }).then(function(result) { console.log(result); }); <?php $res = $_POST["name"]; print_r($res); die();
    1 point
  27. Hey @adrian - thanks for pointing this out. Both are valid points, so I'll try look into it this weekend.
    1 point
  28. Thanks again @adrian for your further feedback. Understood. Would you mind sharing what those 2-3 major bugs are/were? Are you aware of any issues that might arise from an upgrade from the 3.0.62 master version to the 3.0.107 dev version? Whilst I appreciate that no software is perfect or bug free and agree with you that a greater emphasis should be placed on resolving existing issues, it would be helpful if the https://github.com/processwire/processwire-issues/issues could be filtered at least in terms of whether or not they relate to PW2 or PW3. I note there are no issues labelled as severity: low, severity: medium, severity: high or severity: critical and that 12 of the 216 current outstanding issues appear to have been fixed but have not been closed by the initiator. Do you have any advice on the best approach to filtering (via Labels) the issues to learn what issues may be of concern? Also what does the Authors dropdown menu refer to?
    1 point
  29. I understand the theory behind sticking with labelled master versions and I don't see any harm in advising future superusers to follow that approach, but I guess I don't see why you can't use the latest dev now and still advise them of that for the future. It's not like being on dev forces you to stay on dev. No there isn't - it's really up to Ryan to make this decision and it's not something that is planned for specific date intervals. I think part of the reason for this is that he know that most of us are probably running the dev anyway. I think the key thing here is that starting a new project on the dev branch makes sense because you'll be testing thoroughly as you're using it. Upgrading an existing site to dev maybe the situation that is technically a safer approach. But I have been using PW for 5 years and in that time I think I've only come across 2-3 major bugs introduced in a dev version that affect existing functionality. Typically all you might have to worry about is new features which haven't been fully tested yet. Obviously PW is not perfect (https://github.com/processwire/processwire-issues/issues) and I actually think we need more solving of issues right now than new features, but no software is bug free. But does a "master" label make it more stable? Sometimes, but not always ?
    1 point
  30. Maybe a little offtopic, maybe not (and short as I'm on mobile): I was thinking about something like a Frontend Framework several times. Not a theme or a profile. A framework that helps you with the tedious tasks (like including assets in the markup, seo, less compiling, page builder setup etc). Something that brings some kind of structure/Standard (and reusability) to the frontend as well and makes creating the basic setup even faster. But I always end up thinking that it would only be one way of doing it (for example I would build it for the uikit framework) and in the end it would only be useful to me and not to others. Can'treally explain why but I really don't like site profiles. Especially not when it comes to keeping them up to date. That's why I created PW Kickstart. It always grabs the current version and you can easily customize the setup to your needs. If we had a frontend framework that made it easy (basically meaning making it one click) to install common components (like blog, seo, page builder, widgets) that would sometimes be great. But on the other hand that's just not how pw works. At least not yet. If course we have modules, but they are always decoupled from the frontend. IMHO it would be great to have another option of modules that modify the Backend AND the frontend. Looking forward to hearing your opinions. Have a nice weekend ?
    1 point
  31. Make sure you have a filter form that action url is the $page->url. I don't know what the problem is really but it's all getting too complicated for what it really can be (dead simple). Example filter form for a paginated result list : <?php namespace ProcessWire; $filter = ""; $form = $modules->InputfieldForm; $form->attr("action", $page->url); $form->attr("method", "get"); // select with sort options $f = $modules->InputfieldSelect; $f->attr("name", "sort"); $f->label = "Sort"; $f->addOptions(array( "-title" => "descending", "title" => "ascending" )); $form->add($f); // submit button $f = $modules->InputfieldSubmit; $f->attr("name", "filter"); $form->add($f); // process form if(count($input->get)){ // processes and populates form fields $form->processInput($input->get); // if sort is not empty if($form->get("sort")->value) { // build filter and add to whitelist so it gets picked up by pagination $input->whitelist("sort", $sanitizer->selectorValue($form->get("sort")->value)); $filter .= ",sort=" . $input->whitelist("sort"); } } $result = $pages->find("template=basic-page, limit=2{$filter}"); $content .= "<h2>Show Results</h2>"; if(!$result->count) { $content .= "<p>no results</p>"; } else { foreach($result as $res){ $content .= "<p>$res->title<br>$res->url</p>"; } $content .= $result->renderPager(); } $content .= $form->render();
    1 point
  32. I filed an issue on github. https://github.com/processwire/processwire-issues/issues/631
    1 point
  33. Heads up for any PW developers who use parallax images on the front end of their sites. Chrome v67 has introduced a bug - grrrrr. A quick search found the solution for me: https://productforums.google.com/forum/#!topic/chrome/DC4IFvGXdIA;context-place=topicsearchin/chrome/category$3Awindows-10%7Csort:relevance%7Cspell:false In your CSS: /* google chrome 67 parallax bug fix */ .parallax { transform: translate3d(0,0,0); -webkit-transform: translate3d(0,0,0); }
    1 point
  34. Just an FYI that my fork has just had some major updates and bug fixes: https://github.com/adrianbj/MarkupSEO/tree/various-fixes-enhancements If you are upgrading from an old version of my fork, please change the seo_robots field settings: Details > What should be used for input to Checkboxes
    1 point
  35. Thanks Benhard for this module, small modification i've updated the save() function to allow various output types as stated: https://mpdf.github.io/reference/mpdf-functions/output.html /* ########## output ########## */ /** * save output to: local file ($dest = "FILE") download ($dest = "DOWNLOAD") inline to browser (default - $dest = "INLINE") */ public function save($filename = 'output.pdf', $dest = "INLINE") { if(!$filename) $filename = 'output.pdf'; if($dest == "FILE") $filename = $this->getAbsolute($filename); // save to disk $this->mpdf->Output($filename, constant('\Mpdf\Output\Destination::'.$dest)); } // stream to browser $pdf->save(); $pdf->save('filename.pdf') $pdf->save('filename.pdf,'INLINE); // force download $pdf->save('myfile.pdf','DOWNLOAD'); // save locally $pdf->save('myfileserver.pdf','FILE');
    1 point
  36. Hi @tires - thanks for your thoughts. I am interested in the idea of supporting the doNotTrack option that way - I have raised the discussion with some others. The x icon behavior is intended. While I don't really agree with it, it seems to be standard practice at the moment, which is why we went that route. Personally I hope these silly banners go away soon and it is completely dealt with from a browser setting. Not sure how a user knows if a web site is respecting the setting or not, but I guess in reality you don't really know what is happening even with the banners. Anyone else have any thoughts on all this?
    1 point
  37. Ok, i find out a way myself. I set up a new js file, include this in the foot of my website and added this function: function loadGAonConsent(){ window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date; ga('create', 'UA-000000-0', 'auto'); ga('set', 'anonymizeIp', true); ga('send', 'pageview'); var gascript = document.createElement("script"); gascript.async = true; gascript.src = "https://www.google-analytics.com/analytics.js"; document.getElementsByTagName("head")[0].appendChild(gascript, document.getElementsByTagName("head")[0]); } and also this three lines to check if the cookie has been set: if(localStorage.getItem('pwcmbAllowCookies')){ loadGAonConsent(); } To exclude browsers that got the no-track option on you can use this: if(localStorage.getItem('pwcmbAllowCookies') == 'y' && navigator.doNotTrack != 1 && navigator.doNotTrack != "yes" && window.doNotTrack != 1 && navigator.msDoNotTrack != 1){ loadGAonConsent(); } Would be great if there were a "only show cookie banner if do not track is off" checkbox in the module ... or something simular.
    1 point
  38. Cool. On a related note: If you need to extract images from an MS-Word file, there's an easy "hack": Copy the Word file rename it to filename.zip. Un-zip it, and you'll see a folder "media" with all the images inside
    1 point
  39. I think it's probably too rare of a need to add to BatchChildEditor, but happy to have it in AdminActions. Just committed it to the latest version.
    1 point
  40. Ok, thanks for your opinions. I'll leave AOS as it is, and when things start going out of control it will support only one admin theme.
    1 point
  41. I agree with Adrian - in the future you might get too busy or just want to take a break from developing AOS and then users wouldn't be able to get new features or bug fixes that Ryan applies to the core admin theme. I also think it might turn out to be quite a hassle for you to apply core admin theme changes to your custom theme, because once the methods have been modified you won't be able to see changes easily via a simple diff. You'd have to monitor the core diffs instead and then manually hunt through your custom methods to find the equivalent locations. But once AdminThemeUikit has been the default admin theme for some period of time then I think it would be quite reasonable to say that AOS requires AdminThemeUikit and doesn't support the older themes.
    1 point
  42. Yeah, it will cause problems if the name field is not available somewhere. If you enable PW's Advanced mode you can use the "Display 'name' field in content tab?" option in a template's System tab. Or you can do this in a module with: $page->template->nameContentTab = 1; You may also want to do: $form->_pw_page_name->collapsed = Inputfield::collapsedYes; Both of these can be seen in action in: https://github.com/adrianbj/RestrictTabView Hope that helps.
    1 point
  43. Hi @horst, Not sure if you have already solved this now, but below is a quick demo module. A couple of notes: The Children tab is supposed to AJAX-load automatically when visible, but it's buggy: https://github.com/processwire/processwire-issues/issues/618 I can't remember the details but I seem to recall there might be an issue if the name field is not present in the ProcessPageEdit form. So if you strike problems you may need to move the name field to the Children tab and then hide it. Maybe @adrian knows about the name field issue? <?php namespace ProcessWire; class HideTabs extends WireData implements Module { /** * Module information */ public static function getModuleInfo() { return array( 'title' => "Hide Tabs", 'version' => 1, 'autoload' => 'template=admin', ); } /* @var ProcessPageEdit $ppe */ protected $ppe; /* @var InputfieldForm $form */ protected $form; /** * Ready */ public function ready() { $this->addHookAfter('ProcessPageEdit::buildForm', $this, 'afterBuildForm'); } /** * After ProcessPageEdit::buildForm * * @param HookEvent $event */ protected function afterBuildForm(HookEvent $event) { // Only for ProcessPageEdit (not ProcessUser) if($this->process != 'ProcessPageEdit') return; $this->ppe = $event->object; $this->form = $event->return; $page = $this->ppe->getPage(); // Only for one template (adjust as needed) if($page->template != 'my-template') return; // Remove the unwanted tabs $remove_tabs = [ 'ProcessPageEditContent', 'ProcessPageEditSettings', 'ProcessPageEditDelete', ]; foreach($remove_tabs as $tab_id) $this->removeTabFromForm($tab_id); // Trigger loading of Children tab // Hacky workaround for bug: https://github.com/processwire/processwire-issues/issues/618 $this->form->appendMarkup = " <script> $(window).load(function () { $('#_ProcessPageEditChildren').trigger('click'); }); </script> "; } /** * Remove tab from ProcessPageEdit form */ protected function removeTabFromForm($tab_id) { $tab = $this->form->find("id=$tab_id")->first(); if(!$tab) return; $this->form->remove($tab); $this->ppe->removeTab($tab_id); } }
    1 point
  44. I think several AOS features need to be in the core ? Seriously though, if we could get the most used features in the core, then perhaps the lesser used ones could remain in a trimmed down AOS. I think I'd rather see a module that works on top of a core theme, rather than you creating a separate theme that misses out on new features that Ryan adds until you have a chance to add them to your version of the theme. Does that make sense? I don't think you should being trying to maintain support for multiple themes though - I think going forward PW needs one solid flexible theme which can be restyled via CSS and functionality tweaked by hooks and js overrides. I think having multiple themes with different codebases just makes things difficult for Ryan because he often has to add new functionality to multiple themes - this is why I always stick with his default, which in my mind is UiKit these days. Anyway, I am a little OT now, but hopefully my ramblings make sense.
    1 point
  45. Not working. Nothing ? Ok, its working now. I needed to clear again the session/cookie after saving the module.
    1 point
  46. PS - Looks like California is getting in on this too: https://slate.com/technology/2018/06/california-just-passed-the-strictest-online-privacy-bill-in-the-country.html
    1 point
  47. @ridgedale It is not that problematic if you use one of the modules that support maintenance mode. I would suggest to install a maintenance or page-protection module into all of your sites. And a module for easy cache flushing? (https://github.com/somatonic/ClearCacheAdmin) Then FTP-Upload the new wire folder to something like "wire.new". Backup all your site databases! Login into every site and enable maintenance mode. FTP-Rename wire to wire.old and wire.new to wire. Repeat for every site: a) reload page, b) use the ClearCacheAdmin and c) additionally clear the "modules-cache". See that every thing is running fine and disable maintenance mode. ?
    1 point
  48. There's really not much difference to updating a single site. We are talking one wire folder after all. Of course, in the case of a multi-site, any bugs would affect multiple sites. OK, here we go: Backup all your remote sites databases. Get the files as well if doing #2. If possible, replicate your site locally, i.e. replicate your remote server environment locally (PHP version, etc) for testing purposes using the data from #1 If #1 was possible, test the upgrade locally. Look out for any clashes with third-party modules. You might have to clear your caches (PW, browser, etc) and compiled files several times for some changes to take effect. If everything's good and/or resolvable, proceed. Perform the upgrade on the remote server. Choose a time when you know things are a bit quite, if possible. You don't have much control here if the site is always busy. However, if you have shell access to your server, using curl or wget, grab the ProcessWire file and save it directly to your server in some temporary folder. Alternatively, ftp to the temporary folder. The advantage of uploading to a temporary folder is to avoid potential ftp transfer issues. Once you have the wire folder upload complete, rename your existing wire folder, e.g. old-wire and copy over the new wire. Normally this should take a few seconds in a server environment. Test your sites. If everything works, great. If not, determine if it can be quickly resolved and meanwhile put your sites on a maintenance mode (see various approaches in the forums) or in worst case scenario, rename the new (the one you copied over) wire to new-wire and revert old-wire back to wire. You'll then have to decide whether to delete new-wire or try the upgrade again if you know what needs to be resolved. Hope this makes sense.
    1 point
×
×
  • Create New...