Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/21/2013 in all areas

  1. Field dependencies are coming in ProcessWire 2.4, and I just wanted to give you guys a little preview of it. The development of this new feature is being sponsored by Avoine, the company where Antti works (he also specified how it should work). Field dependencies are basically just a way of saying that one field depends on another. It dictates which fields should be shown in a given context. In our case, it also gets into whether a field is required or not. This short video demonstrates how it works: (switch to the 720p and full screen version, as YouTube's default settings for this video make it impossible to see): // Edit @Adamkiss: Here's link for those on mobile: youtu.be/hqLs9YNYKMM The implementation here is done both client-side and server side. Javascript handles the showing/hiding of fields and the required vs. not required state changes. On the server side, it doesn't process any fields that aren't shown, and honors the required rules. A separate processing occurs both client side and server side, ensuring that the user can't make their own rules by manipulating the markup or post data. These field dependencies can be used with any Inputfield forms. That means you'll be able to use it not just in ProcessWire, but in FormBuilder, and via the API too. It's very simple to use from the API. All you have to do is specify a ProcessWire selector to either "showIf" or "requiredIf" to the Inputfield, and ProcessWire takes care of the rest: // show this field only if field 'subscribe' is checked $inputfield->showIf = "subscribe=1"; // show this field only if 'price > 0' and at least one category selected $inputfield->showIf = "price>0, categories.count>0"; // make this field required only if 'email' is populated $inputfield->required = true; $inputfield->requiredIf = "email!=''"; This feature will be in the 2.4 core (rather than as a separate module), so it will also be ready and available for things like module and field configuration screens.
    19 points
  2. This is epic. Thanks for building it Ryan. Couldn't be happier with how it turned to be!
    8 points
  3. If a customer want a Drupal or a Wordpress site, it's up to them. We try to convince them for ProcessWire. If they don't want ProcessWire we help him to find an other company who delivers Wordpress or Drupal. Building a site in Drupal & Wordpress is 1 but maintain it is a whole other story. It would take me ages to find out how those structures/template-languages work & i won't remember it after a year or so. Customers are better of with an external company making those Wordpress/Drupal sites. It's not unthinkable that Wordpress or Drupal looses interest for the big public. Maybe some other player will show up on the market or a huge security hog will be all over the news. Popularity can drop very quickly and then you're sitting there with your template-tag knowhow. Lots of time spend in ProcessWire is PHP time. PHP will not out of the picture soon and if it does, you learned a proper scripting language, not a template language. I can ask a PHP developer to build a site using PW, give him the cheatsheet, and let him start right away. ( That's unthinkable with the other 2 ) I want to gain valuable knowledge while working having fun, ProcessWire let me do this.
    5 points
  4. Great SUPERB work! Can't believe how mature this already looks and feels! Thanks Ryan and Antti/Avoine.
    4 points
  5. Thank you Apeisa & Ryan. More then awsome.
    4 points
  6. Awesome thanks avoine!
    4 points
  7. Hey are there any drupal convert/devs in here? I have been having an ongoing discussion with a number of firms about Processwire. I am always pushing Processwire pretty hard. I feel like I can do anything with PW! Faster and more elegant than with any other CMS. What I notice is that most good size firms that I talk to are heavily invested in Drupal. Every discussion I have had with developers and stakeholders is the same. They say that Drupal is pretty much the only option for large websites and that it allows them to produce anything extremely fast with all the modules etc. that people have produced... that they never have to reinvent the wheel. My experience with Drupal is that it is extremely cumbersome, produces pretty much the worst output I have ever seen. Has a very poor user experience for managing/organizing and editing content. And makes you work 5 times harder. Granted, you can click a lot of buttons and produce views and get content on the screen... but it seems like so much extra work.. almost like you spend all your time trying to clean up the mess Drupal makes with endless overrides and pounds and pounds of HTML & CSS... gah.... It seems a lot like the way Wordpress works... "there is probably a plugin for that...." But I feel so frustrated with CMSs that have your functionality, workflow, and user experience predefined. I am so tired of fighting a CMS. That is exactly why I love PW... It's never in the way. Let's me work the way I do. Almost all of the larger business/organization websites that I come across are Drupal... So I don't want to be biased and hate on it, that's not my intention. So I guess I am looking for feedback from people who know... Is there really anything in Drupal you cannot do with PW? Is PW a capable platform for large scale websites? (I believe it is, but I am having trouble demonstrating it to people) Is it really less work and more efficient to implement advanced functionality with Drupal vs PW? Thanks in advance for any feedback and contributions to this discussion.
    3 points
  8. Just spotted a PW on Nginx installation tutorial on how-to-forge. I quite like that site - find it useful from time-to-time - so big thanks to Falko Timme for taking time to write it up. Nice
    3 points
  9. I asked the same question from Ryan. It is pretty clever stuff actually: There is also a hint why Ryan deliveres rock solid from the beginning
    3 points
  10. Almost crying right now. Or having multiple orgasms. Or both. So awesome.
    3 points
  11. I just watched the video at home (damn mobile won't let me). Amazing feature to have! Watching this I think the "required" need to be more visible or red (asteriks). It can be missed too easily. And the show animation need to be much quicker! (lol) Not can we have also a hideIf() and a makeCoffeeIf()... I already see the forum full of posts "It doesn't show when..."
    3 points
  12. OK, what programme did you use to make that spoof video?! After effects or something? My goodness! Avoine/Antti, thank you very much!!! As for you Mr Cramer, I don't know what to tell you. Seriously, mate, I can't pick an adjective apt enough. Let's just say that you Sir are one of the best things that has happened to the open source community. Hats off! cheers /k
    3 points
  13. Like it. Like it. Like it! Thanks to Ryan and Antti. @Ryan - would be great to get an audio explanation on your demo videos if possible
    3 points
  14. Figured it out finally: Servint bungled things up and installed APC and Eaccelerator together No wonder things got screwy. Thanks for all your help Ryan, you rock.
    3 points
  15. post_max_size and upload_max_size isn't an option as it wouldn't allow for multiple files and also upload would fail silently. But there's a maxFileSize on file fields, it's not I'm not sure why it's not in the field settings. ... else if($this->maxFileSize > 0 && $size > $this->maxFileSize) { ... I guess it can be set via a hook and you could try setting it to a reasonable size. Sorry, actually it's in teh WireUpload class and not the file field. But anyway it's there for a reason. And it's also maxFilesize in the file inputfield, but it checks for the php post_max_size to get the max size, and this is for all files in a multiple file field.
    3 points
  16. Hi Tester. Welcome to PW and the forums. Not sure what you want to achieve in the end but users in PW are also stored as pages. Hence, they come with a template. You can add as many fields as you like to the user template to store your data and retrieve and display these like any other field using your template file - hence extending "user". To view the "user" template, go to Setup->Template. Then under filters panel, under show system templates, select yes. Scroll down to the now revealed "system" templates. Select the "user" template and you are ready to start adding your custom fields to it . If you wish, you can then hide the system templates when you are done... About IDs, users are automatically assigned IDs when you create them Edited for clarity...
    3 points
  17. ProcessWire Online Installer Since there's now a shortcut to download latest stable PW http://grab.pw , I created a simple helper PHP script you can upload to your server to download and extract a new PW installation. Upload this php file to the server where you want to install latest ProcessWire Go to the browser and call this script. It will download and extract ProcessWire files. Once done successfully it will redirect to the installer. Downloaded zip the grabpw.php will be removed. If anything fails, make sure permission are correct on server and you remove files manually in case. I tested this on my local XAMPP (Mac) install and on some of my account on a ISP. Also I took some methods to download and extract files from my ModulesManager which seems to be "reliable" so far. Download The script can be found on github: https://github.com/somatonic/PWOnlineInstaller Why Just because it's cool. There's many ways to accomplish this task if you have ssh access for example using shell. Just wanted to have this alternative and maybe people find this useful too. @ryan. Do you think you could provide an latest dev shortcut url too?
    2 points
  18. I put this topic here, because I am not sure if it is matter of the image API or a problem with Apeisa's CropImage module or both. Sometimes clients try to upload an image which is too big for image resizing. This is not a bigger problem if this would just fail. But I've experienced some strange behaviours: 1. Problem: Upload works (progress bar ends at 100%) but thumbnail is not generated for the image field (perhaps not too large for upload but too large for resize). This ends up in an uploaded original image in the assets/files folder, but also in a copy of that original renamed to myimage.0x100.jpg which has the same size. If the thumbnal isn't generated the image remains in the files folder. Since it is not written to the database it is not visible after page save. So after editing that page again and another upload the problem repeats. 1. Possible solution: If the thumbnail generation fails, delete both, the uploaded original and the copy and give feedback that something failed. 2. Problem Upload works and thumbnail is generated. But then Apeisa's module fails to generate the defined CropImages (perhaps because generation of three different sizes is too much for a bigger image). Then there is no feedback, the page can be saved. After opening it again the page completely fails with a server error. No possibility to fix the problem without deleting the entry from that image from the database directly. 2. Possible solution: If CropImage generation fails, give feedback and ... well. What then? I think the only way would be to delete the original as well, because otherwise the problem repeats every time after page save. General solution for the image / cropImage field: Possiblity to define a max size (in pixels as well as in kB/MB). Then check the size after upload and deny all image resizing when the image is bigger/larger than defined. I think this could solve a lot of problems, especially on weak servers.
    2 points
  19. I used Gravity Forms a couple of times. While it is build for front-end forms I really like the way the depencies are build there with multiple conditions aka conditional logic.
    2 points
  20. Holy..... whatever. I'm smiling like a king right now. Thanks Antii and ryan!
    2 points
  21. Thanks to Avoine, Ryan, Antti. This is exciting/powerful/wonderful!
    2 points
  22. 2 points
  23. Wanze's suggestion is working great for me. And I was able to keep the max execution time on the server set to 30 seconds. Thanks, Wanze!
    2 points
  24. You can set set_time_limit(30); within the foreach-loop. That way you have higher settings only with that script, not with the whole server. EDIT: If you need for what ever reason a check you can do it at your own: $start = time(); $maxallowed = 600; foreach($somethings as $something) { // ... your code set_time_linit(10); // reset the countdown for every loop! if(time() > ($start + $maxallowed)) { // check the max executed time of the script // break or exit or whatever } }
    2 points
  25. If you can't set the timeout higher, try to load this script from the command line. The script timeout isn't a problem there, as far as I know.
    2 points
  26. Sounds awesome guys, thanks god I didn't go far in developing my site on Drupal, it feels just too cubersome...
    2 points
  27. Maybe you can modify Somas ImageMinSize.module http://processwire.com/talk/topic/4091-imageminsize/ to remove the image if its dimensions exceed your allowed dimensions.
    2 points
  28. It does not matter how large the initial filesize is because if the image is cropped, or edited in any other way, all the pixels go (of course uncompressed) into ram and 3000x2000 are a LOT of pixels. I had the same problem with the 100% progress bar, and the php_value memory_limit setting solved it. Edit: I still would consider training the clients to resize their images before uploading. I think if they work with content they cannot assume that any system eats any type or amount of data. You have to preprocess everything in some way, may it be text or images.
    2 points
  29. Exactly what I thought. Not good to have something that subjective in a license. History taught us that many evil things happened based on this very same idea
    2 points
  30. A bit Very bizzare! - So, if he (the author of json.org) doesn't know: what maybe good for one maybe evil for another one at the same time.
    2 points
  31. hoi, there are now two 'unplanned' additions in the Version 0.0.5: canvas($width, $height, $bgcolor, $position, $padding) $width = mixed, associative array with options or integer, mandatory! $height = integer, mandatory if $width is integer! $bgcolor = array with rgb or rgba, - default is 255, 255, 255 $position = one out of north, northwest, center, etc, - default is center $padding = integer as percent of canvas length, - default is 0 unsharpMask($amount=100, $radius=0.5, $threshold=3) // its the same like the method in Photoshop, credit goes to: Torstein Hønsi for the unsharp mask algorithm (created in 2003 - p h p U n s h a r p M a s k)! ..., can create better results than the default stepResize!
    2 points
  32. Here's some good coffee shop ambient noise: http://coffitivity.com/ I'm testing it out right now, trying to see if I can still focus with the noise.
    2 points
  33. To delete pages you may use delete. http://cheatsheet.processwire.com/?filter=delete (must have been still in m clipboard ) $pages->delete($page, true); // recursive with children $pages->delete($page); $page->delete(); To get pages from the trash you would need include all $pa = $pages->find("parent=/trash/,include=all"); $pages->get() will give you only 1 page. http://cheatsheet.processwire.com/?filter=pages-%3Eget
    2 points
  34. Or a bit of API vodoo. $old_name = 'lizard.jpg'; $new_name = 'wizard'; $p = $pages->find("image.data=$old_name")->first; $p->of(false); // outputformatting off, single and multiple image fields are from now on wire array's $path = $p->image->path; $page_image = $p->image->first(); $ext = $page_image->ext; $orig_image = $page_image->filename $new_image = $path . $new_name . "." . $ext; echo "orig: " . $orig_image . "<br/>"; echo "path: " . $path . "<br/>"; echo "ext: " . $ext . "<br/>"; echo "new: " . $new_image . "<br/>"; // copy and rename copy($orig_image, $new_image); // remove old, add new image to page $p->image->remove($page_image); // orig, will get deleted $p->image->add($new_image); // new $p->save(); Or in a shorter code: https://gist.github.com/somatonic/6282944
    2 points
  35. I respect Drupal, but strongly dislike using and developing in it. This comes from a couple years of developing sites in it. The problems with Drupal have certainly been a motivation in making ProcessWire happen. Out of the box, ProcessWire is going to be a lot better at the large scale than Drupal. ProcessWire's architecture, foundation and API are far better than Drupal (captain obvious). People may use Drupal at large scale, but I don't believe the product itself was ever truly designed for it. Like with WordPress, being used at the large scale is something that happend to Drupal rather than something it made happen. Drupal is a pig that people have affixed wings to because there wasn't any other way to do it at the time. You see similar things happen with the other big platforms (WordPress, Joomla). As far as pigs go, Drupal is a good one. There are some things to respect (though not necessarily agree with) about Drupal's roots and the original thinking behind it. There's no doubt that it is far better than Joomla, for anyone that cares about this stuff. Beyond that, where it excels is in all the 3rd party stuff written for it, to do just about anything. It's a diesel-powered cuisinart in that respect… whatever you need to blend, it will blend… but it'll be messy. Working at large scale, 3rd parties have built all kinds of caching, CDN and load shifting things to throw on top the pile (and likewise with WordPress). Even a pig can fly if you strap wings on to it. And Drupal has a lot of folks thoroughly invested in it to the point where they are making that pig fly. Drupal is also such a household name that it represents a low-risk position for decision makers (low risk of job loss from choosing Drupal). None of this makes it a good product, just a safe one for people that don't know any better. But for people that do know the difference, we want a panther, not a pig.
    2 points
  36. In case anyone is interested in using IRC to chat about ProcessWire, and having consulted with Ryan about it, I have registered #processwire on irc.freenode.net for that purpose. If you are a regular on freenode, just pop into #processwire. If you are not then the fastest way to get online is probably via the webchat interface at http://webchat.freenode.net/?channels=processwire&uio=d4 Hope to meet a few of you in there sometime.
    1 point
  37. Yup, in awe, just like everyone else! A great addition to a great CMS.
    1 point
  38. Yes, #processwire on irc.freenode.net. More info here.
    1 point
  39. About 2 months for me.
    1 point
  40. yeah, so that's a week to everyone/anyone else.
    1 point
  41. There is something that can give you a similar functionality in Textpattern (bot_wtc), but it doesn't translate to the frontend at all.
    1 point
  42. Oh yes. I remember those irc discussions very well. I actually ended building my own form class, which was conceptually kind of mixture from your work and pw inputfields. Field dependencies are a very powerful concept and it gives great pleasure to define once and see it just work in backend and frontend. I am actually pretty hooked on that video. Have watched it three times already
    1 point
  43. Hehe Antti - I seem to recognise the showIf() and requiredIf() calls from somewhere
    1 point
  44. Yes, if and foreach is all you need.
    1 point
  45. I don't deal well with vocals when working so I tend to go for stuff like some of Jean Michelle Jarre's earlier works (Oxygène, Équinoxe or Magnetic Fields) which all work well for me.
    1 point
  46. Update & Contribution For any one else interested, I noticed that when it comes to ProcessWire translating Markdown to html in our field descriptions, the only syntax that it will recognize is the Markdown syntax for inline links. I really would have liked ProcessWire to have supported Markdowns "strong emphasis" triggered by wrapping text around a pair of asterisks. Digging around further I found a comment by Soma here: http://processwire.com/talk/topic/1116-render-html-in-field-descriptions/?hl=markdown#entry27976 So after lots and lots of Googling, this was found: http://stackoverflow.com/questions/4019187/php-preg-replace-to-turn-xyz-to-bxyz-b So.... going to wire/core/Inputfield.php I added this immediately after line 628: $str = preg_replace("/\*\*(.*?)\*\*/", "<b>$1</b>", $str); And Voila... I can now emphasize text in my descriptions!! Going into /wire/templates-admin/styles/main.css and adding something like this... .description b { color: #444444; font-family: "Helvetica Neue", Arial, sans-serif; font-style: normal; } Ends up giving me this: Hope this helps someone... PS You may prefer using <strong> instead <b> Cheers
    1 point
  47. Diogo started the coffee shop sounds. (not the dutch ones) And I must say it works for me. (He could let it rain to)
    1 point
  48. I'd like to add a bit to the great material that has already been posted... Journey From the "Big Three" to ProcessWire... It might seem that ProcessWire is "elitist" because it doesn't assume anything. But let me share my experiences with you, which have led me to the opposite conclusion. I came to ProcessWire from the world of Joomla (and Drupal and WordPress), where all manner of web development building blocks are set up and built ready for you to use, to make your life easier. In fact, you might say that in this way a system like Joomla is the most un-elitist system out there. It assumes you know nothing, and holds your hand through every part of building a web site. For a couple of years, this was good for me. Until one day, when I learned some JQuery and wanted to implement some new concepts, or when I read on Stack Overflow about some creative ways to make PHP do what I need, or wanted to create a unique layout for a client and needed to start from a blank slate, or wanted my user registrations to look unique, or wanted my articles to have 20 separate fields, or wanted a tagging system that looked and behaved in a particular way, or wanted to set up custom search functions for my site. Suddenly, everything about Joomla's un-elitist approach felt stifling. At every step, if I was not doing something the "Joomla way," it didn't work or was 10 extra steps to override something. When I posted about this to the Joomla leaders, I was essentially told, "You don't do it that way in Joomla." When I switched to ProcessWire, I realized that I was now free to implement any good coding ideas I discovered on my own, or discovered on Stack Overflow, or read about in various CSS, Javascript, and PHP realms. Core Assumptions... ProcessWire makes only two assumptions: first, that you have a good grasp of foundational building blocks of the web; second, that you explore the API. On the first point, the assumptions ProcessWire makes are generally the same basic assumptions that would be made if you were developing sites in "pure" PHP/HTML/CSS/Javascript. In other words, any knowledge you gain about these foundational building blocks can be immediately implemented in ProcessWire. On the second point, yes, there are system-specific API elements you need to understand. But they are designed to cleanly facilitate depth and creativity in those foundational building blocks. ProcessWire Trusts Your Intelligence and Capabilities... Put all this together and what do you have? Well, you have a situation where you can create anything you want, because you can get at the foundations of systems that exist on the web. For example, if you need a tagging system, you can learn what constitutes a tagging system. What are the core principles of tagging? Once you understand it, you can build it in ProcessWire. Not only that, but you can build it your way, with no assumptions, freely. If you come from a system like Joomla, Drupal, or WordPress, this means you may have to learn a few new ways to work. But those ways of working -- again -- go directly to the basic building blocks of the web. I know from experience that the un-elitist approach used by Joomla, Drupal, and WordPress seem to be nicer but actually turn out to be very harmful to your individual progress because they delay your exploration of these foundational building blocks. With ProcessWire, because it trusts you to use those foundational building blocks, the knowledge you gain using ProcessWire is applicable beyond ProcessWire and helps you no matter how you create web applications. Put another way, ProcessWire allows you to explore and build in the most un-elitist way possible. With that Said... After all this, there is of course some system-specific material to learn. There is the ProcessWire API, which is unique to ProcessWire. The system has been developed to get as close as possible to "pure" expression, and the syntax of ProcessWire's API calls have only what is needed to get at your data. But yes, there is API syntax to learn here, and the list of specific calls is pretty long. There are "best practices" for combining API elements. There are general goals that we all need for our web applications (galleries, tagging, user registrations, forms, etc) and somewhere there is a good combination of ProcessWire API calls to make them happen. What are those combinations? Well, usually there is more than one, because it depends on what you want to do in your application. The answer may not be pre-packaged, so you may have to hunt a bit. But I definitely agree that it would be great to have documentation of various methods (combinations of ProcessWire API calls and "pure" PHP/CSS/JS) to accomplish various goals. For that, we need what I would call "goal-oriented" documentation. I am proud to say that I am working on this right now. I have been working in silence. But discussions like this make me want to get it out there sooner. * * * I hope this helps a bit. Embrace the way ProcessWire allows you to work! Thanks, Matthew
    1 point
  49. For authors, there were only about 6 of them at import time, so I created the authors as users in PW manually. I also added the "wpid" field to the "user" template, and populated the value of that manually. That was easy to find in WordPress just by editing the author and noting the ID in the URL. The WordPress wp_posts table has a field in it called post_author, which is the ID of the author. So assuming we've got a user in ProcessWire with a "wpid" that matches up to that, it's easy for us to assign the right PW user to each post. You'll see how this takes place in the code below. Wrapping it up Here is the same "import" code as in the first post, but I added all the code accounting for authors, topics, tags, and images back into it. This all just goes in a ProcessWire template file, and viewing the page triggers the import. Because it's aware of stuff that is already imported, it can be run multiple times without causing duplication. <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Import Posts</title> </head> <body> <table border='1' width='100%'> <thead> <tr> <th>New?</th> <th>ID</th> <th>Author</th> <th>Date</th> <th>Name</th> <th>Title</th> <th>Images</th> <th>Topics</th> <th>Changes</th> </tr> </thead> <tbody> <?php // get access to WordPress wpautop() function include("/path/to/wordpress/wp-includes/formatting.php"); $wpdb = new PDO("mysql:dbname=wp_cmscritic;host=localhost", "user", "pass", array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'")); $posts = wire('pages')->get('/posts/'); $sql = " SELECT * FROM wp_posts WHERE post_type='post' AND post_status='publish' ORDER BY post_date "; $query = $wpdb->prepare($sql); $query->execute(); while($row = $query->fetch(PDO::FETCH_ASSOC)) { $post = $posts->child("wpid=$row[ID]"); // do we already have this post? if(!$post->id) { // create a new post $post = new Page(); $post->template = 'post'; $post->parent = $posts; echo "Creating new post...\n"; } $post->of(false); $post->name = wire('sanitizer')->pageName($row['post_name']); $post->title = $row['post_title']; $post->date = $row['post_date']; $post->summary = $row['post_excerpt']; $post->wpid = $row['ID']; // find the post author $author = wire('users')->get("wpid=$row[post_author]"); // if we don't have this post author, assign one (Mike) if(!$author->id) $author = wire('users')->get("mike"); // set the post author back to the page $post->createdUser = $author; // assign the bodycopy after adding <p> tags // the wpautop() function is from WordPress /wp-includes/wp-formatting.php $post->body = wpautop($row['post_content']); // give detailed report about this post echo "<tr>" . "<td>" . ($post->id ? "No" : "Yes") . "</td>" . "<td>$row[ID]</td>" . "<td>$row[post_author]</td>" . "<td>$row[post_date]</td>" . "<td>$row[post_name]</td>" . "<td>$row[post_title]</td>" . "<td>" . importImages($post) . "</td>" . "<td>" . importTopicsAndTags($wpdb, $post) . "</td>" . "<td>" . implode('<br>', $post->getChanges()) . "</td>" . "</tr>"; $post->save(); } function importTopicsAndTags(PDO $wpdb, Page $page) { // see implementation in previous post } function importImages(Page $page) { // see implementation in previous post } ?> </tbody> </table> </body> </html>
    1 point
  50. Very cool Philipp! A great time saver. It worked great on one of my cheapo accounts. Now I just need to enable ZipArchive on my others and I'm set. Cheers Marty
    1 point
×
×
  • Create New...