Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/26/2016 in all areas

  1. Once again heads up, everyone, I just now updated the “stable” German language pack for 3.0.34, which – as usual by now – means a lot of work, mostly by Manfred, (translating all the things) followed by a little work by me (merging). As usual, thanks to all the contributors, especially Manfred for his tireless efforts and Robert, who took the time to iron out a looooooot of small mistakes. Everyone, enjoy and please report anything you may find wrong or worth improving, ideally in a pull request at https://github.com/yellowled/pw-lang-de, please.
    5 points
  2. FWIW, I don't do it to enforce MVC at all, which IMO is often overkill for typical web projects. I also don't have the kind of duplication you've illustrated for each template, with e.g. both home.php AND home.inc files. I route everything through a single main.php file. That file is just a series of includes for various global functions and configuration, and at the bottom I use output buffering to include the page-specific view and wrap it with a global base template. I prefer doing it that way so that all of the global markup is in a single file rather than split across separate "head.inc" and "foot.inc" includes (which then have to live in every template file). I also like having view-specific js and css assets together in the same folder as the view. That makes more sense to me than organizing assets by file type. I could just as easily have used wireRenderFile() instead of output buffering. I provided that as the example simply because it's available in PW and this is a PW forum. I also tend to store additional properties in $page rather than creating global variables (e.g., $page->foo = 'bar' instead of $foo = 'bar'), which makes it a lot easier to use wireRenderFile(). As long as you pass in $page, you know you've got everything you need, and you can add more properties later without worrying about updating your "view bag."
    4 points
  3. I'm new to processwire, but have some decent experience in Scala, python and others. I was the typical guy making fun of php. Processwire changed that, the api design is very elegant and convinced me. I can host the event in Berlin, so we have big monitors for everyone, projectors, etc. Ping me if you are interested. We can make it a mini conference, with speakers etc.
    4 points
  4. Using the get ID can be problematic / dangerous - at least make it safe by sanitizing it with: $page_id = (int) $this->input->get('id'); You might want to take a look at how it's done in the field itself: https://github.com/processwire/processwire/blob/master/wire/modules/Inputfield/InputfieldPageTable/InputfieldPageTable.module#L137-L138 Note the sanitized get id check with a fallback to getPage() of wire->process
    2 points
  5. I haven't checked, the code, but I would assume: http://dev.mysql.com/doc/refman/5.7/en/optimize-table.html
    2 points
  6. Anybody tested this on v3 yet? Looking at purchasing for a new project. Also @apeisa - may I ask what is on the roadmap? As the last release was in January.
    2 points
  7. Never say die, where there's a will, there's a way! public function renderPageTable(HookEvent $event){ $page_id = $this->input->get('id'); $page = $this->pages->get($page_id); // use $page... }
    2 points
  8. $event->object is the object the hooked function lives on, in this case: A InputfieldPageTable object. $event->arguments does also have nothing, which garantees you to return a page object. This does hold the parameters, which are passed into the hooked function. Can be a page, but can be all sorts of other things. In your case there aren't any parameters to the render function. @tpr Mentioned another incorrect option, because getPage() is just a convenience function to retrieve the page if you're hooking ProcessPageEdit. Other hooked objects most often do not implement such a function. In the case of InputfieldPageTable you might be out of luck, because it's best practice, that inputfields do not need to know anything about the page they live on. They just need to know the value to work with. Only the fieldtype does need to be aware of the page itself.
    2 points
  9. Hi everyone, I have spent quite a bit of time today getting this module working with the new pagination functionality in the Table field. I have tested it in a variety of import (append and overwrite) and export scenarios with standard as well as page fields (radios, checkbox, selects, etc) and it seems to be working well. The trouble is that this new version will only with with the new version of the Table field. It will work even if pagination is not enabled, but it won't work with older Table field versions. I would really appreciate it if you guys could test and let me know how it works for you. I'd like to get this pushed to Github fairly soon, but it's such a major change that I would like some additional testing first. Thanks! PS - this update also add support for line breaks in textarea fields - I added the same CSV parser that I recently added to my BCE module.
    2 points
  10. Want to share a song we listen every day while programming.
    1 point
  11. Hi everyone, This is an early (but mostly functional) version of a module that I am experimenting with for automatically populating all empty fields on a page. It is designed for use during site development and should be uninstalled once the site is live. https://github.com/adrianbj/AutoContent (anyone have an idea for a better name?) It currently supports the following field types: Text - outputs "This is an example Field Label", where "Field Label" is the label for the field Textarea (RTE and plain) - configurable content from http://loripsum.net/ and embedded images from http://lorempixel.com Datetime - honors output formatting and returns random date/time with configurable min/max datetime Integer - honors min and max settings Float - honors min, max, precision settings URL - returns a random URL Email - returns a random email address Image - you can specify image category (people, nature, business, etc), and the range for min/max number of images to generate. Page - creates runtime selected child page content for output - not well tested yet. MapMarker - not well tested yet! I will be adding support for Profields and other selected 3rd party fieldtypes shortly. Highly configurable content is provided by: http://loripsum.net/ http://lorempixel.com/ https://github.com/fzaninotto/Faker Generated content can be localized to your region - very handy for addresses, people's names, phone numbers etc: Many fieldtypes are configurable via the Input tab on the field's config settings, eg: Textarea: Text: Images: Datetime: In general I am designing this to work with minimal/no configuration so you can install and have all fields on all pages on your site immediately populated for testing layout and styling without the need for manually adding dummy content. There is also a dummy page batch creator and deletor (automatically tracks and deletes just the dummy pages) available from the module config settings page. Please let me know if you think you will find this useful - trying to get an idea of how much time to put into support for additional field types.
    1 point
  12. Current programming playlist is a mix of Die Antwoord (they released a new album earlier this month so got some catching up to do), Little Big ("the Russian Die Antwoord"), and some random NYHC songs just to crank things up a bit every now and then. Works wonders for me. I'm pretty sure I've still got an LP from The Shadows somewhere. One of the first ones I ever bought and to be honest I'm not entirely sure if I've even listened to it properly – got lured in by the cover art and the rest is history..
    1 point
  13. Thanks in advance Teppo! I am more than happy to help you by testing if you think I can be of any help this way. I'm also busy-busy-busy too, but I can postpone a few things just to spare some time for this. Since I'm sloooowly moving form WP to PW, I'm looking for ways to keep my useful habits As for the "output" part of the RSS, here is a screenshot of the WP plugin (called Simple History) to give you an idea what it can look like in an RSS reader (notice the login/logout noticies too, useful to keep track of users of sites with not too many users/logins):
    1 point
  14. Hi, I do not think Ryan will have time to support the module (and this is not the right topic for that anyway), however you can take a look at the code to learn form it. I can also recommend the following as staring points to implement forms based on the PW form API:
    1 point
  15. Thanks for the suggestion. To be honest I was going to turn this one down (ProcessChangelog already provides JSON feed, so this could actually be a separate module), but I've already got a rough proof of concept ready and I think this has enough value to be part of ProcessChangelog itself. Hopefully I can finish this in the next few days (a bit busy right now). Definitely worth considering. Currently this module is limited to keeping track of changed page data, but I'm open for the possibility of tracking more than just that. I'll see if I can find an easy way to handle this (and a sensible way to output such content).
    1 point
  16. Thanks for the quick reply! I also noticed that sql dumps are not born to be equal, but I have not yet dived into the subject matter other than realizing that a simple text diff tool in just no enough I'm not planning to compare online to local, but local to local and/or online to online, and only before and after installing modules, or upgrading modules/system. The idea is that one can quickly spot changes without examining any source code, and if I happen to find something to pay attention to, I might want to spend the time to take a closer look at code level. I also found Toad and sqlyog, but they are running on Windows so not the kind I'm longing for. Nevertheless, can any of them be used to quickly see both schema an data changes? A far as camcima/php-mysql-diff is concerned, do not be scared away by Composer. As long as you do not want to create your own projects, there is not too much to learn, just "use it"
    1 point
  17. @SamC in your example, all of your variables are things that you can access directly from $page, so you could, if you wanted, just pass in $page instead of all of those individual variables. If you have anything extra you want to add, you can just add it. Just be careful not to accidentally override the built-in properties & methods. $page->any_key => 'any value'; $page->another_key => 'another value'; echo wireRenderFile($page->template->name.'.inc', array('page' => $page)); // everything in $page will now be available within this template
    1 point
  18. Hi Szabez, Yeahh at times you are in a webjungle, same database - different backups. A CPanel mysql backup turned out to be different from my local mysql backup and different from a php script backup. Since I used Diogo,s way to compare them I learned that most of the times only the "header" in the sql file is different. Some CPanels, when exporting a database, put extra data in the sql "header" file to mark it where and how the sql file was generated. In my case I could not import a sql file on another hoster because of this extra marked data done by the cpanel of the previous hoster. Simply stripping out this marked data was the solution and I could import the sql file on the other hoster. Since then I learned where to look in the top of a sql file to check if there is any added hoster or cpanel data and strip it out. Further an online database will always be different from your local dev database so I learned to keep both database backups. When needed I use toad or sqlyog to compare databases: https://software.dell.com/products/toad-for-mysql/ http://blog.webyog.com/all-you-wanted-to-know-about-sqlyogs-schema-comparison-tool/ That camcima thing seems to need composer and unfortunately I dont know sh*t about composer so I put that on my to do list
    1 point
  19. This isn't ProcessWire-specific, but the last time I checked, MailChimp hadn't updated their official PHP SDK for version 3.0 of their API (and all prior API versions will stop working at the end of 2016), so I have been using this handy-dandy little wrapper instead: https://github.com/drewm/mailchimp-api
    1 point
  20. Thanks again @adrian Now it makes more sense to me.
    1 point
  21. Ohh, my mistake, I got it now. Thanks @adrian
    1 point
  22. Loving this suite of modules. I was wondering what exactly it does when you click the Optimize button in the Database module - for my own understanding and safety of the data integraty of the site.
    1 point
  23. I am going to need more to go on here. I have been using this module on all my sites (on several different PW versions) since I created it. I don't suppose you could give me access to the server to take a look?
    1 point
  24. Looks really impressive. Thanks for posting.
    1 point
  25. could this modudke be used with third party email senders? link mailchimp etc?
    1 point
  26. Thanks! I'll check the styling issue later. I only append the NavItems to the end of the document, then use JavaScript to put them in place (as there's currently no hook to add them directly where I wanted). They should be added to the Pages section so apparently there's something bogus there according to the screenshot.
    1 point
  27. Hi @tpr - loving the module. I'm trying to figure out how you append the NavItems with this line: $event->return = str_replace('</body>', $items . '</body', $event->return); As it puts those quick links as a child to the top most admin navigation, when I'd like them to appear in the Pages submenu. On another note, the style of the parent menu is odd when a sub-child is open. (See Modules in the image) This is due the classes 'current' and 'open' being added to the css. Great work though!
    1 point
  28. I tend to agree, and use include() over wireRenderFile() myself. I suppose one reason some prefer wireRenderFile() is the scope of variables is limited so you don't run the risk of overwriting a variable of the same name in your template file. As for using a view file separate to the the template file, it depends how strictly necessary you consider "separation of concerns" to be. Definitely good if you are part of a team and want to hand the view file on to a front-end person who shouldn't be dealing with business logic. Or if you have a lot of logic that you don't like cluttering up the view. As a solo designer-developer, I like to have my business logic in my template so I can see what is going into variables, but I guess a lot of people would frown on that.
    1 point
  29. It's pretty simple. AIOM accepts an array of files to include, and fails gracefully when one is missing. I keep the arrays in $page for portability. I load third party libraries and site wide stuff first, then layer on the view-specific assets if available, something like this: <?php $page->styles = array( // third party libraries first... 'lib/normalize-css/normalize.css', // ...etc... // site-wide/global assets next. this file imports many separate stub files... 'styles/main.less', // now add the view file. you can check for its existence first, // but a missing file won't prevent the rest from working 'views/'.$page->template->name.'/'.$page->template->name.'.less' ); // do the same thing for scripts // $page->scripts = array(... ?> ...then in your template: <link rel="stylesheet" href="<?= AIOM::CSS($page->styles); ?>"> ...and: <script src="<?= AIOM::JS($page->scripts); ?>"></script>
    1 point
  30. Can the "HP" field value be less than zero? I'm not sure what this field holds in your case, but perhaps you just want to stop when the field is empty? $streak = $lastEvent->nextUntil("task.HP=''")->count(); Incidentally, I don't think there's anything wrong with a simple foreach() over 10 page objects or less - no cause for concern over performance there. Several ways you can skin the cat, but one alternative is to use "break" to end the loop when your condition is not met. foreach($lastEvents as $e) { if($e->task->HP >= 0) { $streak++; } else { break; } }
    1 point
  31. No problem at all I was never quite sure if that was the best approach to overriding that open/collapsed setting, but thought in general that once you have saved a page once, you'll probably want it open while you are still working on it and haven't navigated away. I am open to suggestions though. Glad the name change is working as expected - I really like that option (which is of course why I also built: http://modules.processwire.com/modules/page-rename-options/), especially during development - I think I would go crazy without it Btw, I just committed some updates to BCE - I recently changed the way CSV files are parsed and I just realized I introduced a bug when the field names were in the first row. Anyway, you should update when you get a chance.
    1 point
  32. I think what you are seeing is because you have already saved that page - when there is a ?s=1 in the URL it opens regardless of that setting. If you load another page and then come back to this page, it should be collapsed if that setting is unchecked. Regarding the "Overwrite Names" - this is working for me - remember the note mentions that it's only relevant in Edit and Update modes. If checked and you change the title of the page, the name will also change. Are you not seeing this?
    1 point
  33. First off, a big thanks to Jonathan Lahijani and Benjamin Milde for taking over the last two weeks of blog posts while I was traveling. They did an awesome job. If you haven't yet read Jonathan's CMS Critic case study or Benjamin's Migrations module introduction, be sure to check them out. This week we started using our new GitHub organization repository to soft launch version 3.0. ProcessWire 3.0 now appears on packagist as well (installable via Composer). We’ve got several other updates for you as well! https://processwire.com/blog/posts/hello-pw3/
    1 point
  34. One more addition: testing with multi-language page name support, I'm seeing that the rename operations affecting only non-default language are not being logged as renames at all. Currently I'm thinking that this should be logged as a separate rename operation, i.e. if you change the name in multiple languages for the same page at once, it would look in the log a bit like this: renamed basic-page what as what-2 renamed basic-page what-in-finnish as what-in-finnish-2 Probably will implement it like that unless someone has a strong opinion on thi
    1 point
  35. Just wanted to share a new site that we launched earlier this week. http://www.enovity.com/
    1 point
  36. I converted another site from a foreign system into PW. The previous page wasn't responsive, so I converted / redesigned it using Bootstrap 3. http://die-leserei.de
    1 point
  37. Just uploaded v068 which adds template edit link tooltips to the main pagelist items plus has some CSS improvements to a few CKE plugins (some seem to be written at least 10 yrs ago :)). And also see the ProcessPageList.js attached that was modified to enable opening collapsed pagelist items when hovering over them during drag-and-drop. It's still not perfect but it's still much better than the original imo - please feel free to modify the code (see line 1035, "change" property of "sortOptions"). The file's location is "/wire/modules/Process/ProcessPageList/". The main problem is that I check the next item after the placeholder (.PageListSortPlaceholder) so expand-collapse occurs only when moving the placholder above on item and not directly on it. I think this could be improved somehow. The reason I uploaded this here is because AOS v068 contains a few lines of CSS that modifies the appearance of dragging. Of course it works without AOS too. Here is what it looks now: ProcessPageList.js
    1 point
  38. This happened to me today. Clean your cache/FileCompiler folder. For me its gone. .a
    1 point
  39. 0.8.5: Due to the recent Twitter update changes are made to remove the limitation of media-URLs. In addition there is an option to set the maximum number of images you want to add to the Tweet (when the images-field is set to multiple). Enjoy!
    1 point
  40. Ok sorry, so lets get started with a step-by-step coding moment. I based the work on your form I found there : http://pingu.eb-zuerich.ch/kurs/bildungsgang28/beglinger/cms/#shop What we are going to do : installing a module in order to get working with Google ReCaptcha Setting a variable which contain the site owner's address email. What the code do : check that GoogleRecaptcha is correct check the client's submitted data for security reasons show the form on the page show a message to the client only if captcha and submitted data are correct send email to the site owner and send email to the client's email You can copy the code, it should work fine. But I advice you to try to read it understand so we will go with more PW API next time Anyway, the following code is taken from here (a topic that is worth to read) and modified for your needs, more infos on the end of the post. 1) Install the module MarkupGoogleRecaptcha and configure it : Now the code : <?php $emailTo = ''; // address mail of the site owner (you can get this value from a field!) $emailBackMessage = 'Thanks you for your purshase.'; $captchamod = $modules->get("MarkupGoogleRecaptcha"); // get the module for GoogleReCapatcha $captcha_form = $captchamod->render(); // render Google ReCaptcha for including it in our form $sent = false; // check for error $error = ''; // error message $out = ''; // this variable will contain our HTML markup // sanitize form values or create empty $form = array( 'product' => $sanitizer->text($input->post->product), 'fullname' => $sanitizer->text($input->post->fullname), 'address' => $sanitizer->text($input->post->address), 'email' => $sanitizer->email($input->post->email), 'telephone' => $sanitizer->text($input->post->telephone) ); // check if the form was submitted and if ReCaptcha was check if($input->post->submit && isset($_POST['g-recaptcha-response'])) { if (!$captchamod->verifyResponse()) { $error = "<p class='error'>Please check the Google ReCapctha.</p>"; } // determine if any fields were ommitted or didn't validate foreach($form as $key => $value) { if(empty($value)) $error = "<p class='error'>Please check that you have completed all fields.</p>"; } // if no errors, email the form results if(!$error) { $message = "Full name: {$form['fullname']}\n" . "Email: {$form['email']}\n" . "Address: {$form['address']}\n" . "Tel: {$form['telephone']}\n" . "Product: {$form['product']}"; // send mail to the site owner mail($emailTo, "Contact Form", $message, "From: {$form['email']}"); // send mail to the client mail($form['email'], "Contact Form", $emailBackMessage, "From: {$emailTo}"); // populate body with success message, or pull it from another PW field $out = "<div class='alert alert-success'>Thank you, your message and your item has been recorded. An email confirmation as been sent to your inbox.</div>"; $sent = true; } } if(!$sent): // if the message was not sent successfully // the form markup $out = <<<HTML <div class="alert alert-warning">{$error}</div> <form role="form" id="frmContact" method="post" action="./"> <div class="form-group"> <label for="product">Article:</label> <select class="form-control" name="product" id="product"> <option>T-Shirt: white, slim</option> <option>Jacket: leather, black</option> <option>T-Shirt: grey, logo-print (reserved)</option> <option>T-Shirt: green, bus-print</option> </select> </div> <div class="form-group"> <label for="fullname">Name:</label> <input type="text" class="form-control" name="fullname" id="fullname" required> </div> <div class="form-group"> <label for="address">Address:</label> <input type="text" class="form-control" name="address" id="address" required> </div> <div class="form-group"> <label for="email">Email:</label> <input type="email" class="form-control" name="email" id="email" required> </div> <div class="form-group"> <label for="telephone">Telephone:</label> <input type="tel" class="form-control" name="telephone" id="telephone" required> </div> {$captcha_form} <button type="submit" class="btn btn-warning" name="submit" id="submitBtn" value="submit">Buy</button> </form> HTML; endif; // end if | email not !sent echo $out; // echo the markup ?> The code is well commented and self explanatory. 2) Set the email of the site owner. In the code : $emailTo = ''; // address mail of the site owner (you can get this value from a field!) Now you should be able to copy-pasta the code in place of the form in your page
    1 point
  41. Variables in single quotes will not be processed. Use double quotes when using variables in selectors.
    1 point
  42. This should've already been the case, but in certain situations things weren't working as expected. The icons were displayed if there was at least one row of data in the database for that page and field combination, and a bug in building the base dataset often resulted in *all* fields for enabled templates (and not just the enabled ones) having that one row of data. I pushed a fix for the config issue a while ago and I've just pushed another fix that skips non-enabled fields even if there is data for them. Still need to make some updates to the automatic data (re)generation part, but for now things should appear normal
    1 point
  43. I have to say that the form API works pretty well in the frontend. I have several sites where I use it without issues. Once you get the hang of it, it is actually quite nice to interact with. Only thing I am missing is a more easy way than the current to get more control over the rendered markup. Formbuilder comes to the rescue here. If I remember correctly, when UI framework support was introduced to formbuilder, Ryan stated that the core functionality was altered to easier support UI frameworks. But I never found any hints on how to easily alter rendering of form markup (especially field wrapper's markup and attributes) other than through hooks. Nevertheless, I agree that it would be nice to have a docs section dedicated to this topic. Or at least have a link collection to relevant forum posts that deal with frontend forms, processing and saving of input values. Links I can come up with quickly: https://processwire.com/talk/topic/2089-create-simple-forms-using-api/ and, of course, Soma's great gists (big kudos) https://gist.github.com/somatonic/5011926 (build and process generic forms from page templates) https://gist.github.com/somatonic/4027908 (build and process forms manually with API) https://gist.github.com/somatonic/4150974 (upload images) https://gist.github.com/somatonic/5415646 (form with fields in table) https://gist.github.com/somatonic/5233338 (manual form markup with file upload handling)
    1 point
  44. Saturday evening chill out time getting lost and find home again
    1 point
  45. You can enable this option by editing your /site/config.php and setting $config->advanced=true; Next edit the template (Setup > Templates > edit) that you want to be able to change the createdUser. Click on the "system" tab (this is only visible in advanced mode). You'll see checkboxes for various options–check the appropriate one and save. Go back to your /site/config.php and remove the $config->advanced line you added earlier… as you don't usually want advanced mode on (some settings can be dangerous). But you should now have the ability to change the created user for pages using that template.
    1 point
×
×
  • Create New...