Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/01/2014 in all areas

  1. Currency Conversion for ProcessWire This module is designed for performing currency conversions among ~165 world currencies. It uses OpenExchangeRates.org (or compatible) for data so that currency exchange rates are always up-to-date. It provides various API functions that you can use to convert from one currency to another. This is especially handy for generating rate tables in multiple currencies or giving users of your site the option to see prices in their currency. How to install How to use API documentation Modules directory page GitHub Page Download ZIP Live Example Requires ProcessWire 2.4.0 or newer. To use the quick-installer from your modules screen, paste in ServiceCurrencyConversion. Basic Example $cc = $modules->get('ServiceCurrencyConversion'); $dollars = 100; // amount of currency we want to convert $euros = $cc->convert('USD', 'EUR', $dollars); echo "<p>$dollars US Dollars equals $euros Euros</p>"; For a live example of a currency conversion tool built with this module see the included convert.php file and test it out here.
    13 points
  2. Textarea Markup inputfield Loosely based on core module InputfieldMarkup, InputfieldTextareaMarkup works with textareas (FieldtypeTextarea) and outputs plain text, markup and optionally values from other fields in Page Edit (backend). That output can be configured via field settings (Input tab) and then modified on a per-page basis, though only by superusers. For an example this: Hello World, I'm a {{template}}, my ID is {{id}} and my name is {{name}}! Would result in a non-editable (except by superusers) "markup field" with content along these lines: Hello World, I'm a basic-page, my ID is 1001 and my name is About! Content pulled from other fields is sanitised using $sanitizer->text() with default options, so no markup should get through, max length for individual field value is 255 etc. The module is available from GitHub. For more details check out README and/or modules directory page.
    9 points
  3. You're welcome. It's always a pleasure to be able to help someone. I'd suggest you (and everyone else for that matter!) take a look at Soma's great Cheatsheet. Click around and discover something new for your toolbox.
    4 points
  4. I still use your testing library every single day that I code PW. It covers all the most important scenarios, so isn't out of date at all. But I will plan to update the tests for the new selector options. It is feasible to support with repeaters, and if there's demand for it I'll add it. PageTable supports them already just because PageTable delegates huge amounts of its functionality to FieldtypePage, including the implementation where the @ grouping option is supported. File or Image fields. File fields can have descriptions just like image fields can.
    3 points
  5. I'm not sure which forum has the record for fastest and most helpful replies, but this one must be pretty close to top of the list! Under 10 minutes for an answer! I had indeed forgotten to add $player->save() - made all the difference (probably more sleep and less time in front of a screen would help too) Thanks Adrian for the tip about wire('input')->post-> instead of $_POST["stuff"] .
    3 points
  6. Couldn't find any translation for Ryan's member title. What is "Reiska"? Google shows some weird Estonian pages... I guess, it is something like "The god of all heavens" or "Megamacho" in suomi, but i would like to fully understand the title of our "beloved leader and godfather of all wires and processes" .
    2 points
  7. Do you hate dislike TinyMCE and heart Markdown? Or Textile? Or HTML? Do you wish there was better way to create content than textarea? Well there is! Content creation oriented, syntax highlighted and easy on the eyes, that is this new plugin I made. And I know you'll love it! And did I mention it supports HTML, Markdown and Textile? Download/fork/star here: GitHub PW Modules Your local modules manager Features Syntax highlight your text, for easier preparation of content Nice light, readable theme Supports Textile, Markdown & HTML Auto selects mode, based on field's textformatters (last found is used) Works with multiple fields on page, each with different settings Features inspired by iA writer Blue Cursor Focus mode We are still kind-of in beta, so please, test your browsers and let me know… Thank you! <3 PW
    2 points
  8. This is depressing: http://www.extremetech.com/computing/183362-windows-xp-rises-from-the-grave-simple-hack-gives-you-five-more-years-of-updates Another 5+ years of IE6-8 When will this madness end?
    2 points
  9. Usually few screenshots helps a lot too.
    2 points
  10. The average Joe/Jane who still uses XP with ie8 will not even know how to "hack" the update thingy, so who cares? Yeah, me too! I am even planning on stating in my TOS, that I only support the last two browser versions of any browser. If the client wants support for older browsers, it has to be in the contract and would add a certain percentage to the overall costs.
    2 points
  11. I have simply decided not to care about IE6-7 since two years ago. Living much happier life now
    2 points
  12. Sorry, forgot to mention that you also need to shuffle if you want random order rather than just random selection. So do this once you have $randWords populated: $randWorks->shuffle();
    2 points
  13. CSV import doesn't require a csv file, you can simply use the manual textfield ... enter title like by line... I found to be the fastest way to create pages.
    2 points
  14. It's more efficient to do it in one find() operation, using the new options available. When using two separate find operations, all the pages from the first find() operation have to be loaded. When you do it in one find(), then those pages don't have to be loaded. So it can actually be a whole lot more efficient, especially if dealing with larger scales. There is still some room for optimization so I'll be working on that, but regardless they should be a lot more efficient than multiple find operations. Another good reason to use OR-groups (and sub-selectors, depending on the case) would be for pagination. You really can't achieve paginated results very easily if splitting into multiple finds.
    2 points
  15. This Module didn't have it's real own thread, now it has Markup RSS Enhanced This Module is the enhanced version of Ryan's Markup RSS Module and is completely compatible with it. In addition, this enhanced module supports the usage of enclosures a way of attaching multimedia content to RSS feeds. Give the RSS enhanced module a PageArray of pages and it will render a RSS feed from it. The Module should be used directly from your template file. In the examples the $rss variable is used for as instance of the module. $rss = $modules->get("MarkupRSSEnhanced"); Basic usage In case you only need 1 feed for your site, you need to setup the defaults in the Modules config. then you can use the code below. $items = $pages->find("limit=10, sort=-modified"); // $items, PageArray of Pages $rss = $modules->get("MarkupRSSEnhanced"); // load the module $rss->render($items); // render the feed Setup channel elements The channel element describes the RSS feed. There are 3 required channel elements: title $rss->title link $rss->url description $rss->description $rss->title = ''; // (string) Title of the feed. $rss->url = ''; // (string) URL of the website this feed lives. Example: http://www.your-domain.com/ $rss->description = ''; // (string) Phrase or sentence describing the channel. $rss->copyright = ''; // (string) Copyright notice for content in the channel. $rss->ttl = ''; // (string/integer) Number of minutes that how long it can be cached. Setup item elements Every page from the PageArray use the item element. $rss->itemTitleField = ''; // Fieldname to get value from $rss->itemDescriptionField = ''; // Fieldname to get value from $rss->itemDescriptionLength = ''; // Default 1024 $rss->itemEnclosureField = ''; // Fieldname to get file/image from $rss->itemDateField = ''; // Fieldname to get data from $rss->itemLinkField = ''; // Fieldname to get URL from or don't set to use $page->httpUrl $rss->itemAuthorField = ''; // If email address is used, itemAuthorElement should be set to author $rss->itemAuthorElement = 'dc:creator' // may be 'dc:creator' or 'author' Item element enclosure RSS enclosures are a way of attaching multimedia content to RSS feeds. All files with proper mime types are supported. If you asign an image field to the itemEnclosureField there are 3 extra options you could set. width The width of the image. height The height of the image. boundingbox Checking boundingbox will scale the image so that the whole image will fit in the specified width & height. This prevents cropping the image $rss->boundingbox = 1 // (integer) 1 or 0, on or off $rss->width = 400; // (integer) Max width of the image, 0 for proportional $rss->height = 300; // (integer) Max height of the image, 0 for proportional Prettify the feed Prettifying the feed is not supported by all clients. $rss->xsl = ''; // path to xls file $rss->css = ''; // path to css Download on GitHub View on the modules directory
    1 point
  16. I just pushed ProcessWire v2.3.1 to the dev branch. This is a fairly major change in that it switches the DB driver from mysqli to PDO. It meant changes to a large percentage of core files. ProcessWire still supports mysqli, but doesn't attempt to use it unless a module or a template asks for it via the $db API variable. The new API variable (for the PDO driver) is $database. More about PDO at php.net If you are using the dev branch, be careful and test thoroughly with this latest commit to it. Before upgrading, you may want to double check that your PHP supports PDO by looking at your phpinfo (CMD-F or CTRL-F for "PDO"), especially if you are running PHP 5.2.x (where PDO wasn't compiled in by default). Though if you are running PHP 5.2 (vs 5.3.8+) then you may want to just stick with ProcessWire 2.3.0 and upgrade your PHP version when possible. If you are using any modules that use the procedural version of mysqli functions (vs. the $this->db object oriented versions), or type-hint mysqli in methods, then those modules will no longer work. If you come across any modules that don't work with 2.3.1, please let me know here so that I can assist the author in updating them. Note that FormBuilder is one of the modules that does not work with 2.3.1, but I have posted an update in the FormBuilder board that corrects it–so be sure to download that version if you are tracking the dev branch of ProcessWire and using FormBuilder. What this new version adds: 1. New API variable $database that refers to the PDO database. The old $db API variable is still there and refers to mysqli for any modules that continue to use it. 2. New API variable $log that lets you easily log messages or errors to the system logs. Usage: $log->message("This saves this line to messages.txt"); $log->error("This saves this line to to errors.txt"); $log->save("my-log", "This saves this line to my-log.txt"); // Get an array of the last few entries saved to the messages log $entries = $log->get('messages'); // Get an array of the last 50 entries saved to my-log $entries = $log->get('my-log', 50); Note that as always, log files are located in /site/assets/logs/. 3. Conditional autoload modules. In PHP 5.3+, modules may now specify an anonymous function OR a selector string, rather than a boolean for the 'autoload' property returned by getModuleInfo(). PW runs the anonymous function after determining the current $page, so your module can make autoload decisions based on the $page (or any other factor you'd like), if desired. Lets say that we have a module that we only want to autoload when the template is 'admin': public static function getModuleInfo() { return array( 'title' => 'Module Title', 'summary' => 'Summary text...', 'version' => 1, 'autoload' => function() { if(wire('page')->template == 'admin') return true; else return false; }); } And the same example but using a selector for autoload: public static function getModuleInfo() { return array( 'title' => 'Module Title', 'summary' => 'Summary text...', 'version' => 1, 'autoload' => 'template=admin' ); } 4. Addition of $pages->add() method. Actually $pages->add($template, $parent, [string $name], [array $values]); This function adds a new page to the database and returns it. This is for syntax convenience, but using the old method is still perfectly fine too. Here's a few examples of usage: // add a new page using template basic-page under /about/ $newpage = $pages->add('basic-page', '/about/'); // same as above, but named 'contact' $newpage = $pages->add('basic-page', '/about/', 'contact'); // same, but populate the title field too $newpage = $pages->add('basic-page', '/about/', 'contact', array('title' => 'Contact Us')); // you can also do this, specifying the values array as 3rd argument: $newpage = $pages->add('basic-page', '/about/', array('title' => 'Contact Us')); $template and $parent are required, but may be objects, IDs, or string identifiers (like name for template, or path for page). When you add a new page and don't specify a 'name', then PW will make one up, guaranteed to be unique. 5. Module files that end in '.module.php' are now supported. So rather than ClassName.module, you may use ClassName.module.php if you prefer it. The purpose here is to support text editors that determine their syntax highlighting based on the file extension. More updates being made almost daily. Please report any issues you experience. Thanks, Ryan
    1 point
  17. Hard to blame sysadmins only though. It's complex issue, involving developers and companies also. OT: I think one of the reasons I don't have much interest in mobile apps - lock in to hardware and os. Happy to see most new apps seem to be hybrids, where only small part is native (nav + webview).
    1 point
  18. I think you have file field instead of image field.
    1 point
  19. It's not the average Joe/Jane I am worried about - it's the government sysadmins that are too lazy to upgrade their staff! I don't support old IE on most projects, but some I still need to
    1 point
  20. Good to hear that it makes sense (at least after a while). Seriously speaking, should probably start doing screencasts for all the modules.. these things are so much easier to show than explain
    1 point
  21. We have updated ProcessImageMinimize to version 1.0.2 This version includes some fixes regarding the interaction between the module and minimize.pw's API. Please make sure to update all your sites in order to prevent problems. Additionally, if you have found any bug, please open a ticket. Thank you in advance for your help!
    1 point
  22. I was just curios about how fast PHP handles the different types of string concatenation/parsing with variables, because I saw Ryan's style is double quotes and I was thinking, isn't that slower than single quote concatenation? I was surprised because I remember to have learned that the additional parsing of double quote strings make the whole thing slower. I was wrong, here is my benchmark. Thought it'd be interesting to know. 1000000 times per test // initial object creation, only once $fooObject = new stdClass; $fooObject->foo = "Lorem ipsum dolor sit amet."; $fooObject->bar = "Consectetur adipisicing elit."; $fooObject->baz = "Sed do eiusmod tempor incididunt."; double quotes "foo: {$fooObject->foo}, bar: {$fooObject->bar}, baz: {$fooObject->baz}" 0.55859899520874 s single quotes concat 'foo: ' . $fooObject->foo . ', bar: ' . $fooObject->bar . ', baz: ' . $fooObject->baz 0.61702013015747 s sprintf sprintf("foo: %s, bar: %s, baz: %s", $fooObject->foo, $fooObject->bar, $fooObject->baz) 1.6139810085297 s array implode implode('', array('foo: ', $fooObject->foo, ', bar: ', $fooObject->bar, 'baz: ', $fooObject->baz)) 2.0107381343842 s Code: <?php $times = 1000000; ?> <h1>PHP string concat benchmark</h1> <p><?=$times?> times per test</p> <code><pre> $fooObject = new stdClass; $fooObject->foo = "Lorem ipsum dolor sit amet."; $fooObject->bar = "Consectetur adipisicing elit."; $fooObject->baz = "Sed do eiusmod tempor incididunt."; </pre></code><br> <hr> <?php function microtime_float() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } $fooObject = new stdClass; $fooObject->foo = "Lorem ipsum dolor sit amet."; $fooObject->bar = "Consectetur adipisicing elit."; $fooObject->baz = "Sed do eiusmod tempor incididunt."; $time_start = microtime_float(); for ($i=0; $i < $times; $i++) { $someString = "foo: {$fooObject->foo}, bar: {$fooObject->bar}, baz: {$fooObject->baz}"; } $time_end = microtime_float(); $time = $time_end - $time_start; ?> <h2>double quote</h2> <code>"foo: {$fooObject->foo}, bar: {$fooObject->bar}, baz: {$fooObject->baz}"</code><br><br> <?=$time?> s<br><br> <hr> <?php $time_start = microtime_float(); $someString = ''; for ($i=0; $i < $times; $i++) { $someString = 'foo: ' . $fooObject->foo . ', bar: ' . $fooObject->bar . ', baz: ' . $fooObject->baz; } $time_end = microtime_float(); $time = $time_end - $time_start; ?> <h2>single quote concat</h2> <code>'foo: ' . $fooObject->foo . ', bar: ' . $fooObject->bar . ', baz: ' . $fooObject->baz</code><br><br> <?=$time?> s<br><br> <hr> <?php $time_start = microtime_float(); for ($i=0; $i < $times; $i++) { $someString = sprintf("foo: %s, bar: %s, baz: %s", $fooObject->foo, $fooObject->bar, $fooObject->baz); } $time_end = microtime_float(); $time = $time_end - $time_start; ?> <h2>sprintf</h2> <code>sprintf("foo: %s, bar: %s, baz: %s", $fooObject->foo, $fooObject->bar, $fooObject->baz)</code><br><br> <?=$time?> s<br><br> <hr> <?php $time_start = microtime_float(); for ($i=0; $i < $times; $i++) { $someString = implode('', array('foo: ', $fooObject->foo, ', bar: ', $fooObject->bar, 'baz: ', $fooObject->baz)); } $time_end = microtime_float(); $time = $time_end - $time_start; ?> <h2>array implode</h2> <code>implode('', array('foo: ', $fooObject->foo, ', bar: ', $fooObject->bar, 'baz: ', $fooObject->baz))</code><br><br> <?=$time?> s<br><br>
    1 point
  23. a few links: bandwidth thing looks good SiNNut. jQueryPicture looks nice to but don't support support the bandwidth thing. ( no go ? ) as mentioned before Picturefill and Foresight What others say: http://www.mangrove.com/blog/1123/responsive-images
    1 point
  24. Yeah, the likes in the site directory.
    1 point
  25. @horst actually, hisrc has bandwidth checking https://github.com/teleject/hisrc/blob/master/README.md
    1 point
  26. Individual images may not have a dedicated ID, but the page ID they belong to + the filename is always unique, so that's all you'd need. Of course, you could always manage pages-to-images on a 1-to-1 basis, but if you wanted to have a page with multiple images on it, each with their own URL, you could also enable URL segments for your template and output them like this: $filename = $input->urlSegmentStr; $image = $filename ? $page->images->get($filename) : null; if($image && $image instanceof Pageimage) { // output your image content echo "<img src='$image->url' alt='$image->description' />"; echo "<p>$image->description</p>"; } else { // output your regular content echo "<h1>$page->title</h1>$page->body"; } With regard to a likes system, is what you are looking for something similar to the likes system you see in our sites directory or the recommendations system in our modules directory (both are actually the same system). If so I can pass along a little more info on how that was done.
    1 point
  27. Responding to your points, duplicating what you're saying in most cases. 1. PageimageAdaptive->getConfigInputfields() is the place I think. (inputfield settings) 2. Agree 3. Indeed we need a adaptiveRender() methode or something. And a FilenameArray, from low -> hight 4. Request with PageImage options, defaulting from point 1, but overwriting possibility per PageImage. 5. As this should work with ProCache. Maybe we can find a way that works native in one or more modern browsers with a js fallback for the others. Basically I tell drop my idea and find a way to show deafult image if JS is disabled and picture element is not supported. ps, Other members, it's open for discussion
    1 point
  28. A couple of really quick comments. Have you tried saving $player? $player->save(); or $player->save("game"); Also you should use: wire('input')->post->user_id; It's the PW way and apart from looking cleaner it also takes care of any magic quote discrepancies between servers.
    1 point
  29. i tried using the shortcode module, and it is promising, and quite different than hanna codes; shortcodes allow you to have an opening and closing tag so you can enclose things within, which allows you to use them for things like tabs and accordions; hanna code is very usable/flexible, but it doesn't know about things between each instance of itself (no opening/closing)... also the shortcodes module doesn't allow for using more than 1 shortcode on a page.. i think it needs more work; but it would be good if we could have a shortcodes module that works as well as the wordpress shortcodes, since there are still some rare use cases where shortcodes can be useful... custom fields replaces and is superior for the most part to the concept of shortcodes, which is probably why the need has not come up much on PW. And end users always mess up with shortcodes, like putting them in the wrong place in the RTE (like inside a heading), or forgetting to use the closing tag, and consequently break the layout on pages too easily...
    1 point
  30. What i would do is have a custom management page with a table showing all the tracks and then i would output the page ID in it's own column so they could double click it and copy it into foxycart. but short of that, yes you would need to grab the page id from the URL... funny though - most labels i work with already have catalog #s for their albums; a good sku setup would be the page for the album - page for the track (like 2034-9812) then you could at least see which tracks are part of the same album...
    1 point
  31. Fantastic work, kongondo. Your module is much needed for those of us who don't want to spend a lot of time stripping out the markup on Ryan's (equally awesome) blog module. One question: I notice that blog posts have this url: www.domain/blog/posts/my-post-here Have you considered any approach which might remove "/posts/" from that URL? My existing blog doesn't have the extra segment and I'd love to keep it that way, if possible. I've also been thinking I could remove it via htaccess.
    1 point
  32. Logical thinking has nothing to do with a language. jQuery solves compatibility issues ( can be solved without ). It's more obvious how to use. But requires jQuery & the plug-in to be loaded. ( extra requests ) On the other hand I don't know a project where I don't use jQuery (other people ?) And calling the jQuery plugin is so much easier for your eyes.
    1 point
  33. Nope, clever ! Do you think a jQuery plugin suits better, basically more like this ? // calling like this $(".adaptive").adaptive({ sizes: { 'tiny': 0, // from 0 till 399 'small': 400, // from 400 till 699 'tablet': 700, 'desktop': 1200 }, delay: 400 }); // or calling like this or something $(".adaptive").adaptive(<?= $wireAdaptiveImage->settings() ?>);
    1 point
  34. Thanks Martijn, I will try out later, or tomorrow. one thing I think it could have is a log which versions it has loaded. Means if it has already a larger version, there is no need to load a smaller one when resizing the window. (assuming it is displayed fluid!) But the decision to load a new one or not cannot depend simply on the direction of window resize, resize smaller = no load | resize larger = load, that's wrong. onload it's medium resize small <= resize large => = only 3. need to load a new image onload it's large resize small <= resize medium => = no need to load a new image, even when window resizes larger Or is this stupid?
    1 point
  35. Not sure if there are any instructions posted yet, but if you install the module from the core list, the setup of a new field with this type is well documented. I am sure you'll get the hang of things from playing around for a few minutes. There is some discussion about PageTables from this post onwards: https://processwire.com/talk/topic/6417-processwire-profields-table/?p=62890
    1 point
  36. Ryan's on fire! There's nothing too big missing from the selector engine after this update anymore. But it seems like someone should start a whole new project on testing PW. My old project (on selectors mainly) has fallen way behind and I'm not sure it's a good basis for any broader testing. There's a lot of new stuff in place already and I'm sure there will be much more in the future, along with fixes and optimizations. Regarding selector grouping from a while back: What about repeaters - if I'm not mistaken their not supported? This thread has an example of a situation where grouping would have made things a whole lot easier. And didn't try it out at all but I guess PageTable isn't supported either. I'm happy to ditch the rest of my repeaters if only PageTables would be supported in the future.
    1 point
  37. So epic It just nickname we have been calling Ryan here at Avoine office. I mentioned that to Ryan and since then it has been his member title. For Finnish people Reiska is quite a traditional nickname and most famous Reiska is indeed Remontti-Reiska, who has been celebrity (also popular among ladies) here for a long time. I agree with Teppo, he represents only the finest values - not anything God like here though, but maybe our dear neighbors at Estonia sees him as a god I'm just giggling here for the idea many people googling and wondering about that strange connection
    1 point
  38. I don't know for sure what Reiska means either, but @apeisa told me that was apparently my Finnish name and that it means something along the lines of handyman. I had a member-title spot open, so I put it there. But if it's translating anywhere as "god of all heavens" or something like that, then I need to change it. I'm okay with being a handyman or somebody that fixes things, but need to change it reads as something egotistical.
    1 point
  39. Well, I read through your code a week back but couldn't spot any obvious flaw. Now I had another look and feel like I should've seen it in the first place... Actually you did yourself in the very beginning as you had the very same problem then. You're welcome. And you should still hang on to what you had working . Here's the problem line (core of it anyway): $matches = $all->find("rental_period.date_from>=$df, rental_period.date_to<=$dt, rental_period.booked=0"); As you figured out before (and Ryan confirmed you right), this kind of selector is something to beware of. While all of the three conditions must match, they only have to match the same page (property_availability), not the same repeater item. So this would match any page that has rental_period-repeater with one item matching the condition for date_from, another item matching the condition for date_to and third item matching the condition for booked. All the conditions could have a match in the very same repeater item, but that's not required (and you'd want it to be). That's just the nature of repeaters. Nasty, I know. Take the version with working date ranges and add the capacity and region handling like you have now in the beginning. Then, instead of first finding all cottages matching region and capacity, just go for the repeater items matching the date range like before and modify the match handling like this: foreach($matches as $item) { $property = $item->getForPage(); if(!$property->viewable()) continue; // skip if property is unpublished or something // add this: skip the match if it doesn't match your region or capacity if(!$property->matches($filterSelector)) continue; // now you have the $property and the matching repeater $item $termCottages[] = $item->id; } Here $filterSelector should be empty if no region or capacity has been chosen. Or it could be something like "location=xyz, sleeps>=10" to rule out any cottages not located in xyz or having capacity of less than 10. I haven't tested it but naturally it'll work like a charm . So you were on the right track all along. Just don't go for something that's been proven faulty for this scenario before.
    1 point
  40. Also make sure that /site/assets/sessions/ dir is writeable.
    1 point
  41. Hi, First I will like to say my thanks for the module as I am using it in my solution. I needed to crop images based on their width only in some cases, I read the thread and there was a discussion of implementing it, not sure what was the conclusion but looking at code shows me that it is not implemented. As I understand that ImageSizer's resize function can work without providing a height (or providing 0) and in this case it only considers width. Isn't it logical we remove the height condition from condition as follow, ($this->w < 1) { throw new WireException(sprintf($this->_("Width not found for thumb: %s"), $thumb)); return; } and if height is 0, then $sizer->resize($this->w, $this->h) will just work fine based on width. I have tested and it works fine but before I deploy it on production I need an opinion? Thanks
    1 point
  42. Hi all, I'm a big fan of the Sublime Text 2 text editor and of course of huge fan of ProcessWire, so I went ahead and created a library of PW snippets to be used with the ST2 Snippet system. I followed the PW cheat sheet, and created Advanced and Basic versions. The Advanced version contains only those seen in the advanced mode of the cheat sheet, so if you want the full set, you'll want to get both Basic and Advanced. They are on GitHub here: https://github.com/evanmcd/SublimeProcessWireSnippetsBasic https://github.com/evanmcd/SublimeProcessWireSnippetsAdvanced I've just submitted the Advanced set for inclusion into Package Manager, so hopefully that will be added soon. See the README for more info. Any feedback welcomed
    1 point
  43. Just found this gem here https://sublime.wbond.net/packages/ProcessWire%20Snippets%20-%20Basic https://sublime.wbond.net/packages/ProcessWire%20Snippets%20-%20Advanced Installing on SublimeText3
    1 point
  44. Add novalidate to the form attributes and theyr gone.
    1 point
  45. The more simpler and direct way for a custom select would be: $sel = $modules->get("InputfieldSelect"); $sel->attr("name", "cms"); $sel->addOptions(array( 'pw' => 'ProcessWire', 'joomla' => 'Joomla!', 'wp' => 'Wordpress' )); // setting the value will select the option, here with coming either from post or the default $sel->attr("value", $input->post->cms ? $input->post->cms : 'pw'); echo $sel->render();
    1 point
  46. And I've started to do it (the section for WireArray is now updated). The system Soma put together here is fantastic. Yes it can. Though I think $pages->add() is mainly useful without going to far on the fields there. I still find the regular syntax (populating the field values directly to the $page object) the most readable. I'm a little confused, as there aren't any parallels between MODX and ProcessWire in this regard. Though if ProcessWire were to stop evolving, then maybe that would be a parallel with Evo? (though glad to hear others are working on continuing Evo). No plans to stop evolving here. Switching to PDO, then namespaces and composer support is part of that evolution. This evolution is important for ProcessWire to grow and ensuring it remains the best tool for the job. All ProcessWire upgrades are optional of course. You don't have to upgrade unless you want to. I'm still running Photoshop CS3. ProcessWire is a big enough software that some changes will be more valuable to some than others, depending on what you are doing with it. As ProcessWire evolves, sometimes modules that want to support it will also have to evolve. As for now, FormBuilder is the only module I'm currently aware of that had to be updated in order to keep working with this version. That's not really a surprise, as FormBuilder is probably the most complex PW module out there. There may be more, but none that I've come across yet. What I'm much more shy about is doing anything that would require changes to one's site templates. I see API syntax as locked for changes, but not additions. We would version the API if any major syntax changes were ever necessary. So upgrading from one version of PW to another should rarely if ever require changes to your own site templates, unless your site templates are doing some very low level stuff. As for server, PHP 5.2 was EOL'd by the PHP team more than 3 years ago. They are no longer updating it. Meaning, none of us should still be using it, at least not for current projects we are maintaining or keeping up-to-date. Trying to maintain PHP 5.2 compatibility through future versions would be a drag on the project and people's usage and perception of it.
    1 point
  47. If you use PW form API, it will get validated if you call processInput() $form->processInput($input->post); I think the CSRF doesn't get reset if the CSRF was valid, but you can do it manually with $session->CSRF->resetToken(); after validating the form. Or if you do manual form and not use InputfieldForm you can generate and validate the token $session->CSRF->validate(); // will throw exeption if invalid And get the token name and value with it respective methods $session->CSRF->getTokenName(); // name for input hidden $session->CSRF->getTokenValue(); // token value Also the trick renobird mentioned is also very good to prevent double click submission errors. Of course you can still use redirect method and as you may found the $notices errors and messages are transported through redirects.
    1 point
  48. The current approach makes it possible to share images between Pages - that's nice, but what happens if I delete a Page that contains images reference by a body-field in another Page? I see at least 3 different common image use cases: Inline images belonging exclusively to the body-field where they're used Inline images shared between multiple body-fields Associated images for specific purposes (non-inline use) You can handle number 1 with the current approach, but you can't guarantee the images won't be shared with other pages, hence you can't be sure it's safe to delete a page that contains images - or worse, you may have to delete a certain page, and you will need to first somehow recover the images, place them somewhere else and update you references to those images. You can handle number 2 with the current approach, but it forces you to create dud pages to hold the images. Number 3 is handled perfectly, and that seems to be what this approach was really designed for - basically any inline use-case seems like a bit of an afterthought and the solutions aren't really ideal. I looked at soma's module, but it kind of seems to solve a different set of problems. Ideally, I'd like to have some sort of media manager, not only for images but for audio, video, documents and links to external media, as the same set of problems apply to all of those - in particular, the ability to share and track the usage of all media items. I think this is why most other CMS have a media management component of some sort? The ability to organize a media/image library into categories etc is a nice bonus, but simply being able to manage and use media in a controlled way seems more fundamental to me...
    1 point
  49. This is as simple as: $field = $modules->get("InputfieldSelect"); $field->attr("name", "myselect"); $field->addOption("myoption1", "My Option 1"); $field->addOption("myoption2", "My Option 2");
    1 point
  50. I never knew the name for it. It's good to hear that, "flashdata". This was mainly setup so that modules could queue messages that would only be seen on a follow-up page. Since many modules do a session->redirect() after a save, there needed to be a way to queue those messages to be seen on the following page load rather than the current (where they would never be seen). I don't think that you actually have to call $session->message(), as I think any notice sent through message() or error() gets queued. Though calling $session->message() is a good way to make that intention clear from the code side.
    1 point
×
×
  • Create New...