Jump to content

Robin S

Members
  • Posts

    4,791
  • Joined

  • Days Won

    303

Everything posted by Robin S

  1. But you log in in with your username, not your email address. Or do you mean you used your email address as your username? In which case I would suggest don't do that - it violates the allowed characters for the "name" field of a user page.
  2. For next time, if you find yourself logged in as a user with limited admin permissions, just log out.
  3. @gingebaker, I don't think there is a currently a way to trash Repeater items rather than delete them, but it would be useful if there was. Do you want to open a GitHub request for this so that Ryan sees it?
  4. You can also use timestamps in a PageFinder selector or anything that works with strtotime(): $zaehler = $page->children("einsatzdatum>=first day of January 2017, einsatzdatum<=last day of December 2017");
  5. But are you positive you are actually connecting to the local site when you visit dev.example.com? If you haven't configured your hosts file correctly your browser may be attempting to connect to an online server where that address does not resolve to anything and hence the error. If you put a file "test.txt" in your local site root and visit dev.example.com/test.txt can you see your file?
  6. It is weird and not worth spending time on I think. I thought it was some general error but it actually only happens on one page and relates to something I was testing with FieldtypeSelectExtOption and hooks. The field and hooks apply to several pages containing similar data yet I only got the panel error on one - I tried a few things to narrow it down but couldn't see the cause. Then I removed and readded the Select External Option field to the template and all is well now. So just one of those strange things that spontaneously resolves.
  7. Captain Hook panel is working and removing the debug bar on the Form Builder template is also working. Thanks! However, there is a new panel error: ErrorException: A non well formed numeric value encountered in D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\TracyDebugger\panels\ProcesswireInfoPanel.php:359 Stack trace: #0 [internal function]: Tracy\Bar->Tracy\{closure}(8, 'A non well form...', 'D:\\Websites\\__w...', 359, Array) #1 D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\TracyDebugger\panels\ProcesswireInfoPanel.php(359): date('Y-m-d H:i:s', '2017-03-02 21:3...') #2 D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\TracyDebugger\tracy-master\src\Tracy\Bar.php(153): ProcesswireInfoPanel->getPanel() #3 D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\TracyDebugger\tracy-master\src\Tracy\Bar.php(108): Tracy\Bar->renderPanels() #4 D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\TracyDebugger\tracy-master\src\Tracy\Debugger.php(266): Tracy\Bar->render() #5 [internal function]: Tracy\Debugger::shutdownHandler() #6 {main} If I log $val before line 359 I get this: $val: {"pages_id":"1054","data":"dreamstimefree_5848146.jpg","sort":"2","description":"","modified":"2017-03-02 21:39:29","created":"2017-03-02 21:39:29"}
  8. It's those little things where you find some elegant, succinct way to do exactly what you want that make development so satisfying. The only frustrating thing is that unless you work in an office of fellow code nerds you don't get to share those "nailed it" moments. Like, in your home office you call your loved one over and gesticulate enthusiastically at the screen but they're all...
  9. TLDR: Buy ProFields I don't understand why that brief list of fields is a "mess and a nightmare". I know the general advice given is to reuse fields where possible but I think people sometimes take this suggestion a bit too seriously. Create the fields you need and forget stressing about whether you have perfectly optimised the reuse of fields. If you have less than, say, 100 fields in your site you really have nothing to worry about. I think I saw a post recently where Lost Kobrakai was talking about a site of his with over 800 fields. But ProFields... You mention client editing experience, so I take that to mean you (like me) earn an income from developing websites. With that in mind here are some things to consider when making your decision whether or not to purchase ProFields... Have you thought about how lucky we developers are that we can earn an income with virtually no overhead costs? With so much fantastic open-source software made available to us at no cost we are in a very fortunate position. We could design and develop websites entirely with free software if we so choose. Hell, if we wanted we could go to the landfill and probably pick up a free old computer that would be perfectly adequate to develop a website on. Now think about the carpenters and dentists and all those other professions that must purchase real physical tools (that wear out) in order to earn a living. £100 doesn't go very far if you need to buy a table saw. On the topic of open-source, think about what Mr Ryan Cramer has provided us with in ProcessWire. People with his level of skill do not need to be contributing their time for free to open-source projects - they are in very high demand for all kinds of lucrative work. Purchasing a Pro module from Ryan is a way to show appreciation for the generous work he puts into PW. PW is not just great free software, it is great software full-stop. You mention previously having worked with Drupal and Craft CMS. Time is money, so think of all the money you have saved by the quick development workflow that PW allows vs Drupal. And Craft CMS costs USD$299 per website and is still not as powerful as the PW core. Ryan's Pro modules are insanely good value for money. The price that you can purchase a dev license that allows you unlimited use of the modules is more than reasonable. For comparison, here is one of the most popular addons for Concrete5: http://www.concrete5.org/marketplace/addons/block-designer-pro There is no unlimited license, and a license for 5 installations costs USD$276.25. And it requires "Block Designer" so that's another USD$120 for 5 installations, bringing the cost to USD$396.25. I haven't used it but it looks like it is basically the equivalent of Repeater Matrix. But probably not as elegant. And with ProFields you get another four modules bundled in. For unlimited use. For USD$129. Hope this has helped make the decision a little easier.
  10. @MilenKo, my tip is that if you want to really accelerate your learning of ProcessWire and PHP the single most important thing you can do is install Tracy Debugger and start dumping variables. Whenever you are confused or curious about something, dump it and explore it in the debugger. Installing Tracy also makes sure you are seeing PHP errors when they occur. If you dump $page->recipe_rating you will probably find out where you are going wrong.
  11. In Soma's tutorial he covers the $options array - does setting 'forceDownload' to false achieve what you want?
  12. I think your time would have been better spent persisting with FieldtypeRate, which seems to be exactly what you are looking for. I installed it to test it and it works straight out of the box, so not sure how you have been going wrong. Just echo the field as per the documentation: echo $page->my_rating_field; // of course change this to the name of your ratings field There is a small error in the module code that will generate a PHP notice but it is an easy fix - delete line 66 as it looks like it is an accidental leftover from the FieldtypePoll that the module is based on.
  13. I think the error is down to the Windows directory separator thing that reared its head a while ago. If I json_encode and log $segments I see results like this: Not sure why there would be double slashes there instead of single slashes. If I change line 110 to be... $segments = explode(DIRECTORY_SEPARATOR, $path); ...then the panel error is fixed, although I notice that the 'wire' segment still looks a bit funky: Maybe there are other places where a hardcoded forward slash should be replaced with the DIRECTORY_SEPARATOR constant? I don't mean to get OT here, but I'm curious how you like to handle front-end forms if you don't use Form Builder. Do you use the forms API, or a third-party forms library like Nette Forms, or some other approach?
  14. Thanks for implementing this so quickly. The template restriction works if I select a template such as "home" or "basic-page", but it doesn't work for the "form-builder" template for some reason. The debug bar still appears on the Form Builder page when it is loaded in an iframe and when the page is loaded directly. I'm also seeing an error in the Captain Hook panel which may or may not be related: ErrorException: Undefined offset: 2 in D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\panels\CaptainHookPanel.php:111 Stack trace: #0 D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\panels\CaptainHookPanel.php(111): Tracy\Bar->Tracy\{closure}(8, 'Undefined offse...', 'D:\\Websites\\__w...', 111, Array) #1 D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\tracy-master\src\Tracy\Bar.php(153): CaptainHookPanel->getPanel() #2 D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\tracy-master\src\Tracy\Bar.php(108): Tracy\Bar->renderPanels() #3 D:\Websites\__www\1testing\site\assets\cache\FileCompiler\site\modules\TracyDebugger\tracy-master\src\Tracy\Debugger.php(266): Tracy\Bar->render() #4 [internal function]: Tracy\Debugger::shutdownHandler() #5 {main}
  15. Hi @adrian, Is there a way to tell the debug bar not to appear on pages with a particular template? The situation is that I'd like to be able to turn off the debug bar for the Form Builder template that is used when the form is rendered inside an iframe. I know there is an option to disable the debug bar in modals, but not for iframes I think? And it's often useful to have the debug bar in iframes so it would be great to be able to target templates rather than all iframes. Any thoughts on this?
  16. This is true. It starts to get a little more complex but with a few more steps you can filter out the non-public pages: $field = $fields->get('my_options_field'); $table = $field->getTable(); $query = $database->query("SELECT data, pages_id FROM $table"); $results = $query->fetchAll(PDO::FETCH_COLUMN|PDO::FETCH_GROUP); // get multidimensional array of results $results_page_ids = array_unique(call_user_func_array('array_merge', $results)); // get all the unique page IDs in the results $public_ids = $pages->find(['id' => $results_page_ids])->explode('id'); // find out which ones are public $filtered_results = []; foreach($results as $option_id => $page_ids) { // remove any page IDs that are not public $filtered_value = array_filter($page_ids, function($value) use ($public_ids) { return in_array($value, $public_ids); }); // for each option, count the public pages it is selected on if($filtered_value) $filtered_results[$option_id] = count($filtered_value); } arsort($filtered_results); // sort highest to lowest $all_options = $field->type->getOptions($field); echo '<ul>'; foreach($filtered_results as $option_id => $count) { $option = $all_options->get($option_id); echo "<li>{$option->title} ({$count})</li>"; } echo '</ul>';
  17. v0.0.4 released. Adds config option to remove clone button.
  18. The thing about this approach where you foreach the selectable options (for an Options or a Page field) is that if you have 196 countries (for example) then that is 196 database queries. Not the end of the world or anything but also not very efficient. I like this code from Ryan that requires only a single DB query, and which can be adapted for an Options fieldtype: $field = $fields->get('my_options_field'); $table = $field->getTable(); $query = $database->query("SELECT data FROM $table"); $ids = $query->fetchAll(PDO::FETCH_COLUMN); $count_values = array_count_values($ids); // count the frequency of values in the array arsort($count_values); // sort highest to lowest // use the option IDs and counts as needed, for example: $all_options = $field->type->getOptions($field); echo '<ul>'; foreach($count_values as $option_id => $count) { $option = $all_options->get($option_id); echo "<li>{$option->title} ({$count})</li>"; } echo '</ul>';
  19. Quite the contrary - the lister can handle virtually any number of users with ease. Click column headers to sort, add new columns on the "Columns" tab.
  20. The idea is not to need a Hanna tag - just let your editors insert images into the CKEditor field and then do any manipulation of the images (whatever it is you are currently doing in your Hanna tag) in your textformatter module. Not sure exactly what you are doing in your tag but the Image Interceptor module is pretty comprehensive so there's a good chance it already covers what you need. Or you can build your own simple textformatter to parse images from the HTML and manipulate the markup as needed.
  21. Hi and welcome @Cole. Could you please provide some more information... Is the 403 error occurring in your local environment or online? Are those rewrite rules the source of the error - that is, does the error disappear if you remove those lines from htaccess? Does the error occur when you access the website via all three of the below? dev.example.com www.example.com example.com And I take it that you are routing dev.example.com to 127.0.0.1 by editing whatever the MacOS equivalent is to the Windows 'hosts' file and have configured that domain as an Apache virtual host in your local environment?
  22. You can get the array of entries and then do a usort(): $entries = $forms->get('reserveren')->entries()->find(''); // sort entries newest to oldest by field 'datum' usort($entries, function($a, $b) { return $b['datum'] - $a['datum']; }); // OR, sort entries oldest to newest by field 'datum' usort($entries, function($a, $b) { return $a['datum'] - $b['datum']; }); // do what you want with $entries array
  23. For manipulating images embedded in a CKEditor field I use a textformatter, following the same general principles as this module: http://modules.processwire.com/modules/textformatter-image-interceptor/
×
×
  • Create New...