Jump to content

Leaderboard

Popular Content

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

  1. This week's version adds the new Uikit 3 admin theme to the core! Plus we've got some nice upgrades our built-in Password field. https://processwire.com/blog/posts/processwire-3.0.83-core-updates/
    10 points
  2. 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
    10 points
  3. 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
    9 points
  4. https://processwire.com/talk/topic/17707-php-in-2017-rasmus-lerdorf-wearedevelopers-conference-2017/ +1 Progress can be great, fiddling with new stuff is fun but acquiring new skill takes time – for me a lot of time – so I try to stick to well tested and proven tech. For example, when I was young and bold I used to upgrade Mac OS as soon as the new version came out. These days I wait at least for six months before I do it, in order to watch and learn. There are enough beta testers out there, I'm no longer one of them.
    7 points
  5. I have a site that I oftentimes sync the live database to my dev database (I made a bash script to automate the process). I generally like to "clean" the database once it has been copied over to my dev machine, which involves running a script that deletes 15,000 pages (orders in my case), among other things. Doing this using $page->delete() in a script (which I'm running through the command line for added performance), takes about 30 minutes which is painful. I thought it through further and I came up with the following relatively simple script that can achieve the same result in a few seconds! It achieves this speed by running MySQL delete queries directly, bypassing PW's API. Here it is (modify accordingly): <?php namespace ProcessWire; ?> <?php include(dirname(__FILE__).'/index.php'); // bootstrap pw $order_ids = $pages->findIDs('parent=/orders/,template=order'); if(!count($order_ids)) exit; $order_ids = implode(",", $order_ids); $t = $templates->get("order"); foreach($t->fields as $f) { if( $f->type!="FieldtypeFieldsetOpen" && $f->type!="FieldtypeFieldsetClose" ) { $table = "field_".$f->name; $database->query("DELETE FROM $table WHERE pages_id IN ($order_ids)"); } } $database->query("DELETE FROM pages WHERE id IN ($order_ids)");
    6 points
  6. Depends on a) your point of view and b) what you're doing with it. While I might recommend something else for a programmer just starting out, that's mainly because PHP is a major abstraction layer and most PHP devs never get a proper idea about all the stuff that goes on behind the scenes. Also if you're doing something requiring a specific set of tools – such as working with big data and statistics – you'll probably find a language that is better suited for that particular task. That being said, PHP is a decent language if you're primarily working on the web. It's rich in features, well supported, properly maintained, very widely spread, and so on and so forth. Additionally many online "this is why PHP sucks" lists focus on issues found from early PHP 5.x releases – or, better yet, PHP 4. These days there are a ton of things going for PHP, and not that many going against it. (Much of this could also be said about WordPress, but... let's just not go there. It's not the same thing.) ... and, like @horst pointed out, in many cases the language isn't the most important thing to consider. You can do a lot with PHP, and the good thing is that (if you're doing something it's suited for) you can usually get it done fast. Surely there are languages that have technical advantages over PHP, but those usually apply to either specific situations or somewhat extreme cases, such as "I'm running Facebook"
    4 points
  7. I have a forked version at https://github.com/matjazpotocnik/ProcessWire-AIOM-All-In-One-Minify that includes a lot of pull requests and fixes from several contributors. Test on dev site first!!!
    3 points
  8. There was a recent post somewhere in the forum of a video of Rasmus briefly explaining (sort-of) why PHP was "bad" at the beginning, and how far PHP has come in 2017 with PHP 7+. I personally love PHP despite its reputation because it's almost as old as the internet itself, and has endured with it. While that's not directly a measure of being a good programming language, it's a measure of stability that means anything I learn doing in PHP will be useful for years to come, unlike how some modern frameworks/language/libraries come and go. And like horst said, there are always good and bad coders regardless of the language. Just like how they hail Python as a good programming language, but I've seen some people write some horrible stuff in it, ProcessWire is probably one of the best things I've come across that's written in a "bad" programming language.
    3 points
  9. I've read many bad things about PHP over the years and actually wonder (from an experienced dev point of view) whether there's any truth in it? As a inexperienced programmer, you hear stuff like "the language doesn't matter, just learn to program". On the other hand, you hear, "don't choose language X or Y". You also face the choice of "am I going to learn a language that sucks?" which can be a total brick wall to a newbie. In PHPs case, the internet consensus is that it sucks almighty balls. I was reading this earlier: https://whydoesitsuck.com/why-does-php-suck/ Do devs get annoyed with a language because they don't fully understand it, or because they expect to be able to program in the same way they do in another language? Do they focus too much on the tools rather then end product as mentioned here: https://blog.codinghorror.com/php-sucks-but-it-doesnt-matter/ Why do people comment on posts like the above with stuff like "Dynamic, weak typing sucks. I won't say more"? Is confirmation bias that important to programmers? Remember when Ruby was popular? Can I see a trend here... How are inconsistencies in PHP any different from the total weirdness of JavaScript, which is super popular? I'm well pleased with my sites I built over the years, they could be powered by fairy dust for all I care. Anyway, just after a few thoughts here.
    2 points
  10. Thank you Ivan, I do appreciate it. I will have time on the weekend to implement my version. I might even turn it into a module, who knows? (I certainly don't ).
    2 points
  11. The module should work ok now on AdminThemeUiKit. The only issue is if you try and use a narrow/mobile view, the tabs may overlap, b/c to get them to be on the right, they have to be absolutely positioned.
    2 points
  12. Thanks both. I guess I will have to finally try AOS. I've monitored it's progress (since it was published) and I know everyone loves it! The great thing about ProcessWire, besides the core software, are the great enhancements (contributions) from the community. There's a lot of very useful stuff being produced on a constant basis. Plus there are many people from everywhere generously working together to improve things.
    2 points
  13. There you go: <?php $feed = $modules->get('InstagramFeed')->setImageCount(8)->getRecentMedia(); ?>
    2 points
  14. Interesting Conference / Talk from Rasmus Lerdorf, creator of PHP.
    2 points
  15. This is the new topic for the Settings Factory module (formerly known as Settings Train). Repo: https://github.com/outflux3/SettingsFactory I'm not sure what versions this is compatible with, it has only been tested on 3.x branch; it is not namespaced, and i'm not sure if namespacing is necessary or a benefit for this module; if any namespace or module gurus can weigh in on this, let me know. I'm also not sure if there needs to be a minimum php version; I have one live site using this now and it's working great; But before submitting to mods directory, would be better if there was some additional testing by other users.
    1 point
  16. Here is a new module for ProcessWire 2.1 that imports pages from a CSV file. By default it will create new pages from data in the CSV file, but you can also configure it to modify existing pages too (existing pages that have the same title). Please give it a try and let me know how it works for you and if you run into any issues with it. This module is something I've had in the works for awhile, and regularly use on various projects, so figured I should clean it up a bit and release it. Also attached are a couple screenshots from it. How to Install: 1. Download from: https://github.com/r.../ImportPagesCSV 2. Place the file ImportPagesCSV.module in your /site/modules/ directory. 3. In ProcessWire admin, click to 'Modules' and 'Check for new modules'. 4. Click 'install' next to the 'Import Pages CSV' module (under heading 'Import'). Following that, you'll see a new menu option for this module on your Admin > Setup menu. Supported field types for importing:* PageTitle Text Textarea (including normal or TinyMCE) Integer Float Email URL Checkbox (single) *I'll be adding support for multi-value, page-reference and file-based Fieldtypes in a future version.
    1 point
  17. ok sure - thanks for using and testing these; another small change may be needed once it is tested with the latest version of AdminThemeUIKit, based on some info in the blog post.
    1 point
  18. I think Ryan is talking about setting the sort on the parent page of the repeater page, not for a template. So you locate the parent page under Admin > Repeaters and set a sort on the Children tab. But... this doesn't work because when setting an automatic sort like this it doesn't actually change the "sort" value of the pages in the database, which is what a repeater field uses to determine the sorting within the inputfield. A related post that might be useful:
    1 point
  19. I'm not sure there is a real problem to troubleshoot. When I first got the PrevNextTabs upgraded from version 6 to 7, the tabs overlapped on my display with where the Admin Help Tabs were located. I changed to the Reno Admin theme and then everything worked. I then changed back to AdminUIKit theme and the PrevNextTasbs were to the right of the screen and working properly. I had a combination of things going on at that time (working on my Mac and a new Windows 10 machine) updating other ProcessWire websites and other monitoring tools. I chalked it up to possible operator error, possible cached after effects or a combination of the two. I was only glad it worked. PrevNextTabs is a time saver here. I started not to mention anything at all, but said what the heck. Thanks for 2 quality products, which I use every day.
    1 point
  20. Seems to me that you should take over this project and the modules directory should point to your fork. Is it time to PM @David Karich and get the ball rolling
    1 point
  21. Should be in core distribution. But you have to install it first. It is called "ProFields: PageTable" afair.
    1 point
  22. Ok. 1. We need to generate a unique token for a user and store it. The simple way to do that is to add a field to user page (login_token in the example). To make process easier we make a method for that via hook: // site/init.php $wire->addHook("User()::getToken", function(HookEvent $event) { $page = $event->object; if (empty($page->login_token)) { $page->of(false); $page->login_token = generateToken(12); $page->save(); $page->of(true); } return $event->return = $page->login_token; }); The genereateToken() function is yours to implement as you wish. 2. Now we can generate a link: $link = $page->httpUrl . "?user=". $user->id . "&token=". $user->getToken(); 3. Finally we need to handle those parameters and make user autologin: // site/templates/_init.php if ($userToLoginId = $sanitizer->int($input->get->user)) { $url = $page->url; $userToLogin = $users->get($userToLoginId); $tokenToLoginWith = $sanitizer->text($input->get->token); if ($userToLogin->id && $tokenToLoginWith && strcmp($userToLogin->login_token, $tokenToLoginWith) == 0) { $loggedInUser = $session->forceLogin($userToLogin); if ($loggedInUser) { $user = $loggedInUser; }; $session->redirect($url); } } We can then nullify user token if we want it to be only a one-time ticket. I rewrote whole lot of stuff, so might not work straight away, but surely you can fix it @szabesz)) Hope I am not missing something essential.
    1 point
  23. Hi @AndZyk, regarding Cron, please look here: This can handle all kind of PW things within a central cron config.
    1 point
  24. Here is another working method, that only shows changes once after save. It is based on this post from Ryan. //Compare before and after values $pages->addHookAfter('saveReady', function($event) { $page = $event->arguments('page'); if(!in_array($page->template->name, array('template1', 'template2'))) return; //restrict it to these templates only $fields = array('field1','field2'); //check only changes on these fields $this->wire('pages')->uncache($page);//uncache new page $oldPage = $this->wire('pages')->get($page->id);// get old page $changedfieldsarray = array(); foreach($fields as $field) { if (($oldPage->$field) != ($page->$field)) { //this is the comparison between before and after $changedfieldsarray[] = $page->fields->get($field, true)->label; } } if(count($changedfieldsarray) > 0) { $fieldnames = implode(", ", $changedfieldsarray); $this->warning(sprintf(__("Following fields have been changed: %s"), $fieldnames )); } }); It uses the uncache method to compare stored values from the DB and the new ones entered in the form. This informs the editor only once directly after form submission. If the editor push the save button once more and nothing was changed, the message will not be shown again. This is the main difference between this and the previous method. Attention: This method uncaches the page and therefore all entered values will be cleared after pressing the submit button and no sucessfull saving of the page - so use this method with care.
    1 point
  25. There is often a thin line between madness and genius. For example Einstein has his dark side too. I'm glad they are not my father. We can learn from the good and the bad.
    1 point
  26. Hey, @szabesz! It was done. Actually It was pretty easy (at least the way we implemented it without much security overthinking). Would be happy to share code if needed. But it is essentually what @LostKobrakai wrote.
    1 point
  27. 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
    1 point
  28. Thanks Robin, this worked well and avoids the approach of having to hack PW and make InputfieldPage::getPageLabel hookable. Note: In order for it to work, you must edit the field's "Label field" under the "Input" tab. It must be changed from "title (default)" to "Custom format (multiple fields) ..." and a value must be put in the "Custom page label format" field, even if it's just a temp value (I put "x").
    1 point
  29. 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
  30. 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
  31. Just to clarify... a) you wanna integrate this tool into processwire? or b) you wanna use this script beside a processwire website?
    1 point
  32. 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
  33. yeah, i was just starting to write a reply here, then dave was first and then i decided to start a new topic, because we got offtopic here and i'm sure it's valuable information for others as well. here is the tutorial:
    1 point
  34. 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
  35. 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
  36. 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.
    1 point
  37. I learned with ProcessWire that the Internet could work just fine before single page applications I'd love some parts of PW to work as a SPA module, for example, a kind of template-field creator where you can create in a very agile way template-field relationships and the template context overrides. A kind of "template designer".
    1 point
  38. JQuery simplifies things for JS, just like PW does for PHP cms. You could use vanilla JS or another framework that would make things harder for devs. Would you use PW if it were more complicated to use or so basic like pure PHP? I think jQuery is still the right tool for PW admin, or at least I don't see any real advantages using another (or using none).
    1 point
  39. Just my opinion, but I don't quite understand whats the benefit to get rid of one dependency to immediately replace it with another dependency. I have no experience with VueJS or Angular yet, but as far as I can see, you would be completely dependent on one of those frameworks. In this case I'm maybe a little bit old school, but I like jQuery and also don't understand, why everybody wants to get rid of it as fast as possible. Also the comparison of ProcessWires API with jQuery was on of the first things, that got me interested. Luckily it is not our decision to decide.
    1 point
  40. Good to see I'm not the only one scratching my head over the current jQuery-is-bad movement. To me, wiring in a full-fledged MVsomething framework only makes sense if the complete data exchange is abstracted away, otherwise backend code and frontend (speak backend UI) logic will get even tighter bundled (or bungled?). This would mean that all backend calls would need to be some kind of RESTful using JSON, XML or something along these lines, and plainly, PW isn't at that point right now and getting there would need quite a bit of work. I'm not a real wiz when it comes to MVC/MVVM frameworks, but I do have some experience building complex RIAs, starting by building everything on top of ExtJS (2 and 3) in the good old days and later rolling my own two-way bindings for nested data structures. I've recently delved a bit into the currently trending frameworks, and I was utterly appalled by the unnecessary complexity, semantic mumbojumbo and lack of essential features each of those exhibited in varying degrees. Don't get me started on the massive breaking changes introduced in major frameworks I see every year. I've got one really complex app that needs a larger overhaul next year (warranted after 8 years, I feel), and I've come to the conclusion that it will be simpler, faster and more concise to build everything without any framework besides a lean CSS library and perhaps jQuery, especially if I want it to run the following 5+ years without finding myself using an orphaned framework. If the PW backend could be completely JSONified, I'd be all for that, but even then, I'd currently prefer a framework-less default interface. Any MV* solution could then be an alternative, just like current admin themes.
    1 point
  41. Cool JS frameworks will become history just because sooner than later someone releases just another even cooler JS framework rendering the previous ones obsolete. BTW, the WordPress guys have been debating for months or maybe for more than a year which one to pick... On the other hand, jQuery is still going strong as others have also pointed it out above.
    1 point
  42. I'm very interested why foremost it's age is a good reason to turn away from jQuery. It's no new cool kid on the block, but it is matured, very well documented and wide spread. It was no "dead end" like some of the other "cool" JS frameworks have been. It feels like a good ol' companion. It's not the right tool for every job nor a holy grail, but in pretty much use cases it works well and affordable in a sense that there is no steep learning curve.
    1 point
  43. For me, the reality is that when I use "vanilla" scripts, each one coming from different developers with its own code for dom traversal and manipulation, yes they are in plain js without dependencies ... but with a tons of redundant code for the same tasks ... so when I finally managed to finish a complex website with sliders, accordions, calendar, date selectors, drop-down menus, parallax, forms and looong, etc. each has its own code to select nodes, add/remove classes and looong, etc. I have a lot of repetitive code, for what? For a trend? yes it's true jQuery 1x is obsolete and fat due to the support of old browsers, but jQuery 3x is as slim as you need. The reality is that we need a library for common tasks (give it the name you want). For today jQuery allows me to do simple tasks on a regular website without additional efforts (ie a website like processwire.com, not a web application, or a project for Córdoba).. well.. if someone create that library, pleeeease use an API similar to PW/JQUERY.. it's so easy to use and learn for us, the non pro developers!!
    1 point
  44. Since i typically maintain separate pages for those types of media (in a media library for every site), it is just a matter of setting up page select field. I use selectize so that the user can see what they are selecting. Also if i use a page for logo, then they can update the logo from the media library without having to change the setting; or they can add several logos to the media library and then select which one to use on the settings page. I don't yet know how to support image/file fields natively in this module, although since the settings pages themselves are pages of template admin, it might be possible. I was actually able to use both image and file fields and upload an image, however there are still errors with the value of the inputfield not yet working... In other news, here are some new screenshots of settings panels using UiKit theme, including a working example of using WireTabs:
    1 point
  45. I haven't tested it much but it looks like you can hook Page::getMarkup() $wire->addHookAfter('Page::getMarkup', function(HookEvent $event) { $page = $event->object; if($page->template->name !== 'TEMPLATE(S)_USED_IN_YOUR_PAGE_FIELD') return; $out = $page->title; // add more stuff to $out using $page $event->return = $out; });
    1 point
  46. it is, but not much written about it https://processwire.com/api/variables/user/ What you see is the pagename, it's just a page object, as it extends Page. If you give a user a permission, you could check if the user has that permission. As permissions is the parent of a permission, you could get that permission by page name. (Pagenames under the same parent are unique). It's a permission you could set on template level. You could ask if $page->editable() (for current loggedin user), which returns true or false. So this can be done on front-end and happens in the backend to. It is used for example in the hookable ProcessPageListRender::getPageActions. (Pages list) So, if the user has edit rights, show the edit button after the page.
    1 point
  47. $f = new Field(); $f->type = $this->modules->get("FieldtypePage"); $f->name = 'mypageselect'; $f->label = 'Select Page'; $f->derefAsPage = FieldtypePage::derefAsPageOrNullPage; $f->inputfield = 'InputfieldPageListSelect'; $f->save(); or $f->derefAsPage = FieldtypePage::derefAsPageArray; $f->inputfield = 'InputfieldAsmSelect'; etc
    1 point
×
×
  • Create New...