Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/03/2014 in all areas

  1. I did it again http://soma.urlich.ch/posts/custom-js-in-processwire-admin/
    8 points
  2. What you can also use, where PW does its validation is the processInput() of inputfields. You can hook into it and do you validation and add errors as needed. $form->addHookAfter("processInput", null, "formValidation"); function formValidation($event){ $form = $event->object; $email_inputfield = $form->get("email"); if($email_inputfield->value == "spam@hotmail.com"){ $email_inputfield->error("We got you!"); } } // direct on the inputfield type wire()->addHookAfter("InputfieldText::processInput", null, "validatText"); function validateText($event){ $inputfield = $event->object; if($inputfield->name == "username"){ ... } } And there's also the HTML5 regex pattern that can be used.
    4 points
  3. Already a bunch of good resources, but here's a couple more: Especially if you're at "absolutely beginner" level, there's a ton of useful video tutorials floating around. This one titled "Learn PHP in 15 minutes", for an example, seems pretty good. For more background there are also more thorough videos, such as this Harvard extension school lecture. Once you get up to speed, you should most definitely take a look at PHP: The Right Way. If you're really into it, I'd strongly suggest Programming PHP from O'Reilly. It's available as an ebook too. Another book worth checking out is Essential PHP Security. Short but good -- if every PHP developer knew at least this much about security best practices, PHP world would be a lot safer place. Just my two cents. Totally random fact: Designing Web Graphics by Lynda Weinman was one of the very first web design books I could get my hands on. That was some fifteen years ago, when quality learning material was still kind of scarce, at least around here. Should probably take another look at that book one of these days, could be sort of fun
    4 points
  4. What I use in front end from is doing my own validation when needed, some fields are already validated like password inputfield or email inputfield. On a register form I have something like this for example, combined with jquery validation for client side validation... if($input->post->register) { // processes form, validates and add error messages to fields $regform->processInput($input->post); // check email unique if any if($sanitizer->email($regform->get("email")->value) != '') { if(!$helper->isUniqueUserEmail($regform->get("email")->value)){ $regform->email->error(__("Diese E-mail wird bereits verwendet.")); } } // check username format only a-z0-9-_. $username = $sanitizer->pageName($input->post->username, Sanitizer::translate); if($username != $input->post->username){ $input->post->username = ''; $regform->username->error(__('Benutzername ist nicht im richtigen Format.')); } // check if username ($user->name) unique if(!$helper->isUniqueUsername($username)){ $regform->username->error(__("Dieser Benutzername wird bereits verwendet.")); } if(!count($regform->getErrors())){ ... I have helper functions like isUniqueUsername etc, that is at the same time used in jquery validation via ajax. Depending on your knowledge and how fluent you are with PHP and PW, I find it easy to add my own methods or checks where needed and found use of any external validation class not needed (was using that before).
    3 points
  5. 2 points
  6. @Martijn...your holiday to the UK is long overdue then!!!
    2 points
  7. I just found below website which has quite a bit of video tutorial for PHP web application development. I was searching "how to use paypal sandbox for testing" and I found this website from one of the stackoverflow answer. http://www.developphp.com/
    2 points
  8. php.net All functions have example code and other code for different aproach for the functions. http://nl1.php.net/manual/en/function.echo.php
    2 points
  9. I started with CMSses with MODX revolution and there you had that 'pesky' template language. Sometimes you have to do [[]], then you've to do [{}] and some need a * and others need the exclamation mark. Then on every found info page I had to think, is this for evolution or revolution, is this a snippet or a chunk. And if you want to have a simple if-statement you needed to start a snippet and a chunk as template or had to find plugins who install all kind of other snippets, plug-ins and other 'garbage' to do a simple comparison. If you can handle all that noize while thinking on building a site, you already can code. ( Maybe you don't realize that now ). There are less exceptions in PHP then there is in the MODX language. You can find documentation every where. You just have to start with the basic things. Actually, ProcessWire is the perfect environment to start learning PHP. (could be a little off with the MODX tpl language, I already forgot how to use it)
    2 points
  10. The profile page actually does use the user template, but it only lets the user edit the fields you designate. You can let them edit any fields you've added the user template. First add them to the user template. Then go to Modules > Process > User Profile, and check the boxes for the fields you want the user to be able to edit on the profile screen.
    2 points
  11. JSON Installer is a module that allows you to define installer scripts in JSON. The module has proven its use when either setting up a big website for a client (it's easier to type all pages in a JSON-file than to create them all with the click-heavy ProcessWire admin) or doing repeated tasks. At We Work We Play we always do the same kind of setup (create a configuration page, add SEO & sharing fields, an 'Under Construction'-toggle) so this module automates this for us. Huge timesaver. How to install: Download from: https://github.com/weworkweplay/ProcessJSONInstaller Place the file ProcessJSONInstaller.module in your /site/modules/ directory. In ProcessWire admin, click to 'Modules' and 'Check for new modules'. Click 'install' next to the 'JSON Installer' module (under heading 'Process'). Following that, you'll see a new menu option for this module on your Admin > Setup menu.
    1 point
  12. Here are my first couple of sites using PW, critique appreciated! Artists agency Photographer Thanks!
    1 point
  13. Hi tobaco, Soma is the King of this so I can't be sure of the following but my guess is that for some reason the initial attempts to list all Modules failed (e.g. a glitch in the Matrix) and so you initially saw 10. My experience of this Module has been that it is 100% reliable across multiple sites. I think when it connects and lists all 224 (and counting) it stores this list locally and so until you next manually refresh that list will remain. So I would expect for these reasons you will find this Module very robust going forward; unless there is something else happening here with the particular install/environment. Edit: PS: DOH! Misread your reply, though you said "so this seems to be only a temporary problem fix" - sorry, sounds like you're all good and don't need any comforter comments like mine Enjoy PW it's been a revelation each time I've needed it.
    1 point
  14. Ok, after a refresh (I did this before, but nothing happend) i see now »Modules found on modules.processwire.com (224)« instead of »Modules found on modules.processwire.com (10)«. so this seems to be only a temporary problem.
    1 point
  15. Nothing wrong with foreach... root |--listview // here we are | `--all // template products | |-- item 1 // template product `-- item 2 // template product $products = $pages->find('template=product, parent.template=products'); // it's better to use template in a selector then a name/path. (most of the time) // template defines behaviour, less likely to change then a path or a name if (count($products)) { // only if we have products $out = "<ul>"; foreach ($products as $product) { $out .= "<li>" . "<a href='$product->url'>" . $product->title . // fieldname title "</a><br>" . $product->summary . // fieldname summary "</li>"; } $out .= "</ul>"; echo $out; } There are some people that tell outputting strings is quicker with single quotes, I never tested it, but they are probably right. I do prefer the double quotes, as PHP get not processed inside single quote enclosed strings. I ended up in the past, replacing single quotes so many times to double ones that I get tired of it. (lazy) ProcessWire made me change my quote style technic. Now I always use single quotes for HTML attributes, so I can double quotes around a HTML string.
    1 point
  16. It's simple: You have that function function limit_words($string, $word_limit) { $words = explode(" ",$string); return implode(" ",array_splice($words,0,$word_limit)); } A simple call to use this function would be $shorty = limit_words($child->body, 20);
    1 point
  17. I posted the solution in all login script threads... read the previous page of this thread quickjeff.
    1 point
  18. Hi Martijn, that looks interesting and I may try to use it in another context: To allow people to test anonymously with a "test" user name and password. They could test a little, but without being able to save. I suppose that should be secure enough.
    1 point
  19. It's a bit related and not solving your problem. I had to build a module for a customer, who needed a translation company browse the backend, but don't allow them to edit anything. ( configured at role level ) module: conditional demo mode in the settings you c an add the roles
    1 point
  20. "Thankyou Brother" A bit London, perhaps.....
    1 point
  21. http://www.onlinetechbooks.com/php-books/JohnWileySons-PHP5ForDummies.pdf Learning from scripts directly http://www.scripts.com/php-scripts/ Freeware editor, very good. http://bluefish.openoffice.nl/features.html
    1 point
  22. All inputfields are sanitized, except for password. If you want to sanitze and not really validate. ProcessWire has the $sanitizer. I do use the $sanitizer->email($value) sanitizer as validator to, as it blanks out invalid adresses. if (!$sanitizer->email('bweugh')) { echo "Oops I'm something else"; }
    1 point
  23. This is what persuaded me to try ProcessWIre when Matthew suggested it to me - not being a programmer, and not having a huge amount of time to put to the task, I do not want to learn yet another way of doing things. When I first worked on a complicated site back in 2000, the chap who helped me (who was a PERL guru) was very strict about not reinventing things that already existed. He felt, quite rightly, that it fragmented and complicated the process and, as a consequence, was almost inevitably a security risk simply because it did not have the support required. Actually, although the site was in PHP he did feel that it was a lot weaker and less secure than if it had been written in PERL - at that time he was probably right. And it just makes things hard work! It is notable that as a job he was not a web developer but a sysadmin and solutions developer for a multinational - very hard core and working in a world of very strict rules. He has left that world now and is joyously writing old fashioned game books.
    1 point
  24. Solved it! The date field was the culprit! I entered "5" instead of "+5" in the Date Picker Year Range and while I didn't see any errors when I saved that field, apparently this breaks all jquery UI interaction on the post's edit page
    1 point
  25. You should do it more often @PapaBear: what the hell is "Ta, bruv...."
    1 point
  26. When the switch from Evo to Revo happened, lot's of folks were looking around. Revolutions backend was slow, there were numeral bugs and documentation was scarce. And there you had that new kid in town called ProcessWire with lots of similarities between them. (a reason why so many switched if you asked me) In my opinion ProcessWire is a better experience for the developer and the site editor. Then you're forced to use PHP, not some kind of `pet keeping` safety language. This insures you that learn the most used language of the web, knowledge what you can use everywhere, not only in the ProcessWire world.
    1 point
  27. Reviving an old thread that's worthy of interest
    1 point
  28. Ah, some nice reading to go with my coffee in the morning! Ta, bruv....
    1 point
  29. Hi Max Welcome to Processwire, good to see you here I know you will fall in love with Processwire. I've been meaning to write some newbie tutorials for PW but have been quite swamped with client work and have had some big projects going. But it's still on my to-do list. Processwire is a fantastically flexible CMS to work with, and you can bend it any which way you want, depending on your needs and skills. I dare say it's a lot more flexible than MODX ever will be, and you never need to learn another templating tag in your life You can just fit PW into the way you like to work, which is what would make creating tutorials tricky, since a tutorial would only present one way of doing things My advice is the same as everyone else's. Start with the docs, understand how template files work (http://processwire.com/api/templates/) and then get hands on. Come back to the forums and ask questions when you get stuck, and one day the light bulb will just go on and you'll be on your way There are still things I find quite challenging in PW but I'm constantly learning and building my skillset here, and I'm hoping to very soon have time to document the things I'm learning how I'm learning them. Just jump in, you can't go wrong
    1 point
  30. What Martijn said!! And sshaw has also given you some great advice, and a great list from teppo. As mentioned above, you will learn everything you need to know about Processwire from the API documentation, and from posting on the forums here. We're a friendly bunch That said, it never hurts to learn some PHP, and it will stand you in good stead in PW and beyond, when you want to extend and expand things. Lots of good resources posted here, here's one more: http://devzone.zend.com/6/php-101-php-for-the-absolute-beginner/
    1 point
  31. You don't need to know much php to use ProcessWire. I recommend the ProcessWire documentation which covers all the php that you'll need to know (initially). The cheatsheet is helpful too. This is about all the php you need to build a simple website in PW. For apps and complex websites you'll need to go further with PHP (specifically objects and methods). if http://www.php.net/manual/en/control-structures.if.php comparison operators http://www.php.net/manual/en/language.operators.comparison.php logical operators http://www.php.net/manual/en/language.operators.logical.php foreach http://www.php.net/manual/en/control-structures.foreach.php array http://www.php.net/manual/en/language.types.array.php find answers to specific problems (a good place to look errors when you don't know what they mean) http://stackoverflow.com/
    1 point
  32. Totally untested, but how about: business|service|customer={$page->customer}|{$page->service}|{$page->business}
    1 point
  33. Nice that you finished it. Looking good, will give it a try.
    1 point
  34. ProcessWire is easy to get the hang of. If your going to build sites for clients, you will appreciate the differences soon enough. Come on in, the water is nice. BTW: i just finished moving the last of my client sites off MODx (started on 0.95). Most of them I converted on my dime. I did it because It saves me time and is easier for them to manage content. No more dependance on custom modules to get my sites the way I want. Have most everything I need in the core. Dumped drupal for many of the same reasons too. I used to think lots of great third party modules for *some cms* saved us time. Not so. The upgrade problems alone cost us more than the coding in PW. Learn to code. It's a skill that won't be replaced.
    1 point
  35. André is teasing me to tell that the Linux freak here just bought a Mac (my last mac was this one, by the way http://km.support.apple.com/library/APPLE/APPLECARE_ALLGEOS/HT1772/88039_9.gif). Yep that's true, couldn't convince my team to drop all the Adobe rubbish and the collaboration was becoming far from ideal So, if anyone has some advices for the newbie, bring them in! And yes, I installed Atom as soon as the wireless connected But also TextMate 2.0, nice surprise!
    1 point
  36. That awkward moment when people suddenly start discussing things that you don't understand!!!
    1 point
  37. This is true. It's not currently possible. I understand there are some good use cases for supporting one level of repeaters within repeaters, so I'll be on the lookout for a way to support it. But for now, the best route to take for the use case you mentioned is to do it with pages instead of repeaters. Though in your case, I think the textarea option might be a good one since you only need a key and value. You could enter the variants like this: 5.99=Half order 6.50=Half order with cheese 9.50=Full order with cheese On your front-end, you could work with it like this: $variations = array(); foreach(explode("\n", $item->variations) as $line) { list($price, $label) = explode("=", trim($line)); // you could output the variations right here echo "<li>$label: $price</li>"; // or you could stuff them into an array for later use, like this: $variations[$label] = $price; } // how you might output the array, if preferred echo "<table>"; foreach($variations as $label => $price) { echo "<tr><td>$label</td><td>$price</td></tr>"; } echo "</table>";
    1 point
  38. most of the time I end up wearing my earbuds for two hours, but forget to turn any music on *edit: Martijn, love that Lollywood song and video
    1 point
  39. Back to repeaters a minute - I think that a little AJAX would vastly improve the "flow" here. If it were altered to show a loading icon when you add a new item and then load it via AJAX without reloading the page then I think that that would be preferable if it's possible? I think the reloading can feel a bit clunky if you are using repeaters a lot, as can setting it to automatically set up X default repeater items when you're rarely sure how many you might need.
    1 point
  40. The new user system will provide better support for developing your own user registration functions. But it's probably still a month or so before I'll have that ready. In the new user system, users are actually pages, so you can interact with them, add fields to them, and so on, in the same way.
    1 point
×
×
  • Create New...