Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/09/2017 in all areas

  1. Edit: Because of the great response to this topic I wrote a guest blogpost: https://processwire.com/blog/posts/building-custom-admin-pages-with-process-modules/ One of the hidden treasures of processwire seems to be the creation of custom admin pages. Technically speaking those pages are ProcessModules - but i guess that's the reason why so many people out there seem to be afraid of building them... it sounds so hard! You've never created a module for ProcessWire? You have never created a plugin for any other CMS? You have no clue about OOP with all its classes, methods and properties? No problem! I'll show you how simple you can start: <?php class CustomAdminPage extends Process { public static function getModuleinfo() { return [ 'title' => 'Custom Admin Page Example', 'summary' => 'Minimalistic ProcessModule to show that nobody has to be afraid of building custom admin pages.', 'href' => 'https://processwire.com/talk/topic/17709-how-to-create-custom-admin-pages-aka-processmodules-yes-its-that-simple/', 'author' => 'Bernhard Baumrock, baumrock.com', 'version' => 1, // page that you want created to execute this module 'page' => [ 'name' => 'customadmin', // your page will be online at /youradmin/setup/customadmin/ 'parent' => 'setup', 'title' => 'Custom Admin Page Example' ], ]; } public function ___execute() { return 'This is the most simple Admin-Page you have ever seen :)'; } } Now save this file as CustomAdminPage.module and place it in your /site/modules folder. After a refresh it will show your module in the modules manager of your site where you can install it: After installation you already have your first very own admin page! Congratulations! Was not too hard, was it? It's as simple as that! Now lets add some more custom HTML. And to show you another nice feature we will add this code to a separate method called executeDemo(). And because everything is so simple we will also add some javascript to this page public function ___executeDemo() { $out = ''; $out .= '<h1>H1 has some special css styling in the admin, thats why it seems to have no effect</h1>'; $out .= '<h2>H2 looks different ;)</h2>'; $out .= '<h3>...and so does H3</h3>'; $out .= '<button onclick="myFunction()">Click me</button>'; $out .= '<script>function myFunction() { alert("this is a demo javascript"); }</script>'; return $out; return ''; } Now thanks to ProcessWire-magic your page will already have its own URL: Just append /demo to your url and see what you get: And of course don't forget to click the button Ok, now that code looks a bit hacky, right? Inputfields and especially InputfieldMarkup for the win! We add another method with some advanced code. To use inputfields we need a form that holds all those inputfields and that makes it possible to handle user input lateron. See somas great tutorial about forms here for a quickstart and more details: public function ___executeAdvanced() { $out = '<h2>A more complex Example</h2>'; $form = wire()->modules->get('InputfieldForm'); $field = wire()->modules->get('InputfieldMarkup'); $field->label = 'Markup Test 1'; $field->value = '<h1>h1</h1><h2>h2</h2><h3>h3</h3><h4>h4</h4>'; $form->add($field); $out .= $form->render(); return $out; } Ok, it get's boring Let's do something more fun and add a chart in a second field and change the fields to 50% screen width (I'm sure you know that already from the GUI template editor)! public function ___executeAdvanced() { $out = '<h2>A more complex Example</h2>'; $form = wire()->modules->get('InputfieldForm'); $field = wire()->modules->get('InputfieldMarkup'); $field->label = 'Markup Test 1'; $field->value = '<h1>h1</h1><h2>h2</h2><h3>h3</h3><h4>h4</h4>'; $field->columnWidth = 50; $form->add($field); $field = wire()->modules->get('InputfieldMarkup'); $field->label = 'Chart Sample'; $field->value = '$chart'; //$field->notes = 'Example code taken from here: http://www.chartjs.org/docs/latest/getting-started/usage.html'; $field->columnWidth = 50; $form->add($field); $out .= $form->render(); return $out; } OK, we are almost there... we only need to add the chart library! To keep everything clean we will put the code for the chart in another method. We will make that method PRIVATE to add some security. Our new Method: private function renderChart() { // prepare chart code wire()->config->scripts->add('https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.3/Chart.min.js'); ob_start(); ?> <canvas id="myChart"></canvas> <script> var ctx = document.getElementById("myChart"); var myChart = new Chart(ctx, { type: 'bar', data: { labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"], datasets: [{ label: '# of Votes', data: [12, 19, 3, 5, 2, 3], backgroundColor: [ 'rgba(255, 99, 132, 0.2)', 'rgba(54, 162, 235, 0.2)', 'rgba(255, 206, 86, 0.2)', 'rgba(75, 192, 192, 0.2)', 'rgba(153, 102, 255, 0.2)', 'rgba(255, 159, 64, 0.2)' ], borderColor: [ 'rgba(255,99,132,1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)', 'rgba(153, 102, 255, 1)', 'rgba(255, 159, 64, 1)' ], borderWidth: 1 }] }, options: { scales: { yAxes: [{ ticks: { beginAtZero:true } }] } } }); </script> <?php return ob_get_clean(); } Now we just need to call $this->renderChart() in the right place! Here is the complete Module: <?php class CustomAdminPage extends Process { public static function getModuleinfo() { return [ 'title' => 'Custom Admin Page Example', 'summary' => 'Minimalistic ProcessModule to show that nobody has to be afraid of building custom admin pages.', 'href' => 'https://processwire.com/talk/topic/17709-how-to-create-custom-admin-pages-aka-processmodules-yes-its-that-simple/', 'author' => 'Bernhard Baumrock, baumrock.com', 'version' => 1, // page that you want created to execute this module 'page' => [ 'name' => 'customadmin', // your page will be online at /youradmin/setup/customadmin/ 'parent' => 'setup', 'title' => 'Custom Admin Page Example' ], ]; } public function ___execute() { return 'This is the most simple Admin-Page you have ever seen :)'; } public function ___executeDemo() { $out = ''; $out .= '<h1>H1 has some special css styling in the admin, thats why it seems to have no effect</h1>'; $out .= '<h2>H2 looks different ;)</h2>'; $out .= '<h3>...and so does H3</h3>'; $out .= '<button onclick="myFunction()">Click me</button>'; $out .= '<script>function myFunction() { alert("this is a demo javascript"); }</script>'; return $out; return ''; } public function ___executeAdvanced() { $out = '<h2>A more complex Example</h2>'; $form = wire()->modules->get('InputfieldForm'); $field = wire()->modules->get('InputfieldMarkup'); $field->label = 'Markup Test 1'; $field->value = '<h1>h1</h1><h2>h2</h2><h3>h3</h3><h4>h4</h4>'; $field->columnWidth = 50; $form->add($field); $field = wire()->modules->get('InputfieldMarkup'); $field->label = 'Chart Sample'; $field->value = $this->renderChart(); $field->notes = 'Example code taken from here: http://www.chartjs.org/docs/latest/getting-started/usage.html'; $field->columnWidth = 50; $form->add($field); $out .= $form->render(); return $out; } private function renderChart() { // prepare chart code wire()->config->scripts->add('https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.3/Chart.min.js'); ob_start(); ?> <canvas id="myChart"></canvas> <script> var ctx = document.getElementById("myChart"); var myChart = new Chart(ctx, { type: 'bar', data: { labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"], datasets: [{ label: '# of Votes', data: [12, 19, 3, 5, 2, 3], backgroundColor: [ 'rgba(255, 99, 132, 0.2)', 'rgba(54, 162, 235, 0.2)', 'rgba(255, 206, 86, 0.2)', 'rgba(75, 192, 192, 0.2)', 'rgba(153, 102, 255, 0.2)', 'rgba(255, 159, 64, 0.2)' ], borderColor: [ 'rgba(255,99,132,1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)', 'rgba(153, 102, 255, 1)', 'rgba(255, 159, 64, 1)' ], borderWidth: 1 }] }, options: { scales: { yAxes: [{ ticks: { beginAtZero:true } }] } } }); </script> <?php return ob_get_clean(); } } I hope you enjoyed reading this and it will open up many new possibilities for you! Updates: permissions: https://processwire.com/talk/topic/17709-how-to-create-custom-admin-pages-aka-processmodules-yes-its-that-simple/?do=findComment&comment=174746 tutorial on file uploads: https://processwire.com/talk/topic/17709-how-to-create-custom-admin-pages-aka-processmodules-yes-its-that-simple/?do=findComment&comment=185261 snippet how to use NavJSON: https://processwire.com/talk/topic/17709-how-to-create-custom-admin-pages-aka-processmodules-yes-its-that-simple/?do=findComment&comment=216412
    16 points
  2. Client suddenly realised she needed a website in order to hand out her new business cards which had the website URL & email address, less than 2 weeks before her TED talk. Was given 1x logo, 1x photo, 1x phone screenshot of a paragraph of text and told she'd like to see the 'wings flying'. TED talk event 2 Nov 2017: https://www.ted.com/tedx/events/23988 End result landing page: https://beautifulhumanway.com/ Hopefully site will grow to show more of this amazing woman and her achievements Using PW 3.0.79 with delayed output and regions Modules (many thanks to @ryan and his pro modules): Profields: Functional fields Profields: Repeater Matrix ProCache FormBuilder MarkupSEO MarkupJson-LDSchema MarkupSimpleNavigation MarkupSrcSet EmailObfuscator and for a short time during development, PageProtector
    10 points
  3. Tasker is a module to handle and execute long-running jobs in Processwire. It provides a simple API to create tasks (stored as PW pages), to set and query their state (Active, Waiting, Suspended etc.), and to execute them via Cron, LazyCron or HTTP calls. Creating a task $task = wire('modules')->Tasker->createTask($class, $method, $page, 'Task title', $arguments); where $class and $method specify the function that performs the job, $page is the task's parent page and $arguments provide optional configuration for the task. Executing a task You need to activate a task first wire('modules')->Tasker->activateTask($task); then Tasker will automatically execute it using one of its schedulers: Unix cron, LazyCron or TaskerAdmin's REST API + JS client. Getting the job done Your method that performs the task looks like public function longTask($page, &$taskData, $params) { ... } where $taskData is a persistent storage and $params are run-time options for the task. Monitoring progress, management The TaskerAdmin module provides a Javascript-based front-end to list tasks, to change their state and to monitor their progress (using a JQuery progressbar and a debug log area). It also allows the on-line execution of tasks using periodic HTTP calls performed by Javascript. Monitoring task progress (and log messages if debug mode is active) Task data and log Detailed info (setup, task dependencies, time limits, REST API etc.) and examples can be found on GitHub. This is my first public PW module. I'm sure it needs improvement
    9 points
  4. The idea is quite simple: You set up a repeater field with all the fields you'll need for each type of block. Title, body, images, single image... etc. You add another options field (I called it "type") and populate that with the names of the block types you'll need. For each other field (body, images...) you set up its visibility to show only when type is relevant. The result should be a repeater, when you add a block the only field that shows up will be a drop-down for type, and when you choose that, the relevant fields appear. Setting up a field's visibility: Adding a block before choosing type (ignore the other two fields, that's for something else): And after choosing type... From the template, I'm just doing a foreach that goes through the repeater, then use the type field to decide what "sub-template" file to include. That keeps things neat and separated. This can also be done with a RepeaterMatrix ProField, which simplifies this whole process. On a more recent project I'm currently working on I'm using that combined with field templates to achieve more or less the same effect.
    6 points
  5. Interesting Conference / Talk from Rasmus Lerdorf, creator of PHP.
    5 points
  6. Change this line to <?php namespace ProcessWire; With v3.0, all global functions are now under ProcessWire namespace, so you need to either declare namespace at the top or prefix function calls (\ProcessWire\wire() for instance)
    5 points
  7. hi @mtwebit welcome to the forum and thanks for that module! i've created something similar for one of my projects but it's custom and not built into a module so i think there's potential for what you are doing some ideas/questions/feedback: use InputfieldMarkup to structure your custom code and make it look&feel more native. see my new tutorial here: do you know the wirequeue module? would be great to have an easy way to integrate this into other modules or custom pages. maybe it is already possible - i'll have a look when i have more time This is how my progressbar looks like using InputfieldMarkup:
    4 points
  8. i don't know how the guys from uikit are doing it but they have nice docs and it seems that everybody can post suggestions (there is an edit button on all pages): https://getuikit.com/docs/icon it's unbelievable how much you contributed to the community so far - a donation button would be the least imho. i've already asked you for that some time ago
    3 points
  9. It is actually simpler than it looks, you just have to be brave! And use a disposable local install of PW, just in case you blow it to smithereens. (I'm joking of course, so long as you leave /wire/ alone, there isn't much damage you can do.) It's a fantastic feeling of achievement seeing your own custom page in the PW backend. @arjen is quite right. The extensibility of PW's backend isn't something you see mentioned in reviews etc.
    3 points
  10. @adrian Hi, I scanned the "docs" and could not find this tip of yours: https://github.com/processwire/processwire-issues/issues/429#issuecomment-342976462 sounds like an important one. Could you please consider adding it? Also, AJAX instructions are mostly in the Getting Started section which is fine but probably a dedicated "Debugging AJAX" or maybe "Working with AJAX" section with links to other related tips found on the page and additional tips like the one above would be nice to have.
    3 points
  11. @alan, you might be better off using a mod_rewrite rule than using Redirect, because then you can use the [L] flag to avoid the other rewrite rules affecting the URL. So instead of... Redirect 301 /my-short-cut http://example.com/the/long/page/to/go-to/#theAnchorIwant ...try... RewriteRule ^my-short-cut$ http://example.com/the/long/page/to/go-to/#theAnchorIwant [R=301,NE,L] ...just after... RewriteEngine On
    3 points
  12. Well if there is no support by PW for reading and displaying the content in the /docs folder, it can easily be excluded from downloads using .gitattributes in the repo: docs export-ignore will ensure it is not downloaded when you install the module. This way I could have a dedicated docs pages for Tracy hosted on Github Pages and you guys could submit PRs to help (which would be hugely appreciated). I'd love to see lots of screenshots and examples - this could work out really nicely I think. To that end, I have set up a new docs page at: https://adrianbj.github.io/TracyDebugger/ I have checked and the docs folder is correctly excluded from the download, so I think we should be good to go to start working on these docs. I have set the theme to the default "Cayman" for now, but may change as I learn more about Github Pages. I'll set up a basic structure and then hope to see some pull requests from you guys. Does that look / sound ok?
    2 points
  13. Hey @szabesz - I really need to start the docs again from scratch. I have butchered that blog post so badly with new additions and most of the screenshots are really old. I'd really like to start a Github wiki for docs - @tpr has inspired me with the amazing job he has done on the docs for his modules using the wiki. The problem of course is time. I am already spending way too much time on module development and support and not enough time on paid client work - not meant to be an excuse, just a reality. And there are lots of others here putting in just as much time! I'd love to dedicate more time to PW module development, but of course that would mean paid modules - what to do ? Maybe the Tracy docs could be a team effort - anyone interested? The problem is that there is no easy way to enable PRs on Gitbub wikis, although this might work: http://www.growingwiththeweb.com/2016/07/enabling-pull-requests-on-github-wikis.html Any thoughts?
    2 points
  14. Easy. See Then have a field in that page for owner, which is the user's $user->id, add ?edit=true to the url (in a link from a user page or whatever) then in the page template something like <?php namespace ProcessWire; // Code to display page contents to guests if($input->get->edit && ($page->owner != $user->id)){ echo 'You are not authorised to edit this page.'; } else { // Your code (edit form etc) here } Very rough, but you should get the gist. If you get stuck, come back here and ask.
    2 points
  15. I'll need some time for that. Let me see what I can do.
    2 points
  16. @gmclelland, turns out it is a piece of cake with str_replace. Create a custom permission "rename-images" and give that to roles that you want to allow to rename images. Then add the following to /site/ready.php $wire->addHookAfter('InputfieldImage::renderItem', function(HookEvent $event) { if(!$this->user->hasPermission('rename-images')) { $event->return = str_replace(" contenteditable='true'", "", $event->return); } });
    2 points
  17. Sometimes you need to track changes in certain values of a page to take an action afterwards. In this example I will show you how to show a simple message after changes to inform the user that field values have been changed. Put this piece of code inside your ready.php. //Track changes $pages->addHookAfter('saveReady', function($event) { $page = $event->arguments[0]; if(!in_array($page->template->name, array('template1','template2'))) return; $fields = array('field1','field2','field3','field4'); $changedfieldsarray = array(); foreach($fields as $field) { if ($page->isChanged($field)) { $changedfieldsarray[] = $page->fields->get($field, true)->label; } } $fieldnames = implode(", ", $changedfieldsarray); $this->warning(sprintf(__("Following fields have been changed: %s"), $fieldnames )); }); The first restriction in this example is to run this hook "aftersaveReady" and only on certain templates: in this case template1 and template 2. You need to rename this to your template names. Remove the following line of code if you want it to run on all pages (no restrictions): if(!in_array($page->template->name, array('template1','template2'))) return; Now you have to define the fields where you want to track changes (take a look at this line): $fields = array('field1','field2','field3','field4'); In this case the fields are called "field1 to field4". Rename it to your field names. The API call to track changes is "$page->isChanged('fieldname')". You will find more information at https://processwire.com/api/ref/page/is-changed/. Use a foreach to loop through the fields array and store all changed fields inside an array. In the last step all the changed fields were outputted inside a message to inform the user. In this case I want to show the labels instead of the field names. Only to mention: The changes will keep alive, so you have to delete it manually (http://cheatsheet.processwire.com/pagearray-wirearray/change-tracking/a-resettrackchanges/). This little tutorial should only be a starting point for your own coding.
    1 point
  18. For those who find the Finder app quite limiting, I highly recommend this program. And it's free now to boot! https://itunes.apple.com/us/app/forklift-file-manager-and-ftp-sftp-webdav-amazon-s3-client/id412448059?mt=12
    1 point
  19. Last night a documentary called "Steve Jobs: The Lost Interview" was broadcast on New Zealand television (on Maori Television, which is about the only free-to-air channel worth watching here). Now I am very far from being an Apple fanboy and I knew almost nothing about Steve Jobs going in. I haven't seen any of the biopics from recent years. I was tossing up whether to even turn on the TV but thought I would give it a few minutes. Well, I was glued to the screen throughout and now I completely get why this guy was exceptional. He's obviously very intelligent but you expect that. What blew me away was the clarity of his thinking and the general manner in which he communicates. Here he is answering questions off-the-cuff and the answers he gives are so concise and insightful and just go straight to the crux of the issue. And when he is asked a question about something he hasn't previously clarified his own thinking on he doesn't just blurt something out like normal people - he pauses and thinks and then answers. That is a rare quality. This is 70 minutes of unedited interview but it is fascinating stuff. There are goodies in there for people interested in computer science history, but also highly recommended for anyone with an interest in management or even general self-improvement.
    1 point
  20. I'll try and fix the css to work on UiKit; in the meantime if the prev/next links make it into AOS that would be great, and 1 less module to install and worry about configuring on new sites...
    1 point
  21. I can confirm this issue with the Uikit theme. Here is an idea for the prev-next edit links placement, next to the page title: And I would use the regular link "title" attribute instead of the tooltip (it just works). In fact I wanted the add this feature to AOS for a long time but I couldn't find a satisfactory place to them. But now I think this is it
    1 point
  22. PW does alter/check every URL that is requested, you need to map it with url segment/url vars and make check if the urls that the script need are blocked. For using external scripts right you have to bootstrap processwire in your script so you can save and find the data via the API. http://processwire.com/api/include/ For me i would go and setup the fields and templates in processwire and just simple use the calendar generation and you could use the HTML, JS and CSS and replace the PHP magic with PW API magic....this yould be much more flexible on the long run. regards mr-fan
    1 point
  23. Thank you very much...very easy entry on this topic....the last years i used AdminCustomPages but this is a little bit outdated since 3.x so this will be the only way to go. Best regards from the neighborhood
    1 point
  24. Have you seen these? https://processwire.com/talk/topic/11451-change-default-language-revisited/ or: https://processwire.com/talk/topic/12743-using-an-empty-language-pack-as-the-default-front-end-language/?do=findComment&comment=116016
    1 point
  25. the input form is all native PW; so you just supply your array of field definitions using the correct keys for that inputfield type; no graphical ui would be possible, but there is a kitchen sink file where you just grab the type of inputfield you want, paste it in to your fields array, change the settings and bob's your uncle.
    1 point
  26. i think most of us can handle this pressure of course it will not pay back the time invested but it's nice to have the possibility to say thank you. but of course if someone wants to invest more time on a module making it commercial is totally fine. i'm also thinking about that topic... regarding the docs i would love to see some kind of standardisation here. maybe someone knows a good solution already.
    1 point
  27. I'm not a fan of docs as part of modules. Maybe its just me but I like to keep the codebase as light as possible. Also, we've been asking for "changelog" support in ProcessWire so it is hard to see why docs support would get priority but one never knows I understand this but if that tool can export in a format which makes it possible to migrate the whole stuff – just in case – then why not give it a try? I'm not pushing penflip.com as I have only read its homepage, I just like tools which are designed for a specific need. As long as they work well, of course...
    1 point
  28. Thanks for the penflip suggestion. I am hesitant to host the docs somewhere else though. I am actually tempted to just use the README.md file and make use of a Table of Contents to make it easier to navigate. In some ways this is better than the pagination options in the wiki and in some ways worse. I am also looking at the possibility of using Github pages, but that means a "docs" subfolder (which would be included in module installs), or a separate "pages" repo. Doesn't seem like there is anything really ideal, although maybe having offline docs with a module would be an advantage despite the larger download. Maybe the PW modules interface could actually read and display the contents of the docs folder? That could actually be really cool - offline docs available directly from within PW. Anyone interested in supporting a request for this from Ryan? Or maybe it could be built initially as a module. Of course it would only be useful if module authors were to get on board, so it might take some time before it was actually useful. Thanks @bernhard and @szabesz for the donation button push. There are so many people here who do lots for the PW community, I never wanted to put pressure on anyone for donations. Also not sure how effective it will really be. If the plan is to do less client work and more PW modules, then I think you need a more robust/reliable source of income that might come from a killer paid module, or a module with a free and pro version. Obviously getting way OT here though.
    1 point
  29. The Steve Jobs book was good too. Didn't enjoy the movie though, lots of shouting and just found it pure boring. I think he was a very unique man indeed. I totally understand the fanboy stuff, buying into Apple is like joining a community, there's a feeling that goes with it, it's not 'just a product'. The old keynotes were exciting to watch and still are. Personally I use android/iOS/OSX/Win10/Linux as I just can't be tied down. I get FOMO if I stick to one system for too long.
    1 point
  30. Hi @gregory Take a look at this https://processwire.com/api/multi-language-support/code-i18n/#translatable-strings and https://processwire.com/api/multi-language-support/ and also we have new Pro Functional field that might suit your needs. https://processwire.com/blog/posts/functional-fields/
    1 point
  31. Sometimes the best approach to debugging when you're not getting anywhere is to just exclude large chunks of code to narrow things down. It's process of elimination which may not seem elegant, but sometimes it's actually pretty quick. Actually, leaving off the closing ?> is recommended, unless of course you have HTML after the php.
    1 point
  32. Very nicely done! Only thing I would add is <noscript>. By default I have all scripts off until I am certain of the site I visit, so an empty page is initially displayed with no indication of js/cookie requirements.
    1 point
  33. I do not know what makes a genius but Steve Jobs was a rather controversial character. Sometimes he was more like maniac. He was rather good at expressing his thoughts, sure. http://fortune.com/2008/03/05/the-trouble-with-steve-jobs/ "Jobs’ personal abuses are also legend: He parks his Mercedes in handicapped spaces, periodically reduces subordinates to tears, and fires employees in angry tantrums. Yet many of his top deputies at Apple have worked with him for years, and even some of those who have departed say that although it’s often brutal and Jobs hogs the credit, they’ve never done better work." In my point of view, a "true genius" has no moral issues to begin with. After all she/he is supposed to be a "genius", right?
    1 point
  34. This video is also worth checking out. How to responsive to an insult. Again the thinking... No blurting... And a great answer.
    1 point
  35. I managed to build the whole site without using Jquery, for speed optimization, so unfortunately the Jquery option is no alternative. I will go for the copy solution. Thank you for your help!
    1 point
  36. Another approach would be to add the CSS classes with Jquery onload, but you are also not aware of changes in the future. I use the first method for years now and I had no problems. I dont think that there will be major changes taken in the future. At the moment you could only change some attributes of the form tag, but not for the inputs.
    1 point
  37. You don't need an extension, just add vscode://file/%file:%line to tracy. https://code.visualstudio.com/docs/editor/command-line#_opening-vs-code-with-urls
    1 point
  38. Take a look at this post (https://processwire.com/talk/topic/17263-custom-comments-form-and-list-styling/?do=findComment&comment=151627): You can copy the comment files from wire/modules into the module folder of your site folder (site/modules) and there you can change your CSS classes and the markup too. I think this is the best approach to adapt the comments output to your needs. You dont need to hack anything and it will not be overwritten during updates.
    1 point
  39. Is there some way to rename uploaded files through admin UI as it possible with images?
    1 point
  40. Just a quick update - I went to use the Email Batcher for the first time with a complex HTML template and realized that ACF and Purifier were getting in the way, so these are now disabled so now you can build complex email templates and preview them right in the CKEditor body field.
    1 point
  41. Maybe even look at https://github.com/adrianbj/BatchChildEditor as well.
    1 point
  42. AFAIK there isn't any way to do this currently. I also wish there was a dedicated permission for renaming files. There are some cases were I don't want certain users to rename any uploaded files.
    1 point
  43. I'm not sure, but maybe looking at the code from http://modules.processwire.com/modules/table-csv-import-export/ would help?
    1 point
  44. Turn them into links. Make sure to have no spaces in the phone number (inside href) <a href="tel:05345345345">Call Us!</a> To remove the spaces from a given phone number you can use: $spaced = ' 345 345 234 '; $clean = preg_replace('!\s+!', '', $spaced); $telUrl = "tel:$clean";
    1 point
  45. No need, @Cesco. You can do this on your current installation. To use Italian as your default language on the frontend, and considering your want "example.com/" to open in Italian and "example.com/en/" to change to English, do the following: As this is a new installation, and you have no real data yet, delete all languages but the default one, of course. Change the default language title to Italiano Upload Italian translation files to it Create a new language, name "en", title "English" Edit the homepage and set the "en" language as active and the url as "en".
    1 point
  46. A stock PW3 installation should actually be faster than PW2 – it certainly is on all of my installations. There's a lot more optimization in PW3 than in PW2. If that's not what you are seeing, then it's time to start looking for where the bottleneck is. PW3 does not have more significant overhead than PW2 except when it is compiling a file for the first time. The 30% increase numbers mentioned above sound to me like that is a request where PW is compiling a file. You can expect a request where it has to re-compile a file to take longer. But it only has to do that once, when a file changes and needs to be re-compiled. Maybe that's a common occurrence on a dev site, but should be a rare one on a production site. I'm measuring here with Chrome dev tools, ProfilerPro and my own timers using the Debug class. What tool are you guys using to measure times, and in what quantity? Before deciding something is PW3 related, I really suggest testing with a basic/blank profile without other modules installed. If you are consistently seeing any kind of increase in render times under PW3, my guess would be that something is getting recompiled on every request for some reason or another, or that there is another module involved that runs slower under PW3 for some reason. Edit--A few things to add: Debug mode is going to be slower in PW3 than in PW2, simply because PW3 is tracking a lot more stuff than PW2 did. With debug mode off there should be no difference though. Keep in mind debug mode is for development, and not something you should ever leave enabled on a production site. PW3 is more efficient with resources than PW2. PW3's boot time (stuff it does before executing your template file) is 20% to 45% faster in my testing. PW3 executes 20% to 25% fewer queries as part of the boot, and loads up to 50% fewer pages. Autoload modules become part of the boot process, so I test with no 3rd party modules installed. The file compiler can potentially add a little bit of overhead even when it doesn't need to compile, because it has to determine whether something needs compilation. But on a default site profile we're talking about maybe 10ms at the most here. If you turn off the template compiler, then that overhead is gone. While PW3 uses fewer resources on the database side, but sometimes more resources on the file system side. If you've got a slow file system, you might notice it more in PW3 than in PW2. For those of you seeing PW3 to be slower than PW2, if it's determined that 3rd party modules are not a factor, I would be curious what's happening in the template files. Perhaps there is a bottleneck in a certain API call or something that we're not aware of yet. It would be interesting to see the results of profiling the API calls in your template files using ProfilerPro or Debug::timer() calls. Mostly specific to Soma: PW2 and PW3 are identical in terms of how they use joins and indexes. Regardless of version, PW will use as many joins as it takes to execute the selector you give it. Just like you can create complex or inefficient SQL queries you can also create equally inefficient $pages->find() calls if you aren't being careful. Using PW's API doesn't mean you are somehow bypassing the database. Your find() queries still become SQL queries. So if you are working on big and complex projects, then you need to watch and profile your work. When you a come across a complex find() operation that is expensive, refactor it to be simpler or break it down into smaller parts. Pay attention to how many pages you load in memory at once. Don't use find() and children() calls without "limit" selectors when dealing with potentially large sets. With regard to indexing, PW logically indexes all the columns that are likely to be used in find() operations, but if you are querying columns in a table have no index for whatever reason (3rd party module that forgot an index, or column not commonly used for queries), you may need to add one. Most of us never need to do this, but since you mentioned "big and complex" you may be in the territory where you have to apply more consideration to these things.
    1 point
×
×
  • Create New...