Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/14/2014 in all areas

  1. I just thought of a way to implement a statically-typed event sink in PHP - check it out: http://www.tehplayground.com/#hh9WpisbY This has a couple of interesting properties - primarily the fact that you can register listeners without passing a class-name or method-name as a string, but also the type-hints would get you IDE support, e.g. auto-complete and safe refactoring in PhpStorm. I'm using a "hack" to delay auto-loading as well - it turns out, by parsing the type-hint with a regular expression applied to the string-representation of a ReflectionParameter (of the registered closure) you can avoid auto-loading until the registered closure actually gets called. In other words, you can register listeners without auto-loading the class that implements the message it's listening for - that is, $sink->register(function(Foo $foo) {}) will not cause class Foo to auto-load, which means you could register all your global listeners of every module on start-up without the overhead of loading any additional classes. I don't think this really fits with the existing concept or architecture in ProcessWire, but it seems like an extremely powerful idea, and I figured, if somebody is going to find this idea useful, this might be the right place to post it. Anyhow, there it is
    3 points
  2. I'm loving the new admin theme, it's such a huge step up. The suits around here were always pushing for us to make a custom one but I think it's plenty attractive now. Amazing work!
    3 points
  3. This is already old news to many of you here, but I finished writing up the full announcement today so figured I should post it (click the link below). Numerous upgrades and refinements make ProcessWire 2.4 our most friendly and powerful version yet! ProcessWire 2.4 is focused on listening to the feedback from of our users and answering with the best CMS experience for web designers/developers and their clients. Read the full announcement. For those upgrading from a previous version of ProcessWire, please read all of the upgrade instructions. Hope that you enjoy this new version! A huge thanks to Avoine for sponsoring the Field Dependencies feature new to ProcessWire 2.4!
    2 points
  4. No need for site exporter. Just site folder and db. Done.
    2 points
  5. Hi, its possible. I made file field as mp3 storage with player this way. It is used here.
    2 points
  6. For files, check the $_FILES array instead.
    2 points
  7. $angebote = $pages->find("template=travelCat, id!=123|156|736, sort=sort");
    2 points
  8. Welcome to ProcessWire gunter... Just to add on to what Adrian has said..., technically, there is no relationship between a template file and fields. There is a relationship between templates and fields. That's why you need to clarify your situation. If you want to change the template of a page (call it template 1), and the new template (template 2) you are changing to does not have the same fields that are in template 1, then PW will give you a warning: "Warning, changing the template will delete the following fields:". It will list the fields that will be deleted. If you click the checkbox "Are you sure? Please confirm that you understand the above by clicking the checkbox below." they will then be deleted...Other than that, template files are used by the user (technically instructed by the user) to grab what's in your fields and display the output to the browser
    2 points
  9. Could you specify what kind of field this is that's not saving, TextareaLanguage or something else? Based on your second post I'm guessing that data still gets saved to db tables, is that right? Are you using the default theme ("new" or old) or something else? I'm currently running a fresh test site where this seems to work properly, so any additional information would be helpful. I'd probably approach this directly via database. Table version_control_for_text_fields contains all changes and timestamps for those, so it would be easy to grab changes made during last 24 hours. Rest depends very much on what you want to send, i.e. do you want to also describe how content in each field changed and so on, so there's really no simple answer for this one. Two tables, actually, and you're right in that those are language values. All values are stored mostly because that's what ProcessWire itself does -- it updates all language values simultaneously. You're right in that it feels a bit weird, especially here where rows are stored potentially for a very long time. I'm not yet sure how to get more specific data from ProcessWire (which language version has changed), so setting these values separately might require another method for handling data. This could also make certain database queries a lot more complicated. Created an issue for this one so I won't forget it right away..
    1 point
  10. Thanks Nico. After three weeks, we want to share our experience and some informations about the module and service. We think that an open and honest approach on this topic might help others to develop great commercial (and free) modules. minimize.pw started as an internal solution for a problem. Working with an agency with large PNGs, we searched for a way to compress them with PNGQuant. We thought that other developers would be interested in this kind of a service and that lead us to the decision to make it a commercial service. We have to pay for the servers and maintenance. The whole developement took around 3 days with some additional hours in writing backend jobs like backups and payment management. As today, 21 days after launch, we've only got a single "Free" signup and zero licences sold. We got some E-mails and questions but nothing more. Beside our internal usage on three client sites not much happened. We didn't expect much, but we thought there would at least be more free signups. So what went wrong? Well, we made some assumptions: There is no interest in this kind of service. The pricing is to high and the free plan isn't worth a look. Our website could't convince visitors to use the service To many open questions because there isn't a FAQ or something similar We just have to wait longer The module missed some important features We hope that the first point isn't true. With some feedback from twitter, we think that there is a market for some developers to use this service. The same applies to the last point - at least we should have some more signups. So we might have to improve the remaining 4 assumptions. In the next week, we will update our service/site: An improved and better free plan: You will get 1000 images per year and you don't have to renew after a month. More images on new paid plans (replacing the old monthly model):Standard with 30 000 images / year and up to three sites for 39€ Large with 100 000 images / year and ten sites, 99€ A new webpage with better examples and a FAQ. We will later add a case study with a larger site. Planned features for the module itself:Compression while uploading images Replace images instead of making variants (as an option) Usage with the Thumbnails module (CropImage) (An Async performance modus) But before doing this, we would be glad to hear what the community thinks about this. We would appreciate some feedback and/or your thoughts on the service and the module. P.S. Here is a special key with unlimited images and sites, valid for the next four weeks: zE1DptpPYN
    1 point
  11. I don't want to meshup (is that a word ?) with the great post of Radek. But I have good experience with mediaElement.js to use audio & video.
    1 point
  12. Or if you dont need support for old browsers you can try something like this: This one have redirection after play. HTML <audio id="audio" hidden> <source src="./sound/sound.mp3" type="audio/mpeg"> </audio> <div id="menu"> <li> <a href="http://www.google.com">Click to play...</a> </li> </div> jQuery var target; function checkAudio() { if($("#audio")[0].paused) { window.location.href = target; } else { setTimeout(checkAudio, 1000); } } $('#menu li a').click(function(e) { e.preventDefault(); target = $(this).attr('href'); console.log("Let's play"); var sound = $("#audio"); sound.get(0).play(); setTimeout(checkAudio, 1000); });
    1 point
  13. I think this depends on your needs. If you want use some button and hide it with css/js or if you dont need playlist (example) or other controls maybe is better use some simplest plugin like Ion.Sound (not tested) .
    1 point
  14. Yes...an mp3 is just another filetype to the browser just like .pdf, .doc, .zip, .exe.....It just needs to be told what to do with it
    1 point
  15. http://modules.processwire.com/modules/audio-mp3/ and also: http://modules.processwire.com/modules/local-audio-files/
    1 point
  16. Thanks guys. I'll take a look over those 2 modules. PW is being looked at as an alternative to our in house CMS and I've just finished the site and will be doing staff training on it later today.
    1 point
  17. There is no reason that you have to have any hard coded text at all really - if you are creating tabs, for instance, you can have the tab headers as fields, either generated by the page that is supplying the pane content or, if you are using them more globally, from some sort of global settings page. Then you can use multi-language fields quite happily.
    1 point
  18. Hi gunter and welcome to PW. I am not sure why you are losing fields - perhaps you can elaborate, but regarding template name changes - if you go the advanced tab of the template settings you can rename the template. You can also choose to use an alternate template filename if that is at helpful in your scenario. Hope that helps.
    1 point
  19. Yes, I can see all the work that you guys had to make them responsive Definitely worth it though!
    1 point
  20. I just installed it, and WOW! As an Expression Engine developer this latest visual upgrade make me feel even more at home in processes wire. I love the look of the new fields. I'm in heaven! getting much more user friendly. The new module manager is awesome! Big "thank you" to the theme development team.Joyful is how I feel setting up my first site in 2.4. Thanks.
    1 point
  21. There aren't many tools I look forward to using every single day. PW has always been a joy to use and this release makes it even more so. Thanks Ryan and everyone who worked on this release!
    1 point
  22. Thanks Ryan for this new awesome upgrade. PW changed my life
    1 point
  23. Yes, the original BBC article is here: http://www.bbc.co.uk/news/technology-18819338 The entire world of internet advertising is, I think, very dodgy. I have had two clients over the last couple of years who I have lost because they moved from traditional advertising to internet advertising. Both have now returned as their internet advertising failed to live up to the hype - these guys were using proper agencies too, not just doing it themselves. The problem is that response does not necessarily turn into sales. Personally, I think a major issue is the company Facebook page. If an advert drags you to a facebook page, you are faced with something that is not unique, has predictable tools and basically, looks pretty much like the competition. Also, any calls to action are relying on live posting (which slides down the page) and the written reaction from other posters. If the advert drags you to a bespoke website that is well designed, it can be stuffed with information, calls to actions, love and honey. Look at it this way. If you were Amazon.xx would you want people to be taken to Facebook or to Amazon?
    1 point
  24. This is pretty sweet Great stuff, Ryan!
    1 point
  25. Update: version 1.3.0, just pushed to GitHub, adds support for repeaters -- or, to be more precise, support for saving revision data for fields that are within repeaters. Repeaters being pages after all, it seemed most logical to treat them as such. If repeater field added to a template for which version control has been enabled contains fields that are also under version control, values of those fields will be stored just like they would be for the main page (page containing the repeater field). I'm not confident that my explanation made any sense, so let's just say that this should be self-evident once you try it. Main point is that instead of saving repeater values on per repeater basis the module is treating individual repeater fields (or repeater field fields..) separately Another thing to note is that snapshot feature added in previous update is now module called PageSnapshots. It's still bundled with VersionControlForTextFields and initiated (and automatically installed) by VersionControlForTextFields init() method, so this shouldn't change anything. I'm simply trying to keep the "core" version control module as lean as possible. Once again, I'd suggest making sure that things work properly before putting this update into real world use. There have been a lot of changes and something could've broken. I've tried to write and run tests vigorously, but those definitely won't catch all issues.. yet
    1 point
  26. Nice work mvdesign, I like the concept here. It's similar to something I'm working on at the moment (I'm switching it to PW 2.4 admin concept so I've delayed its release until it's done).
    1 point
  27. What version of PW are you using? I thought we had this fixed on dev quite awhile ago (now 2.4).
    1 point
  28. It's unlikely a single module will provide everything everyone will need for a login/registration system, because everyone's interpretation of its requirements will be different every time. Will users use email or usernames? What other details do you need to capture about the user? What validation needs to happen on these extra fields? Do people need to validate their email addresses, or do accounts have to be approved manually? What security roles and settings need to be applied? Where do people log in? Is there going to be a "remember me" option? What happens if they forget their password? What if there's a third-party backend system that the authentication needs to tie in to? Those are just some of the considerations I can think of based on my experience of building similar bits of functionality in the past. With the frameworks and CMSs I've used, I can't remember very many of them them that have been flexible enough "out of the box" to do what I needed without having to hack where I shouldn't, or ended up with me writing my own methods to replace theirs. To pick an example. I mainly use CodeIgniter, and have done for a long time. One of the "ready-made" libraries for users is called Ion_Auth (or something like that). In every application I've written with CI, it has never been a good fit because the application demanded either much more or a lot less; or I didn't like the way it handled a certain part. The API is already there in ProcessWire, you just have to utilise it in your template files to suit the website being developed. There really isn't much to it, and because of that, any module that did try to cater for it would either only cater for a particular type of site; or it would be overly complex and force developers into its own way of working - rather than the other way round. In lots of other systems, you have to get modules and plugins for just about everything that isn't in a WYSIWYG box, because the core system is too inflexible to let you do "stuff" any other way. With ProcessWire, the API is completely open to use how you want to use it. One of the reasons I dislike Drumlapress is for the plugin-for-everything mentality. Need to split out some images in a carousel? Install plugin X. Want to put some images in a gallery page? Install another plugin Y; and never the two shall meet (because when they do, their javascripts conflict, and the back-ends are totally separate...). Several months later you might want to put some of those on a map. Oh, that will be a separate plugin Z that doesn't really work with X or Y. And then you update Drumlapress to the next version because of a major security flaw (again). Plugin X is fine, but plugin Y breaks because it's not compatible with the latest version. And then your website is broken.
    1 point
  29. Great stuff - I can see a few places in several sites of mine that would benefit from these to keep the code a bit cleaner!
    1 point
  30. He did it again Thanks Ryan, I can see me using these a lot! There were many times when I wished that some of these methods would exist.
    1 point
  31. This will need more work. Load audiojs: <script type="text/javascript" src="<?php echo $config->urls->templates; ?>scripts/audiojs/audio.min.js"></script> Create js for controling player <script> $(function() { //Setup the player to autoplay the next track var a = audiojs.createAll({ trackEnded: function() { var next = $('ol li.playing').next(); if (!next.length) next = $('ol li').first(); next.addClass('playing').siblings().removeClass('playing'); audio.load($('a', next).attr('data-src')); audio.play(); } }); //Load in the first track var audio = a[0]; first = $('ol a').attr('data-src'); $('ol li').first().addClass('playing'); audio.load(first); //Load in a track on click $('ol li').click(function(e) { e.preventDefault(); $(this).addClass('playing').siblings().removeClass('playing'); audio.load($('a', this).attr('data-src')); audio.play(); }); //Keyboard shortcuts $(document).keydown(function(e) { var unicode = e.charCode ? e.charCode : e.keyCode; //right arrow if (unicode == 39) { var next = $('li.playing').next(); if (!next.length) next = $('ol li').first(); next.click(); //back arrow } else if (unicode == 37) { var prev = $('li.playing').prev(); if (!prev.length) prev = $('ol li').last(); prev.click(); //spacebar } else if (unicode == 32) { audio.playPause(); } }) }); </script> In your template you can do something like this. if (count($page->audio) > 0 ){ $outAudio = "<audio preload></audio>"; $outAudio .= "<ol class='playlist'>"; foreach ($page->audio as $song) { if ($song->description != "") { $songName = $song->description; } else { $songName = $song->name; } $outAudio .= '<li><a href="#" data-src="'.$song->url.'">'.$songName.'</a></li>'; } $outAudio .= "</ol>"; } echo $outAudio;
    1 point
  32. Sounds awesome guys, thanks god I didn't go far in developing my site on Drupal, it feels just too cubersome...
    1 point
  33. I pushed an update to the dev branch yesterday that should solve the issue of broken links in textarea/HTML fields when migrating a site between a subdirectory and root, and any other scenario that involves a change to the site's root path. This was previously solved by the the PageLinkAbstractor module, but I've always been on the hunt for a solid core solution. The solution I put in is really basic and simple, and I'm not 100% positive it's the right one, but here's what it does. When editing the settings for any Textarea field, you now have a "Content Type" setting: If you select "Markup/HTML" then it signals FieldtypeTextarea to look for certain attributes to convert when you save the page. Specifically, it's going to convert any local pointing <img src='...'> or <a href='...'> attributes to assume that the site's root is always "/" (at least from a DB storage perspective). Then whenever the field is loaded, it converts them back to the site's actual root. Using this method, any links or images placed in your TinyMCE/CKEditor textarea fields should continue working normally no matter where you move your site. Like PageLinkAbstractor, it doesn't retroactively apply to existing links. It only applies to links/images saved on pages after enabling the option. Unlike PageLinkAbstractor, it keeps the original code in a state that's still portable regardless of whether you later turn off the option or pull the text directly out of ProcessWire's DB. It's not yet had a lot of testing yet, so don't choose "Markup/HTML" unless you want to test it. As of 10 minutes ago, it's now compatible with TextareaLanguage as well.
    1 point
  34. I haven't used form builder with files upload yet, and I can't find any "file" field in formbuilder 0.2.0, maybe I'm missing something. An php array is accessed array[key] same as in Javascript or other languages. You can get the created like this: foreach($forms->get("contact-form")->entries->find() as $e){ echo "<p>{$e['e_mail']} - {$e['created']}</p>"; } If your 'file' field is itself an array you could try using echo "<pre>"; print_r($e['file']); echo "</pre>"; and you'll see the array printed out recursively and you see all the entries and its keys and values. Once you know the key you access it for example: echo $e['file']['filename'];
    1 point
  35. Grüezi Daniele, you will get access to the form builder support forum once Ryan sees this. I'm not sure what you need to archive, but since the entries are stored as json you can't search for entry fields. If you want to use API to find entries you need to store them as pages. You can access the entries in DB through $forms foreach($forms->get("contact-form")->entries->find() as $e){ echo "<p>{$e['e_mail']}</p>"; }
    1 point
  36. I'd say that thing is everything here is relative; They use Drupal, because they (the developers) probably invested huge amount of time into learning all the ins and outs and quirks of that system. Also, Drupal allows to do things fast…, but relatively compared to how long it takes to untrained person. And then, it really is fast afterall. That being said, there are two different ways I think about this whole 'Drupal can do big things': Some companies thinkg 'big' when they talk about hundreds of pages, which, when IA is done well, isn't really that much (even might be easy to navigate) Big part of these Drupal sites are membership sites, which I admittedly can't really imagine that easily being built on PW Regarding membership sites: Yeah, have registered members isn't really a problem. But having real membership/social site is a different thing, and Drupal has this already… take http://openatrium.com/ for instance. That said, I despise drupal, I think it's a behemoth, it's ugly, the HTML is horrible and if you need to debug/change the HTML, you can straight up kill yourself (since there is like 12 entry points where modules can change something, and not all of them are equal).
    1 point
  37. Marc, when you are developing a site it's good to turn debug mode on. This will ensure that errors are sent to the screen, exceptions reported, etc. This can be found in /site/config.php. By default, it is false. You'll want to change it to true: $config->debug = true; Obviously you don't want this enabled for production sites, so remember to change it back to false for live/production sites. I don't see any problem with using var_dump, var_export, print_r, etc. so long as you are directing that output to where you can see it. Also avoid running these functions on PW objects as you may get into an infinite loop. Sometimes it can be difficult to track the output of these functions because PW performs a redirect after most POSTs. But if you use PW's built-in reporting functions, they will get queued between requests until they are output. Here are the relevant functions bellow. They will produce the messages that you see at the top of your screen in PW admin: $this->message("status message"); $this->message("status message that only appears in debug mode", Notice::debug); $this->error("error message"); $this->error("error message that only appears in debug mode", Notice::debug); If you are outside of a Wire derived object, you can call upon any API var to handle the notice for you. For example: wire('session')->message('status message'); wire('pages')->error('error message'); Note that these reporting functions above are for the admin (and related modules), and they don't do anything on the front-end of your site. How you choose to debug or report errors on the front-end is at your discretion. Personally, I keep debug mode on in development, and this puts PHP into E_ALL | E_STRICT error reporting mode... it reports everything possible. If I need to examine the value of something on the front-end, I'll do it the old fashioned way with just PHP. Though others may prefer to go further with their debugging tools. If you want to keep your own error log, here's how (anywhere in PW): $log = new FileLog($config->paths->logs . 'my-log.txt'); $log->save('whatever message you want'); You can direct it to store logs wherever you want, but I suggest using the PW logs dir as shown in the example above. This will make the log appear in /site/assets/logs/, and this directory is not web accessible for security.
    1 point
×
×
  • Create New...