Jump to content

Leaderboard

Popular Content

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

  1. Thanks kongondo, I understand time is limited. I will check back every__seconds... Many Thanks
    4 points
  2. Hey Kongondo, you owe me a new keyboard.......my F5 key has worn out! ........Only joking! The Kongondo's Web Tutorials website looks so cool. Please please please upload one teaser tutorial.
    4 points
  3. @OrganizedFellow, Question: Did you start off without a .gitignore file in your project root and add it at a later date? Possibly after an initial add and commit on your project? If so, git will continue to track what is already in the index - regardless of the content of your .gitignore file. More details here.
    4 points
  4. Hehe...OK, I get it, point taken ...tutorials coming up in ___ days...
    3 points
  5. Hi kongondo, I totally understand.
    3 points
  6. https://processwire.com/talk/topic/3458-mariadb/
    2 points
  7. Tina, thanks for these https://www.digitalocean.com/community/articles/how-to-install-processwire-on-an-ubuntu-vps https://www.digitalocean.com/community/articles/migrating-a-processwire-website-to-an-ubuntu-vps
    2 points
  8. Put these lines in your htaccess: RewriteCond %{HTTP_HOST} !^sharespost.com$ [NC] RewriteRule ^(.*)$ http://sharespost.com/$1 [L,R=301]
    2 points
  9. Here is a link to a post that links to several others on creating a custom front-end login: http://processwire.com/talk/topic/5121-frontend-users-validation-processing/?p=49360 Here's a great thread on creating a custom front-end form: http://processwire.com/talk/topic/2089-create-simple-forms-using-api/ PW may lack some inbuilt functionality, but it more than makes up for it in flexibility.
    2 points
  10. This is a really interesting subject. It's a while back since it was started by Soma. I would love to know if Soma is still using the same approach or found some other prefered way.
    2 points
  11. Yes, a couple of us got to here having played with Joomla + Seblod, which I found horribly frustrating. Yes, this does require more actual writing of code than those do, but the result is so much lighter, faster and yet more powerful, that it is quite liberating - especially that once you output your data it is so easy to display it in any way you like, with any framework you like and with any JS or JQuery plugin you want and so on. I will say though that I spent so much time with Joomla and CCKs trying to bend them to what I actually wanted to do, that PW was actually QUICKER to work with. And, of course, any functionality you create will be EXACTLY what the client wants rather than a compromise. Trust me, you will never go back.
    2 points
  12. Thanks for your answer. I noticed how much is possible with this software. Coming from WP and Joomla, I actually was searching for other software until someone mentioned processwire in a topic about cck's. The approuch that - not only - views, are self made is an advantage. I was getting tired about changing all the css templates and files because of Jooma + template + component working against eachother. I will look into your mentioned links/topics.
    2 points
  13. Welcome! Two little questions that have rather large answers, to be honest. First of all, I suggest that you ignore front end for the moment till you get your head round the rest of the process (see what I did there?) The key to ProcessWire is the incredibly powerful APi which allows you to build any functionality - Form Builder is a module that allows you to create front end forms very easily, but they can also be built manually. So, I suggest you do one or other of the tutorials in the Wiki just to get the hang of how the system works and as a very basic introduction to the API http://wiki.processwire.com/index.php/Main_Page Next step is to look at the API (linked on the top menu) and especially the Cheat Sheet. http://cheatsheet.processwire.com/ That will give you a clue to how much is possible with ProcessWire. The point with PW is that it is not quite an out-of-the-box solution like the Drumlapress mob, but it allows you a lot more versatility and does not shoehorn you into one particular way of working. Having said that, it is not a scarily complicated system either - many of us started using it with very little development knowledge, but have found it manageable and we have learned a huge amount. And had fun in the process.(I did it again..!") So, get your hands dirty with the tutorials and then ask any specific questions you need - you will find the people on the forums here are, quite uniquely, rather better than boring old docs!
    2 points
  14. Just wanted to share what I recently used to create forms in modules and in frontend using the API and Inputfield modules PW provides and uses on its own. I think many newcomers or also advanced user aren't aware what is already possible in templates with some simple and flexible code. Learning this can greatly help in any aspect when you develop with PW. It's not as easy and powerful as FormBuilder but a great example of what can be archieved within PW. Really? Tell me more The output markup generated with something like echo $form->render(); will be a like the one you get with FormBuilder or admin forms in backend. It's what PW is made of. Now since 2.2.5~ somewhere, the "required" option is possible for all fields (previous not) and that makes it easier a lot for validation and also it renders inline errors already nicely (due to Ryan FormBuilder yah!). For example the Password inputfield already provides two field to confirm the password and will validate it. De- and encryption method also exists. Or you can also use columns width setting for a field, which was added not so long ago. Some fields like Asm MultiSelect would require to also include their css and js to work but haven't tried. Also file uploads isn't there, but maybe at some point there will be more options. It would be still possible to code your own uploader when the form is submitted. Validation? If you understand a little more how PW works with forms and inputfields you can simply add you own validation, do hooks and lots of magic with very easy code to read and maintain. You can also use the processInput($input->post) method of a form that PW uses itself to validate a form. So getting to see if there was any errors is simply checking for $form->getErrors();. Also the $form->processInput($input->post) will prevent CSRF attacks and the form will append a hidden field automaticly. It's also worth noting that processInput() will work also with an array (key=>value) of data it doesn't have to be the one from $input->post. Styling? It works well if you take your own CSS or just pick the inputfields.css from the templates-admin folder as a start. Also the CSS file from the wire/modules/InputfieldRadios module can be helpful to add. And that's it. It's not very hard to get it display nicely. Here an code example of a simple form. <?php $out = ''; // create a new form field (also field wrapper) $form = $modules->get("InputfieldForm"); $form->action = "./"; $form->method = "post"; $form->attr("id+name",'subscribe-form'); // create a text input $field = $modules->get("InputfieldText"); $field->label = "Name"; $field->attr('id+name','name'); $field->required = 1; $form->append($field); // append the field to the form // create email field $field = $modules->get("InputfieldEmail"); $field->label = "E-Mail"; $field->attr('id+name','email'); $field->required = 1; $form->append($field); // append the field // you get the idea $field = $modules->get("InputfieldPassword"); $field->label = "Passwort"; $field->attr("id+name","pass"); $field->required = 1; $form->append($field); // oh a submit button! $submit = $modules->get("InputfieldSubmit"); $submit->attr("value","Subscribe"); $submit->attr("id+name","submit"); $form->append($submit); // form was submitted so we process the form if($input->post->submit) { // user submitted the form, process it and check for errors $form->processInput($input->post); // here is a good point for extra/custom validation and manipulate fields $email = $form->get("email"); if($email && (strpos($email->value,'@hotmail') !== FALSE)){ // attach an error to the field // and it will get displayed along the field $email->error("Sorry we don't accept hotmail addresses for now."); } if($form->getErrors()) { // the form is processed and populated // but contains errors $out .= $form->render(); } else { // do with the form what you like, create and save it as page // or send emails. to get the values you can use // $email = $form->get("email")->value; // $name = $form->get("name")->value; // $pass = $form->get("pass")->value; // // to sanitize input // $name = $sanitizer->text($input->post->name); // $email = $sanitizer->email($form->get("email")->value); $out .= "<p>Thanks! Your submission was successful."; } } else { // render out form without processing $out .= $form->render(); } include("./head.inc"); echo $out; include("./foot.inc"); Here the code snippet as gist github: https://gist.github.com/4027908 Maybe there's something I'm not aware of yet, so if there something to still care about just let me know. Maybe some example of hooks could be appended here too. Thanks Edit March 2017: This code still works in PW2.8 and PW3.
    1 point
  15. Here is a simple tutorial how to enable the Justify capability in CKEditor First, download the plugin at http://ckeditor.com/addon/justify . Copy the "justify" folder to the "plugins" folder under ckeditor in your modules directory and upload to server. Edit the field that is using the ckeditor and go to the input tab.. Under CKEditor Setting > CKEditor Toolbar insert the following line where you want the icons to appear: JustifyLeft, JustifyCenter, JustifyRight, JustifyBlock Use ACF? choose "No" Under Extra Plugins insert: justify
    1 point
  16. Here's a video of a module we're working on that I thought you guys might like. The module, Lister, provides a different type of Page List than the tree that you usually interact with in ProcessWire. It gives you a table of pages with customizable columns, filters and actions. Rather than try to explain what it does, I figured I'd show you. This module also uses a new (soon to be released) Inputfield invented by Apeisa, developed by me, and sponsored by Avoine, called InputfieldSelector – it's what you see on the configuration screen as well as the Filters tab. I recommend bumping up the size/quality to 720p so that you can properly see everything. The video has no sound... I tried to do one with narration, but that didn't work out.
    1 point
  17. This might be obvious since MariaDB should be totally compatible with mySQL, but just wanted to say that everything seems to be working fine with running pw with it after doing some selector tests.
    1 point
  18. Sometimes you gotta do what you gotta do
    1 point
  19. Well I am not sure I understand - the stuff inside the foreach ($related_id as $key => $val) { will only get displayed if the $related_id array has entries in it so perhaps you need to figure out why there are page ids in that array in the first place if there are no related pages. EDIT: I had some code here that I thought made sense, but then realized it didn't
    1 point
  20. Currently I'm not knowing IM, but I'm in!
    1 point
  21. Agreed horst - we need to make GD the best it can be. I do like the idea of a drop-in IM replacement though. There are so many settings that developers could tweak with IM. One thing that should be tried straight off is using: adaptiveResizeImage instead of ResizeImage, which is what I used in the module to start with. Anyway, as I said, no time right now, but perhaps if enough people are keen and think the benefits are worth the effort, perhaps we could collaborate on this?
    1 point
  22. @adrian: this is a very good starting point! An IM alternative may be good for all that can use it on their hosts. But for all users that cannot, we have to improve the usage of GD.
    1 point
  23. Hi @humanafterall. additionally to that what I have replied to @robert, it has nothing to do with linearization (gamma correction). The artefacts comes from sharpening the images. Attached is a test with sharpening set to 'none', the default 'soft' and the third image is a rezied version where I have added some noise to yout original image with photoshop. This is common usage: if you have technical gradients with pixel formats use the filter "add noise". How much and if monochrome or colored you may test, but that's the only way I know to avoid these artefacts. You can set / send options in your template like this: $img = $page->images->first(); $img->removeVariations(); $options = array( 'cropping' => true, 'sharpening' => 'none', ); $img = $img->size(768, 436, $options); EDIT: added more clearly that I have added noise to the original image and resized it in PW with GD-lib.
    1 point
  24. I am not sure on the whole GD vs Imagemagick quality issue. I know years ago IM was ahead, but not sure if that is still the case. From reading around it sounds like they each have their strengths and weaknesses. That said I have always used IM until I started using PW. For the sake of experimenting, I quickly threw this module together as a way to test IM within PW. It replaces the resize method, so it will work from the admin and also template calls like: $image->size(400,0) It doesn't do anything more than the resizing at the moment - it currently ignores all quality settings, cropping etc. I doesn't try to do any sharpening either, but it's a starting point that we can play with. I need to get back to real work, but thought one of you guys might be keen to play around with and tweak settings and see what you can come up with. Obviously you need imagemagick on your server and also the iMagick extension. ImagickResizer.module
    1 point
  25. Nice one Mark! Hopefully soon....(time, time, time....)....
    1 point
  26. If I understand correctly, would counting related_id work? if(count($related_id)>0){
    1 point
  27. I understand and approve the suggestions to be verbose from some people. Usually it's better to be verbose to avoid confusion. That said, just for the record, I would still like to give a short alternative to what @jmartsch posted: if ( $thisField = $pages->get("/einstellungen/")->telefon ) echo "Telefon :" . $thisField . "<br>";
    1 point
  28. I know this is a lil bit off-topic but most times i want to echo a variable prepended by an label or followed by a br tag. But the line with the variable and br should not be generated when the variable is empty. So i use function echoField($variable, $prepend='', $append = false){ if ($append === true) { $append = '<br>'; } if ($variable) echo $prepend.$variable.$append; } and output it with <?= echoField($pages->get("/einstellungen/")->telefon,'Telefon :',true); ?> <?= echoField($pages->get("/einstellungen/")->email,'E-Mail: ',true); ?> What do you think of this?
    1 point
  29. Hi Melissa and welcome to the forums! Not exactly what you are asking for, but this might suffice for your needs: http://processwire.com/talk/topic/5835-lister/
    1 point
  30. No toots yet. BUt we'll be waiting ... and watching ... silently.
    1 point
  31. Hi Guys.. Started cleaning up my Mac and thought I would have a look at MAMP and see if there was an update. Looks like there is a whole new version out! New price is 39 Euro. For most of us here, I suspect, the upgrade from Pro 2.x costs 19 Euro Just sharing... Cheers
    1 point
  32. There are downsides to all Operating Systems (Windows included). What we should celebrate is that there are people who are expanding the horizons and coming up with new ways of using computers. The more Operating Systems developed, the better it is for the common folks who are tired of the expensive, bloated and bug ridden releases by the big name Commercial vendors. People will always gravitate towards the newest systems. Combine that with ease of use and viable software then you have a winner. Consumers will switch to new technology that they feel is useful for their daily personal, work or recreational lives. I'm a Linux desktop user, however I would be the first to admit that for the non-technical, Linux appears to be hard to learn, inferior and basically weird. Linux gets better every release, however there are a lot of people invested in a Windows or Mac world who will never see themselves using a Linux desktop. What's really amazing is that some of these same individuals would scoff at anyone removing their Linux Server or Open Source tools. I applaud Windows, Android, Mac OS, iOS, Linux and any other Operating System out there. The reality is that if it wasn't for governments, universities and individuals who believe in standards, non of what we have seen in the last 40 years would have been possible. I ask that we give each Operating System a chance. It may not be for us but it may work for someone else. Normally innovation in one Operating System usually makes it's way to all the other Operating Systems over time. That's always a good thing.
    1 point
  33. Is $page->image a single image (max files = 1?). If so, access $page->image is an object of type Pageimage, which has no remove() or delete() or deleteAll() methods. Those are instead methods of the WireArray that contains the file(s)/image(s). You could access that a couple of different ways. One way would be to get the "unformatted" value, which for files, always returns the containing WireArray: $page->getUnformatted('image')->delete($page->image); Another way would be to access the 'pagefiles' property of the image, which also refers to the containing WireArray. $page->image->pagefiles->delete($page->image); I mention the above examples for explanation, but PLEASE IGNORE THE ABOVE. Any time you are performing manipulations to a page, you should have the page's output formatting turned OFF. So there really isn't any situation in which you would use the above API examples... because it would mean you are modifying a page that is in an output-ready state, rather than a change-ready state. That's why ProcessWire throws an exception if you try to save a page with output formatting state active. The second point I want to make is that simply calling a delete() is queuing a deletion, not executing it. You still need to $page->save() or $page->save('image') before the deletion is committed. Given all this, I think this is what you want: $page->of(false); // turn off output formatting $page->image->delete($page->image); // you can use this line... $page->image->deleteAll(); // ...or this line (choose one) $page->save('image'); // or use $page->save(); if also saving other changes
    1 point
  34. I think apeisa has all the usual suspects covered. I imported 900+ plant species from a CSV yesterday. Each has 3 repeater fields that have around 8 entries each on average. So roughly 21,600 pages. It took a little bit, but it completed in one batch. This is on a pretty solid University of Florida server, so not sure how it would do on a typical shared host.
    1 point
  35. thanks for the great framework. Processwire is just awesome and all the people here are awesome too
    1 point
  36. I like being verbose! If this { do that } or else { do this } or if not { do this } ok go on then { do this instead } Much cleaner
    1 point
  37. Looks like MariaDB is gaining some momentum. Red Hat going with MariaDB instead of MySQL is pretty big news for a lot of companies out there.
    1 point
  38. Hi Joss, you'll find loads of that information littered around the forum. Certainly lots of custom login, page creation API stuff. The testing if user is logged in is probably the simplest part, you're looking at a relatively simple if/else statement. For content creation/editing, you're looking at creating HTML forms and you can use the current value as <input value="" /> just be sure to look into sanitizing the form data. I've already created a create/edit/delete students front-end system and am happy to share if needed. It's fun doing it and nothing too complex.
    1 point
  39. I recently had to setup front-end system to handle logins, password resets and changing passwords, so here's about how it was done. This should be functional code, but consider it pseudocode as you may need to make minor adjustments here and there. Please let me know if anything that doesn't compile and I'll correct it here. The template approach used here is the one I most often use, which is that the templates may generate output, but not echo it. Instead, they stuff any generated output into a variable ($page->body in this case). Then the main.php template is included at the end, and it handles sending the output. This 'main' template approach is preferable to separate head/foot includes when dealing with login stuff, because we can start sessions and do redirects before any output is actually sent. For a simple example of a main template, see the end of this post. 1. In Admin > Setup > Fields, create a new text field called 'tmp_pass' and add it to the 'user' template. This will enable us to keep track of a temporary, randomly generated password for the user, when they request a password reset. 2a. Create a new template file called reset-pass.php that has the following: /site/templates/reset-pass.php $showForm = true; $email = $sanitizer->email($input->post->email); if($email) { $u = $users->get("email=$email"); if($u->id) { // generate a random, temporary password $pass = ''; $chars = 'abcdefghjkmnopqrstuvwxyz23456789'; // add more as you see fit $length = mt_rand(9,12); // password between 9 and 12 characters for($n = 0; $n < $length; $n++) $pass .= $chars[mt_rand(0, strlen($chars)-1)]; $u->of(false); $u->tmp_pass = $pass; // populate a temporary pass to their profile $u->save(); $u->of(true); $message = "Your temporary password on our web site is: $pass\n"; $message .= "Please change it after you login."; mail($u->email, "Password reset", $message, "From: noreply@{$config->httpHost}"); $page->body = "<p>An email has been dispatched to you with further instructions.</p>"; $showForm = false; } else { $page->body = "<p>Sorry, account doesn't exist or doesn't have an email.</p>"; } } if($showForm) $page->body .= " <h2>Reset your password</h2> <form action='./' method='post'> <label>E-Mail <input type='email' name='email'></label> <input type='submit'> </form> "; // include the main HTML/markup template that outputs at least $page->body in an HTML document include('./main.php'); 2b. Create a page called /reset-pass/ that uses the above template. 3a. Create a login.php template. This is identical to other examples you may have seen, but with one major difference: it supports our password reset capability, where the user may login with a temporary password, when present. When successfully logging in with tmp_pass, the real password is changed to tmp_pass. Upon any successful authentication tmp_pass is cleared out for security. /site/templates/login.php if($user->isLoggedin()) $session->redirect('/profile/'); if($input->post->username && $input->post->pass) { $username = $sanitizer->username($input->post->username); $pass = $input->post->pass; $u = $users->get($username); if($u->id && $u->tmp_pass && $u->tmp_pass === $pass) { // user logging in with tmp_pass, so change it to be their real pass $u->of(false); $u->pass = $u->tmp_pass; $u->save(); $u->of(true); } $u = $session->login($username, $pass); if($u) { // user is logged in, get rid of tmp_pass $u->of(false); $u->tmp_pass = ''; $u->save(); // now redirect to the profile edit page $session->redirect('/profile/'); } } // present the login form $headline = $input->post->username ? "Login failed" : "Please login"; $page->body = " <h2>$headline</h2> <form action='./' method='post'> <p> <label>Username <input type='text' name='username'></label> <label>Password <input type='password' name='pass'></label> </p> <input type='submit'> </form> <p><a href='/reset-pass/'>Forgot your password?</a></p> "; include("./main.php"); // main markup template 3b. Create a /login/ page that uses the above template. 4a. Build a profile editing template that at least lets them change their password (but take it further if you want): /site/templates/profile.php // if user isn't logged in, then we pretend this page doesn't exist if(!$user->isLoggedin()) throw new Wire404Exception(); // check if they submitted a password change $pass = $input->post->pass; if($pass) { if(strlen($pass) < 6) { $page->body .= "<p>New password must be 6+ characters</p>"; } else if($pass !== $input->post->pass_confirm) { $page->body .= "<p>Passwords do not match</p>"; } else { $user->of(false); $user->pass = $pass; $user->save(); $user->of(true); $page->body .= "<p>Your password has been changed.</p>"; } } // display a password change form $page->body .= " <h2>Change password</h2> <form action='./' method='post'> <p> <label>New Password <input type='password' name='pass'></label><br> <label>New Password (confirm) <input type='password' name='pass_confirm'></label> </p> <input type='submit'> </form> <p><a href='/logout/'>Logout</a></p> "; include("./main.php"); 4b. Create a page called /profile/ that uses the template above. 5. Just to be complete, make a logout.php template and create a page called /logout/ that uses it. /site/templates/logout.php if($user->isLoggedin()) $session->logout(); $session->redirect('/'); 6. The above templates include main.php at the end. This should just be an HTML document that outputs your site's markup, like a separate head.inc or foot.inc would do, except that it's all in one file and called after the output is generated, and we leave the job of sending the output to main.php. An example of the simplest possible main.php would be: /site/templates/main.php <html> <head> <title><?=$page->title?></title> </head> <body> <?=$page->body?> </body> </html>
    1 point
  40. Yep, works great! In case anyone is following along, my original example is updated and working correctly. Thanks Ryan!
    1 point
  41. Thanks Ryan, Much appreciated. I'll test on my site and then update the code example accordingly.
    1 point
  42. Hi Ryan, Nice catch. Yeah, no sense setting a session variable after the redirect. That entire if/else had a bunch of stuff I was commenting in/out while I was testing, I did a poor job of cleanup. I updated my code above, so it's correct for anyone that uses it.
    1 point
  43. Ryan, Thanks this gave me a great place to start. I thought I'd share the version I created in case anyone finds it useful. • Single template for the login/logout. • Automatically redirects the user back to whatever page they originally requested after they login. ./includes/login.php <?php // Handle logouts if($input->get->logout == 1) { $session->logout(); $session->redirect($page->path); } // If they aren't logged in, then show the login form if(!$user->isLoggedin()){ // check for login before outputting markup if($input->post->user && $input->post->pass) { $user = $sanitizer->username($input->post->user); $pass = $input->post->pass; if($session->login($user, $pass)) { // login successful $session->redirect($page->path); } else { $session->login_error = 'Login Failed. Please try again, or use the forgot password link below.'; } } ?> <!DOCTYPE HTML> <html lang="en"> <head> <title>Custom PW Login</title> </head> <body> <form action='./' method='post'> <div class="login"> <? if($input->post->user && $input->post->pass) { echo "<p class='error'>" . $session->login_error . "</p>"; }?> <p><input type='text' id="user" name='user' placeholder='Username'/></p> <p><input type='password' id="pass" name='pass' placeholder="Password" /></p> <p><input type='submit' class="btn" name='submit' value='Login' /></p> </div> </form> </body> </html> <? die(); // don't go any further if not logged in } // end !logged in ?> In any template you wish to protect: <? require("./includes/login.php");?> To trigger a logout: <a href="?logout=1">Logout</a> Note: I'm using the HTML5 placeholder attribute. Browser support is not 100%. You may want to use labels instead, or use some jQuery (like I did) to add the placeholder text for browser that don't support it. SideNote: How do you get code indents to stick when posting? I'm having to go back and add spaces to each line. I use tabs when coding.
    1 point
  44. Absolutely! Here is a simple, but functional example for both login and logout templates. You would want to replace the markup with your own markup or includes. Likewise you'd want to change the redirects to redirect to whatever page you want them to go to after completing a login. /site/templates/login.php: <?php if($user->isLoggedin()) { // user is already logged in, so they don't need to be here $session->redirect("/somewhere/"); } // check for login before outputting markup if($input->post->user && $input->post->pass) { $user = $sanitizer->username($input->post->user); $pass = $input->post->pass; if($session->login($user, $pass)) { // login successful $session->redirect("/somewhere/"); } } ?> <html> <head> <title>Login</title> </head> <body> <form action='./' method='post'> <?php if($input->post->user) echo "<h2 class='error'>Login failed</h2>"; ?> <p><label>User <input type='text' name='user' /></label></p> <p><label>Password <input type='password' name='pass' /></label></p> <p><input type='submit' name='submit' value='Login' /></p> </form> </body> </html> /site/templates/logout.php: <?php $session->logout(); ?> <html> <head> <title>Logout</title> </head> <body> <h1>You have logged out</h1> </body> </html>
    1 point
×
×
  • Create New...