Leaderboard
Popular Content
Showing content with the highest reputation on 01/06/2017 in Posts
-
This post includes coverage of the latest weekly core dev version, an update on ProDrafts, and more. It's a bit of a short post this week due to a change in schedule today, so some of the planned content for this week will be in next week's post. https://processwire.com/blog/posts/processwire-3.0.48-core-updates/7 points
-
https://blog.axosoft.com/2016/12/29/top-20-developer-tools-2016/ Might be some inspiration in there! I have been using Gitkracken for quite a while now - I am liking it quite a bit (although it's a little unstable at times). Postman looks pretty cool! PS Another longer list: https://stackshare.io/posts/top-developer-tools-20166 points
-
Hello Fellow forum members. I wanted to share two links to a guide and a cheatsheet concerning Crontab and Cronjobs. This is a result of me doing some research in how Cronjobs work and how to use it and i thought i share for other beginners use. So the guide that got me started and is a good reference is: A Comprehensive Crash Course Into Cronjobs (sitepoint) And also i found this sort of cheatsheet and database of cronjob configurations handy: Corntab - the Crontab GUI I hope these tips can help any beginners like myself get up and running with cronjobs.5 points
-
In light of the above, I've been working on a port of Typset from JS to PHP: https://github.com/mikerockett/php-typeset It doesn't include hyphenation, but does add features not found in the original JS version. It's currently in alpha, and I'll make a Textformatter for it when it's stable. I haven't done benchmarking between Typography and Typeset, but I can already feel that Typeset is faster. Sensible (common) defaults are set. If you're keen to have a look, please let me know what you think. ?3 points
-
2 points
-
// show pagetable field only if there are items in it $pages->addHookAfter("ProcessPageEdit::buildFormContent", function($event) { $wrapper = $event->return; if (!$wrapper->has('NAMEOFYOURPAGETABLEFIELD')) return; if ($event->object->getPage()->NAMEOFYOURPAGETABLEFIELD->count) return; $wrapper->NAMEOFYOURPAGETABLEFIELD->collapsed = Inputfield::collapsedHidden; }); This is more reliable as it does also work if page table entries are not stored as children or if there are other children for the page besides the pagetable ones.2 points
-
Hi @Ivan Gretsky - I have implemented this - now both the modules settings and the Setup > AdminActions are split into "Site" and "Core" tabs. I haven't committed just yet. I will PM you the new version. Would appreciate it if you could test and let me know if it suits your needs and if you find any problems. Thanks!2 points
-
If you use the init.php introduced in PW 2.6.7 you can add this piece of code to the init. php: // show pagetable field only if there are items in it $pages->addHookAfter("ProcessPageEdit::buildFormContent", function($event) { $wrapper = $event->return; if($wrapper->has('NAMEOFYOURPAGETABLEFIELD')){ if ($event->object->getPage()->numChildren > 0) return; $wrapper->NAMEOFYOURPAGETABLEFIELD->collapsed = Inputfield::collapsedHidden; } });2 points
-
Afaik the most mature tool for async php is reactphp. But really async code is not a peace of cake and there are probably better languages out there than php to execute code concurrently.2 points
-
kongondo beat me it may seem complicated in the beginning, but once you get the concept it's really easy and straightforward. you just have to look a bit into the code to know what is going on behind the scenes. take my code example, it's easy: // attach a hook whenever a page edit form is built // this happens in the class "ProcessPageEdit" in method "buildform" // see github how this method looks like: https://github.com/processwire/processwire/blob/master/wire/modules/Process/ProcessPageEdit/ProcessPageEdit.module#L588-L595 $this->addHookAfter('ProcessPageEdit::buildForm', function($event) { // $event is the hookevent object; it holds all necessary data to execute all kinds of actions // https://github.com/processwire/processwire/blob/master/wire/modules/Process/ProcessPageEdit/ProcessPageEdit.module#L591 // here you see that the method gets 1 parameter and this parameter is the form, so if you want to get this form just do this: $form = $event->arguments(0); // to get the field of your form just do the following // see https://github.com/processwire/processwire/blob/master/wire/modules/Inputfield/InputfieldForm.module // or https://processwire.com/talk/topic/2089-create-simple-forms-using-api/ $field = $form->get('yourfieldname'); // now we want to do something based on the page that is edited // that is a bit different than in template context because we are VIEWING an admin page, whereas we are EDITING a different page // we want to know the template of the EDITED page, so let's get it... // $event->object is the class where the hook is attached. in our case "ProcessPageEdit" // to get the edited page this class has an own method: https://github.com/processwire/processwire/blob/master/wire/modules/Process/ProcessPageEdit/ProcessPageEdit.module#L2009-L2019 $page = $event->object->getPage(); if($page->template == 'template_a') $field->label = "this is field label on template a, it is " . date("d.m.Y H:i:s"); elseif($page->template == 'template_b') $field->label = "this is field label on template b, it is " . date("d.m.Y H:i:s"); else $field->label = "other template, it is " . date("d.m.Y H:i:s"); });2 points
-
2 points
-
This is starting to become an awesome CMS of mine. Thanks.2 points
-
It's an old video, but shows you about template context field settings: https://processwire.com/videos/field-template-context/2 points
-
Maybe I'm misunderstanding something, but a Page field seems ideal for what you want to do. You leave the Song pages where they are (under Songs in the tree) and then select them in a "Songs" field in your "Playlist" template. Several of the available inputfields for a Page field allow you to sort pages in the field - Autocomplete is a good option for selecting from a large number of pages but you could use AsmSelect or some other inputfield if you prefer. In the screenshot below, imagine these "vegetable" pages are instead songs. This way you don't need any child pages under your Playlist pages. P.S. I think you forgot to add your screenshots.2 points
-
Rather than making duplicate Song pages as children under the playlist, could your Playlist template have an Autocomplete Page field "Songs" where you select Song pages?2 points
-
The Console Panel now has a History stack and a separate Snippets stack! Hi everyone - this has been a long time coming. It was originally suggested by @bernhard back in early November. I want to thank @bernhard for the idea and feedback on draft versions, and @tpr who has contributed many ideas, style suggestions, and code to this functionality - sincere thanks to both of you! Snippets are automatically saved to the tracy config settings entry in the modules database table so that they are available on other browsers/computers have a dedicated save button - they are not saved automatically when running code save button only available when loaded snippet code is different from saved version so you know whether you have made changes has the ability to sort alphabetically or chronologically (date modified) no limit of number of snippets stored snippets can be deleted - a ✖ icon appears when you mouseover a snippet in the list History items are saved to local storage automatically saved when you "run" code comes with "Back" and "Forward" arrows for moving between history items currently stores maximum of 25 items - let me know if you think this needs adjusting Some other miscellaneous changes when running code, output is now appended to the results panel (like your browser dev console) you can used ALT/OPT+Enter keyboard shortcut to Clear and Run the "Clear" button now clears the results panel, but leaves the code intact Future ideas ability to easily export/import snippets to stack your ideas Please let me know if you come across any bugs or weirdness with anything - it's still pretty early stages!2 points
-
TextformatterTypographer ⚠️ Archived: This module is archived. Feel free to fork it if you would like to take it over. A ProcessWire wrapper for the awesome PHP Typography class, originally authored by KINGdesk LLC and enhanced by Peter Putzer in wp-Typography. Like Smartypants, it supercharges text fields with enhanced typography and typesetting, such as smart quotations, hyphenation in 59 languages, ellipses, copyright-, trade-, and service-marks, math symbols, and more. It's based on the PHP-Typography library found over at wp-Typography, which is more frequently updated and feature rich that its original by KINGdesk LLC. The module itself is fully configurable. I haven't done extensive testing, but there is nothing complex about this, and so I only envisage a typographical bug here and there, if any.1 point
-
Hi guys I need an estimate for the following task: I developed a job candidate application in ProcessWire and need an extension to a Lister Pro Page. My customer wants to display a summary table of the filtered data like in the attached screenshot. When you filtered the view, that summary should show how many candidates have which status according to the actual filtered view. If you change the filter, the summary table has to be updated also. Who can accomplish this task and what would it cost? I first need an estimate to tell it to my customer. If he says the price is ok I will provide you with FTP Data to a dev server version of that tool. Thank you in advance.1 point
-
@Speed - if this is on a non local server, you will either need to force to "Development" mode (change from Detect), or check the "Force superuser development mode" button. Tracy must be in development mode to show the debug bar. If it's a remote server, DETECT will determine that it should be in PRODUCTION mode.1 point
-
You could FTP your files to an "uploads" directory and them import them to a field on a page using the API. For example, to add PDF files in /uploads/ to a field named "files" on the Home page... // function for adding files function addFiles($file_extension, $page_id, $files_field_name) { $files = glob( wire('config')->paths->root . "uploads/*.$file_extension" ); $p = wire('pages')->get($page_id); $p->of(false); foreach($files as $file) { $p->$files_field_name->add($file); } $p->save(); } // call the function with arguments to suit addFiles('pdf', 1, 'files'); Remember to delete the files from the uploads directory after each successful import.1 point
-
1 point
-
Yes, Tracy Debugger is a module which can help you find problems with your code or in others code as in this case too. Once you install it and see the "Debugger bar" (refer to the introduction post you linked above) then if you uncomment those lines I mentioned you should see the values if you click on the bar. This way you can see why the path/url differs.1 point
-
ProcessWire doesn't care a lot about what files are in those folders (try removing a file uploaded via the backend). It only really cares about what data is stored in the db for the file field – otherwise it couldn't distinguish multiple file fields per page. If you have big files you won't want to upload via the backend you can upload a small fake file instead (same name as the big one) and afterwards replace the file via ftp.1 point
-
Quick update to the Strict Mode and AJAX calls. I just added a new config setting that allows you to turn on Strict Mode for just AJAX calls. This is helpful if you want to know for certain that an AJAX call returned a failure. Remember that Tracy intercepts Notices and Warnings and displays them in the Errors panel. As I mentioned a little while back this can result in an AJAX call being successful when Tracy is running, but failing when it's not because the notice/warning breaks the AJAX response. This new option will be good if you're not sure you'll pay attention to the red alert in the Errors panel.1 point
-
Mmhh! Your version seems not to work: $itemnumber = $event->object->getPage()->NAMEOFYOURPAGETABLEFIELD->count(); $this->message("Number of items:{$itemnumber}"); Returns always 0 in the message in my case.1 point
-
Ok, thanks for the hint. In my case I have only direct children in the page table field, but I have changed it to your snippet.1 point
-
@szabesz you made my day . To be honest, I do not think you were dumb not to see it properly organized. It is just to have the proper tools, some willing to achieve the task and for sure some support from friends and other devs that can have the proper approach. I think it would work the way I see it, but thinking and having it done are two different things. I will definitely see the paginator as I am not sure the search results would be paginated (haven't tested them yet as I did not have added 10-20 pages matching the same search term etc.) But this is on the way So far I will start adding some topics and see how to point them out on the main page. Who knows, maybe the approach would be useful for the others one day that are struggling to get the things done and need a similar structure. If it was done on Wordpress, it would be done in PW and would be way more elegant as a code as well as a logic1 point
-
1 point
-
Well, it seems like you forgot to define that function or you made a syntax error or you called it wrong(_head file line 2). Maybe you can make a screenshot/gist/whatever of that function and where you want to use it and paste it here?1 point
-
Nice example! Will soon dive deeper into this. In any case, a big thank you!1 point
-
...and that is just the tip of the iceberg just an example: put this inside your /site/ready.php $this->addHookAfter('ProcessPageEdit::buildForm', function($event) { $form = $event->arguments(0); $field = $form->get('yourfieldname'); $page = $event->object->getPage(); if($page->template == 'template_a') $field->label = "this is field label on template a, it is " . date("d.m.Y H:i:s"); elseif($page->template == 'template_b') $field->label = "this is field label on template b, it is " . date("d.m.Y H:i:s"); else $field->label = "other template, it is " . date("d.m.Y H:i:s"); }); have fun with processwire1 point
-
1 point
-
Hi @kongondo For the moment I made some temporary additions to the MediaManagerActions.php file, so that it saves the title in all lang tabs. I added this lines to the code: actionEdit() foreach ($this->languages as $lang) { $p->title->setLanguageValue($lang, $sanitizer->text($media['title'])); //temporary by Nukro } //$p->title = $sanitizer->text($media['title']); actionCreateMedia() foreach ($this->languages as $lang) { $p->title->setLanguageValue($lang, $this->actionRenamer($title, $titleFormat)); //temporary by Nukro } //$p->title = $this->actionRenamer($title, $titleFormat);// @see @todo in actionRenamer() I made this because my customer needs it urgently. Greetings Nukro1 point
-
Hi, This is quite understandable (I'm often in this very same boat too), but if you take a look at the code, you can see that it is basically a simple helper so that you do not have to reinvent the wheel over an over again. BTW, I did not have the time to read through your posts, but looking at the screenshot I remember seeing it in the past, I mean using this interface for some time and what I recall is that I hated it, because I could not find my way around the articles easily, it felt like a big mess of hyperlinked docs, and it was hard to recognize which article I have already read. (What sort of system/implementation it was I do not know). Maybe I was just to dumb to get the logic behind it, I do not know, but I'm glad I do not have to see it again.1 point
-
1 point
-
I misread your post and thought you meant Select Multiple rather than Page List Select Multiple - the latter is fine for thousands of pages as it is ajax-paginated.1 point
-
Media Manager might be the slickest option for this. Not 100% sure but I think it allows you to upload new media directly from a page being edited. If you want a no-cost solution you could look at adapting this module from @mr-fan, which is based on code by @adrian https://github.com/mr-fan/AutoImagePages But it doesn't allow for the uploading of new files directly from a page being edited - you must upload from the parent page of the files/images branch.1 point
-
How about letting a dedicated AdminActions.module handle all the serious work (e.g. like WireActions), so actions are also triggerable via the api? I can imagine that some actions might be useful to be run as part of a migration (shameless plug :D) and not just via the backend.1 point
-
If you don't need the links as such in the source HTML, you could also consider using TextformatterMakeLinks.1 point
-
I've never had a blog before - and it's about time I had one now: blog.rockett.pw Introductory post: https://blog.rockett.pw/posts/first ?1 point
-
My personal/professional website as designer (UI/UX, motion graphics) and developer. The process of this thing took ages and there's still a lot of content missing, it's always a hassle with your personal websites. But building it with PW was a breeze, I really love all the flexibility the system provides. I can't imagine using any other cms in the future… Check it out: www.thomasaull.de1 point
-
Chat bots are the new RSS feed, you need to make one for each of the 40 different clients xD1 point
-
This functionality is now available via the "Delete Unused Fields" action in my new Admin Actions module:1 point
-
Sounds like a job for the API Delete fields by name: <?php $field_names = ['field1', 'field2', 'etc']; foreach($field_names as $field_name) { $field = $fields->get($field_name); $fields->delete($field); echo "Deleted field '{$field->name}'<br>"; } Or maybe delete all unused fields: <?php foreach($fields as $field) { if( count($field->getFieldgroups()) === 0 ) { $fields->delete($field); echo "Deleted field '{$field->name}'<br>"; } } Or you could make a form displaying checkboxes for each unused field and select which to delete, similar to what @diogo does here for templates.1 point
-
Last summer we hosted big event website (also very heavy site with lots of big images, videos, embeds ets), that got well over 300 000 visits during weekend. We prepared for that with combination of ProCache + Cloudflare and we didn't get any reports of performance or availability problems (first time ever said the event organizer and it was also first time Avoine hosting the site). We were using the paid plan of Cloudflare though. It saved tons of servers from our side (just like ProCache did also).1 point
-
One of the reasons for table per field design is definitely performance.1 point