Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/10/2017 in all areas

  1. Add Image URLs A module for ProcessWire CMS/CMF. Allows images/files to be added to Image/File fields by pasting URLs or using the API. Installation Install the Add Image URLs module. Configuration You can add MIME type > file extension mappings in the module config. These mappings are used when validating URLs to files that do not have file extensions. Usage A "Paste URLs" button will be added to all Image and File fields. Use the button to show a textarea where URLs may be pasted, one per line. Images/files are added when the page is saved. A Pagefiles::addFromUrl method is also added to the API to achieve the same result. The argument of this method is expected to be either: a URL: "https://domain.com/image.jpg" an array of URLs: ["https://domain.com/image1.jpg", "https://domain.com/image2.jpg"] Example: // Get unformatted value of File/Image field to be sure that it's an instance of Pagefiles $page->getUnformatted('file_field')->addFromUrl("https://domain.com/path-to-file.ext"); // No need to call $page->save() as it's already done in the method Should you have an issue using the method, please have a look at the "errors" log to check if something was wrong with your URL(s). WebP conversion The core InputfieldImage does not support images in WebP format. But if you have the WebP To Jpg module installed (v0.2.0 or newer) then any WebP images you add via Add Image URLs will be automatically converted to JPG format. https://github.com/Toutouwai/AddImageUrls https://modules.processwire.com/modules/add-image-urls/
    4 points
  2. Yeah the pension thing is a problem in a lot of countries, and one of the things (along with holidays/sick leave/perks) that makes working for a company more desirable than self-employment. However, there are pros and cons to both. One of the reasons I want to get into process module development (gonna go through @bernhards great guide) is so I can start looking a the core code and classes and a bit deeper into the system rather than just sticking with the API which is an abstraction away from the underlying PHP. I think once I start to get the hang of that, my skills will certainly improve. I was looking at react and stuff to further my JS, but tbh, am I actually going to use that at the moment? If I need a job at a company, then I need to know this, if I'm making websites for local companies self-employed, then probably not. Same with PHP, I have no idea how to use a framework like laravel. But do I need this? That would take time away from PW module development, which would be a great thing to do, contributing to open source, learning more etc. It's like a cat and mouse game, and I'm most definitely the mouse @szabesz when you say achievable goals, this is something I'm missing which would help for sure. What sort of goals do you set yourself?
    3 points
  3. @SamC You're right about that, the list of php coder jobs requirements published by companies are high and go beyond php such as oop, frameworks, js, sql, git, xml, json, css to name a few. I certainly wouldn't be able to code in all those fields at a company level. But I see the internet economy growing fast year after year with opportunities, jobs, self employment and money to be made. Instead of coding for a company I looked for shops that also have a website or a webshop. The number of shops that also start a website or a webshop is growing rapidly and they need somebody who can set it up and maintain it. Sure, some of them already have somebody doing that but not all of them. It is a matter of checking all the shops in your neighborhood until you find them. I found a health shop where they desperately needed someone to maintain several web shops for them. The php coding level needed for a webshop is not so high as for a company and is perfect for both making a second income and upgrading your coding skills in different fields as you go. Making money on the internet economy is also a good solution for if you are going to get a bad pension when you retire. Getting a pension in spain is uncertain and if you get one you get very little paid. Economy in spain is going bad and the social seguridad here tries to cut pensions where they can. The growing internet economy can be a solution for that. Either you use the money you make for a private pension or you keep on working easy from home
    3 points
  4. I'm in the same boat but I set out fixed and achievable goals for myself. As log as I can reach my goals I do not care too much what other options are out there. I try to keep an open eye on the ever evolving technology but I also have 24 hours a day so we need to take it easy as much as possible. I do not know either but I'm sure I keep improving. Do not think they would surely not be happy to employ you, they just list whatever they think would be perfect for them. However, when there is no one in sight fulfilling those requirements then they are happy to employ the first one who can at least help them out
    3 points
  5. There are tons of tutorials and other staff to learn Laravel. If you keep the PHP way I do recommend digging into that. You'll learn many useful stuff (MVC, OOP, templating, Composer, etc) and it's also relatively easy to grasp. Plus knowing Laravel nowadays for a PHP dev is a must imo. And once you know Laravel, all other frameworks will be much easier to understand. I agree that if there's no project to start using a new tool can be frustrating. I usually decide what to learn and during the learning process a project usually comes to my mind that could be created/rewritten in it, or at least more fun.
    2 points
  6. One ‘issue’ I would say for me learning processwire so far is that I’m not sure how much actual php I’ve learnt. My logic skills have certainly improved, I can see that, but as far as getting a Job as a junior dev with js/php I feel like I’m still so far away! Round here they list requirements that read to me like the requirements for a very experienced dev, not stuff that I’d call “junior”. Can be frustrating. I’m trying to get self employed work as a way to get experience as my normal mon-fri day job has nothing to do with web at all, hardly touch a computer (gotta pay the bills though). This is why I’m always at this every night and weekends. Always looking for that opportunity to do this full time! Lucky I enjoy it so much or I would have given up this dream years ago.
    2 points
  7. I have read some good posts here that make a lot of sense to leave pw with it's api, php and jquery. It was then the main reason why so many moved from evo to processwire. The forum was vibrant and newbies came in every week for the no nonsense, making so much sense functionality of processwire. To me it is always the same story: people just can't leave their hands from something that is working perfectly good. It just has to be stuffed, cranked, pimped or changed in some way or another. Oh "it is evolution" I hear you say "we have to go with the latest stuff that is going around". We'll why not change the use of php for ruby on rails then, that would be something cool, right ? Not ! Please don't crank the core and leave the back end with jquery. Instead we should put our energy in processwire marketing it's - no nonsense, making so much sense functionality.
    2 points
  8. 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
    1 point
  9. Thanks for considering the undo/review option. As for CustomUploadNames, I have adjusted the hook priority in that so you don't need to consider it now in AutoSmush.
    1 point
  10. Really useful module I consider to be this one, I have done something similar on one website but was not as elegant as this one. Thank you for your work.
    1 point
  11. You might want to change the instruction text: You don't login @ wire/, but processwire/ Speaking of login... I used the mentioned username + password, but it always says "login failed". Are you sure it's correct? I had to use this to change pass + login:
    1 point
  12. I agree and php does the job perfectly with processwire for all those cases. If you have a bigger project you can choose from different php frameworks. If your project is really big and needs faster resources ok you can use something like elixer. But wouldn't that be the 5% cases ? PHP is still most wanted. Just look on the internet how many companies are looking for junior and senior php coders. I know a few coders in my neighborhood who make/maintain apps for ios. They all use php for server and cloud communication.
    1 point
  13. https://processwire.com/talk/topic/17707-php-in-2017-rasmus-lerdorf-wearedevelopers-conference-2017/ You might want to watch it from 02:42 PHP was meant to be a templating language only (which it is still today) on top of the business logic written in C but as it turned out, nobody wanted to write and compile C. Sure, these days we have better alternatives when it comes to writing code that can be compiled to machine code but it still requires a lot more setup an configuration than to simply use PHP or Perl which are preinstalled on each webserver, ready to be used by writing a few lines of code or installing a CMS or framework in a few minutes. PHP is evolving and it is still a solid option for small or medium sized solutions and I guess 95% of the web belongs to those categories. Sure, when one is after a career of writing code for big companies (including big governments), PHP might not be the best language to practice. However, freelancers and small companies can still rely solely on PHP as far as running code on the server is concerned.
    1 point
  14. Using namespace Processwire in both files solves the problem. A writing mistake leads to that this approch did not work on the first attempt.
    1 point
  15. It's a bit tricky, without knowing more. Since the error msg says "cannot redeclare", did you try to bootstrap with include_once instead of include?
    1 point
  16. What is that line? _functions.php:59 Do you have PW namespace in _functions.php? <?php namespace ProcessWire;
    1 point
  17. Maybe you want to consider other ways to get some funding. A quick idea is "croudfounding". I'm not suggesting using such a service because as far as I know they cost money, so maybe a dedicated PW forum thread under the topic Beer Garden will do. We send you money the cheapest way possible (bank transfer?) and you update the first post of the thread announcing who sent what. You can assign a random ID to each donator and that way only you and the donator can identify it (in order to keep this info private.)
    1 point
  18. jQuery is fine, but backend / jQueryUi dependencies should be removed. Why use a external form framework in frontend instead of the PW form / inputflieds? I know the form / inputfields work in the frontend, but designed for backend use only and not supported in frontend.
    1 point
  19. lol really? I totally missed that. I mean, home is usually on the logo, but tbh, I didn't even notice the logo in the first place. Actually, I don't think I've ever felt so disorientated on a website.
    1 point
  20. Very flashy Yeah that's a bit of a problem we had with the design concept being delivered to us, but you know how it goes. I think it's trying to solve the different ratio of the images they'd like to use, so it's a feature kind of (one of which I'm not very fond of) Homepage is on the logo. (I know)
    1 point
  21. No we use https://github.com/bobthecow/mustache.php (installed via composer) in PW, along with some custom Mustache loader and a custom autoloader for our controllers. Controllers are of different types like Template, Components, and Elements all extending WireData. So a mustache view can have its own controller class to handle the data but doesn't have to. The PW page template extends our Template controller class and is used to generate the contents of a page. We use some special mustache file for content items that acts like a switch for all the different component to know which partial to include, so we can simply say that this content item gonna use this or that mustache component. It's simply stacking components one after another. At the end, the whole strategy on this setup was that it works pretty much the same on the patternlab side (data as json) and on the PHP side (data as objects, methods, properties and arrrays), or even JS side (json). The patternlab prototype is found here https://opernhaus.ch/prototype/public/ (currently seems a little broken) but it's not at all the typical style guide or in the strict fashion of atomic design, it's used as a prototyping system to create the content items components and dummy pages in a well-defined structure. We build the different page types right in patternlab as much as needed. Each component can have it's own CSS and JS. (Additionally we also use terrificjs as a helper to make modular JS components).
    1 point
  22. you mean this? http://modules.processwire.com/modules/fieldtype-fields/
    1 point
  23. Thanks for your solution @Macrura. I found that the reason why dynamic function is not working. This is because the class of the select field are amended by the repeater so the jquery is not able to select the DOM correctly. What we should do is to fix it by targeting the correct DOM by changing the selector. I can get it to work with already saved repeater page but not the newly added one. I think a listener is needed to attach the on change event to newly added repeater item when we press Add New. EDIT: The newly added repeater item surprisingly fires the js again. It is working fine now. A small bug is that the old repeater items will fire more than once if there are more than one newly added item. Below is the amended JS file for InputfieldPage in quick EDIT: The bug is fixed. I have submited a pull request. Hope we could see this feature in the core soon!
    1 point
  24. Are, you are having a problem after upgrading to PW 3.0.85? If so, please provide some additional information that will help us help you. Thanks.
    1 point
  25. Hi @Mailte, thats bad. There were a pull request added some time ago, that should make the config page a bit more shiny. Unfortunately, now I recognized that it broke the backwards compatibility. I have tested it with PW 2.5.0, where I get exactly the error you described. With PW 2.5.11+ it runs as expected, without errors! So, you may have 2 options now: my prioritized option is to get the WireMail SMTP version 0.2.5, they are known to work with PW 2.4.1 - 2.5.10 too, (https://github.com/horst-n/WireMailSmtp/tree/532dd94752597a4b2b9f3a2c02ef48b21db77f84) or upgrade your pw version to at least 2.5.11 or 2.6.0. But when upgrading your PW version, please first try it in a copy, not on a live site. With and after PW +2.5.11 there were some changes in images variation naming scheme, that may lead to issues like massive images recreations and a lot of orphaned variation files! Or, you have to wait until I get time to rearange the last commits to also work with prior PW versions than 2.5.11, as it was before. I updated the code of the config screen to make it backwards compatible again. Please download / install the latest module version 0.3.0 to use it with PW 2.5.3 https://github.com/horst-n/WireMailSmtp or http://modules.processwire.com/modules/wire-mail-smtp/
    1 point
  26. Some backgrounds about the wp-login Jonathan mentioned you'll find here: https://processwire.com/blog/posts/optimizing-404s-in-processwire/ A must-read IMHO.
    1 point
  27. Yeah! awesome the active part makes it even better. 'currentItemClass' => "active"
    1 point
  28. If you're running AdminOnSteroids I think you can do it there as well.
    1 point
  29. https://modules.processwire.com/modules/process-google-analytics/
    1 point
  30. Quick update: there's now a 2.0 branch and 2.0 milestone for this module at GitHub. For the time being the 2.0 branch is identical with master branch, but it's a start. I'm going to get another project I've been working on out there today, and after that I should have some time to work on VersionControl 2.0
    1 point
  31. For fun, you could also create a wp-login.php file in your PW root directory so that hackbots get confused (or redirected away, or just show a blank page). Here's an example of some random website that implements this technique: http://processwire.com/wp-login.php If you've ever looked at a website's access log files, you'll see that that URL is hit all the time. Easy way to prevent a bunch of 404s.
    1 point
  32. processwire already makes it very hard for attackers to just guess username+password. and you can even adjust those settings:
    1 point
  33. Another question: Is PW a great peace of software? If yes, hmmm, - you know it's build in PHP. In short: there may be some better or less better programming languages regarding to use cases, and yes, there are also some points in PHP that are bad, like in other languages too. But all that doesn't take to much account in comparision with what a developer do with it. So, it depends on the developer to 90% and 10% on the programming language. just my 2 cents
    1 point
  34. If Jquery is removed i'd like to see plain vanilla js and no framework in between. Just like like there is no PHP framework in PW.
    1 point
  35. Thanks, I'll check them. I meant that magicline is removed by default by PW, you will need to edit the field in question, and on its Input tab go to the bottom and under Remove Plugins delete "magicline" text.
    1 point
  36. Update: Blog 2.4.0 Changelog Fixed SQL error thrown when comments disabled and accessed blog dashboard. Thanks @justb3a Added capability to copy demo JS and CSS files on blog install as well as remove them on uninstall. Full compatibility with ProcessWire 2.8.x and ProcessWire 3.x. Thanks to @BitPoet Happy then to announce that I've tested and can confirm that Blog is compatible with ProcessWire 2.8.x and ProcessWire 3.x
    1 point
  37. Hi dragan, unfortunately not. I need to do a complete rewrite of the module. As i need it for all my projects it is on top of my todolist for the next year. I'm still not sure if I should release it free or as a pro module... But I hope I can release something around march 2018...
    0 points
×
×
  • Create New...