Leaderboard
Popular Content
Showing content with the highest reputation on 10/06/2015 in all areas
-
I used to use ExpressionEngine years years ago. Had several commercial licenses. They began to decline and I foresaw the inevitable crash, so I bailed and began looking for a new CMS. I found many CMS sites listing Drumlapress and other popular titles. Those that offered online Demos, I demoed. Those that offered downloads, I downloaded, installed and tested. I graded them based on their docs, community, back-end, ease of installation, ease of use, etc. But nothing lured me much more than ProcessWire. As they say, "the rest is history".5 points
-
Two WiP images: I planned to add only auto-optimize. But if you don't start using the module when starting the development then many images will remain unoptimized, requiring manual optimization. So there's a bulk optimize feature which works, though it can be really slow. I may take the effort and add a "stop" button but I don't want to overcomplicate this thing. Currently it overwrites original files, which is dangerous, I know. Should it create a backup of the images? Any suggestions on how? I also plan to add an exclude (or include?) list feature, just to make sure. Which one would you recommend (if any)?2 points
-
File upload support is now ready - albeit a few possible oversights. You can grab the latest update from here. As part of this new feature, several things have changed. Most notably, the template form output now uses $simpleForms for fetching previous input as well as responses. This prevents warnings when using debug mode, and generally looks a lot cleaner and easier to understand. (This is shown at the bottom of the post.) Of course, the big part of this is that file uploads now work. As described in my previous (greyed out) post, the front-end module now uses FormData, as opposed to simply serialising the form on submission. This allows for AJAX file uploads. If you'd like to make use of a file field, it needs to be defined in config.json. However, it should not be defined in the "fields" array, as validation etc is handled differently, mostly due to WireUpload, and internal checking to see if the field is actually required. As can be seen in the config file included in the repo, defining a file is as simple as: "files": { "file": { "required": "You need to upload a file", "validExtensions": ["pdf", "docx"], "maxSize": 4096000 } }, Each file field can be declared with a name - the same name used on the HTML form itself - and should be declared with the above rules in place. Of course, the required rule is not necessary if the upload is not required. The maxSize rule is measured in bytes, per the WireUpload standard. Each field may only take one file for the time being - WireUpload will throw an error otherwise. Will be looking to support multiple files in the future, but this will involve quite a few changes (off the top of my head, I can see it being a little overboard - I could be wrong). If the uploads are valid, they will be saved in a UID directory in the uploads directory for the form. For example: site/modules/SimpleForms/forms/contact/uploads/{random_uid}/filename (Keep in mind that the storage location for form configuration, templates, and uploads will change to the assets directory when the module is ready for production use. Currently, any module upgrades overwrite the forms directory.) These will then be made available to each of the email templates as linkable downloads through {files.{field}.name} and {files.{field}.url}. See the template examples to see how they can be used. Lastly, as mentioned at the beginning of this post, there is a new method for declring forms, should you wish to allow them to work without AJAX. I don't think any explanation is required here, so here's the template file example (this is not included in the repo - you'll need to add it to a template yourself). Documentation I'm still working on the docs, but won't finish them until such time as the module has reached feature-parity and is mostly stable. Naming Have decided to stick with SimpleForms. I still quite like QuickForms, and so the chance of me renaming the module is not lost forver. ;-)2 points
-
Use a prependTemplate file, where you check for the language and if it's the "not public" one just throw an 404 or redirect. Can even be adapted so translators can visit the site.2 points
-
2 points
-
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
-
I highly recommend reading the second post, too before implementing anything, as it might simplify a lot, depending on your setup.. Because I just updated all MarkupCaches with newer WireCache, couple of weeks ago, and really like it, I thought why not share it. So I got _init.php as prependTemplateFile, and _out.php as appendTemplateFile. But let's check out the interesting part, for example an article.php template. but for some pages, for example blog, it makes sense to include all children ;-) You can include any page you like, or define a time or a template as expiration rule. Here my defaults from the _init.php $cacheNamespace = "hg"; $cacheTitle = "$page->template-" . $sanitizer->pageName($page->getLanguageValue($en, "title")) . "-$page->id-{$user->language->name}"; $cacheTitle .= $pageNum ? "-$pageNum": ''; $cacheExpire = $page; I'm not exactly sure if there is any benefit in using a namespace, you can omit the namespace part and if needed just prefix the cache title. Works both. You'll see why I added the namespace/prefix a little later ;-) For the title I'm getting, the template, english page title (you can of course use the language title and omit the language name part, but I liked it better to have the caches grouped.. After language name I'm adding the page number if present. If you need you can of course create a different, more or less specific cache title. Add get parameters or url segments for example. Then I have $cacheExpire already set to $page as default value, so I don't need to set it in every template So my markup (only the important parts) looks like this: //You can have anything you like or need uncached above this $cacheExpire = $page->chilren(); $cacheExpire->add($page); $cache->getFor($cacheNamespace, $cacheTitle, "id=$cacheExpire", function($pages, $page, $users, $user) use($headline) { // as you can see, within the function() brackets we can pass any Processwire variable we need within our cached output. // If you don't need any you can of course leave the brackets empty // and if you need any other variable wich you had to define outside this function you can pass them via use() // so here goes all your markup you want to have cached // for example huge lists, or whatever }); // Then I have some more uncached parts, a subscription form for example. // After this comes another cached part, which gets -pagination appended to the title. Otherwise it would override the previous one. // It's not only caching the pagination, I just needed a name for differentiation. $cache->getFor($cacheNamespace, $cacheTitle.'-pagination', "id=$cacheExpire", function($pages, $page, $users, $user) use($headline) { // so here comes more cached stuff }); After this your template could end or you can have more uncached and cached parts, just remember to append something to the cache title ;-) Now comes, at least for me, the fun part haha In my prepended _init.php template file I have the following code under the cache vars: if($user->isSuperuser() && $input->get->cache == 'del') { if($input->get->clearAllCaches == "true") { $allCaches = $cache->get("hg__*"); foreach($allCaches as $k => $v) $cache->delete($k); $session->alert .= "<div class='alert alert-success closable expire'>All (".count($allCaches).") caches have been deleted. <i class='fa fa-close'></i></div>"; } else { $currentPageCaches = $cache->get("hg__$page->template-" . $sanitizer->pageName($page->getLanguageValue($en, "title")) . "-$page->id*"); foreach($currentPageCaches as $k => $v) { $cache->delete($k); $session->alert .= "<div class='alert alert-success closable expire'>Cache: $k has been deleted. <i class='fa fa-close'></i></div>"; } } $session->redirect($page->url); } So when I append the parameter "?cache=del" to any URL all cache files within my namespace and beginning with the predefined $cacheTitle will be removed. Means all language variations and the "-pagination & -comments" caches will be deleted, too. This is the else part. But if I append "&clearAllCaches=true", to the first parameter, it will get all caches within my namespace and clear them. Without the namespace it would clear Processwires caches (like the module cache), too. I'm storing a little success message in a session called "alert" which is closable by the FontAwesome icon via jQuery and expires after some seconds, means it will remove itself, so I don't have to click ;-) Maybe it makes more sense to change the cache title and have the page->id first, so you could select all related caches with $cache->get("hg__{$page->id}*"); I liked them grouped by template in the database, but maybe I change my mind soon because of this For not having to type those params manually I have two buttons in my _out.php template file. I have a little, fixed to the left bottom corner admin menu with buttons for backend, edit (current page), and now clear cache button which unveils the clear all caches button on hover, so it's harder to click it by mistake. When someone writes a comment, I added similar lines as above, after saving the comment, to clear comment caches. Ah, the comment caches look like "-pagination" just with "-comments" appended instead. I don't know if there is an easy way to expire a cache when a new children (especially backend created) is created, other than building a little hook module. With MarkupCache it could be a pain to delete all those folders and files in /assets/ folder, especially with slow connection. The database driven WireCache makes it much faster, and easier when set up those few lines of code to make it for you. more about WireCache http://processwire.com/blog/posts/processwire-core-updates-2.5.28/#wirecache-upgrades https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/WireCache.php Hope it helps someone and is okay for Tutorial section, if you have any questions, suggestions or ideas feel free to share. Hasta luego Can1 point
-
Hello! I like to share a project developed using ProcessWire. App-UNIVERSE.net is a modern online service with software database download. We provide access to a rich app database for desktop operating systems based on Windows and Mac OS. Within each category we present both free and commercial apps used by professionals in industries as movie creation, interior design, transportation, creating presentations, coding apps and games, etc. All available apps in App-UNIVERSE contain information like license, name of developer, date of app update, actual description of main features and direct links to files hosted on developers homepage. Site visitors can search for apps not only through the catalog, but also an advanced search engine. Applications can be searched by criteria such as category, developer, name of the application or alternative. Unlike many competing sites we do not offer download of files via download assistant that under the pretext of simplifying the process of installing apps are spying software and are installing in system toolbars and other unnecessary components. We focus primarily on all valuable apps that we can height recommend to our users.1 point
-
without looking into the code, - maybe it will work when you select the array of items as formatted return value, under FIELDS -> images -> Details -> Formatted Value. (?) BTW, this module is in alpha state. ;-)1 point
-
while testing and knocking with the head on the wall...i found that this only with single imagefield happens. with one field with mutliple images it creates thumbs as usual...1 point
-
From your post it sounds to me like you are talking about migrating content from one PW site to another - is that correct? If so, it should simply be a matter of migrating template files and the DB. If however, you are talking about migrating a WP site to PW, we do have a migration tool: https://github.com/NicoKnoll/MigratorWordpress1 point
-
If you are talking about moving content from one PW installation to another, you have several options, which are related: 1) Master Adrian's Migrator module. 2) Exporting and importing templates/fields with built-in functionality. 3) Creating a site profile. 4) DB backup + moving file data manually. But you should really just fix your errors, not run from them .1 point
-
Markup inside of meta tags? That sound strange. But a textarea is the best way if they are just copy pasting. It's not hiding anything and it will just save what's in it. But skip the strip markup setting in this case.1 point
-
All notices are gone! ....and i know i owe you the next german translation... (coming next week for shure) This is as a matter of course if i use a module like yours in my projects! Getting such modules with great support from expirienced developers is a real good thing and my opinon is that even if i don't could code such thing myself i've to support/test/translate or do something else that contributes and honor the author. (Finally "Opensource" is like sharing time and experience at the same time to benefit - and it only really works if the most participants take part of that game) added: i've less experience so i'll bring in my time... Best regards mr-fan1 point
-
1 point
-
@FrancisChung, perhaps I'm misunderstanding this, but I think you are saying they are pasting markup into an RTE? That could never work under any circumstances, because RTE means rich text, not markup. If they want to paste in markup, they would have to first click the code view button.1 point
-
post_max_size integer Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize. Generally speaking, memory_limit should be larger than post_max_size. When an integer is used, the value is measured in bytes. Shorthand notation, as described in this FAQ, may also be used. If the size of post data is greater than post_max_size, the $_POST and $_FILES superglobals are empty. This can be tracked in various ways, e.g. by passing the $_GET variable to the script processing the data, i.e. <form action="edit.php?processed=1">, and then checking if $_GET['processed'] is set. Note: PHP allows shortcuts for byte values, including K (kilo), M (mega) and G (giga). PHP will do the conversions automatically if you use any of these. Be careful not to exceed the 32 bit signed integer limit (if you're using 32bit versions) as it will cause your script to fail. Changelog for post_max_size Version Description 5.3.4 post_max_size = 0 will not disable the limit when the content type is application/x-www-form-urlencoded or is not registered with PHP. 5.3.2 , 5.2.12 Allow unlimited post size by setting post_max_size to 0. http://php.net/manual/en/ini.core.php1 point
-
1 point
-
Congratulations Antti and all the PW community! This is the first 3rd party script for PW I did buy. I like free open source better , but the presence of commercial activity around the product is surely the sign of it being successful. I think we all should benefit from products like Padloper being developed and made available to us. So maybe it is time to think about re-building modules directory, making it a full blown marketplace?1 point
-
Ah now I see it. You cannot use functions inside of strings (wire() is a function, even though it's used as a variable). That's not correct. The PHP selector computation is (maybe the only) place, where only the $pages variable is available at local scope (see here). To use the other api variables it's best to use wire(…), but accessing via the class scope does work too. So both of these would work: return $pages->find("template=address, created_users_id={$this->user->id}"); return $pages->find("template=address, created_users_id=" . wire('user')->id);1 point
-
Just add another option to the selector, where you check for cases, where the start is before the searched date and the end is after the searched date. $selector = ""; // Start date inside $selector .= ", range=("; $selector .= "datefrom>=".$input->whitelist("datefrom"); $selector .= ", datefrom<=".$input->whitelist("dateto"); $selector .= ")"; // End date inside $selector .= ", range=("; $selector .= "dateto>=".$input->whitelist("datefrom"); $selector .= ", dateto<=".$input->whitelist("dateto"); $selector .= ")"; // range overspans searchrange $selector .= ", range=("; $selector .= "dateto>=".$input->whitelist("dateto"); $selector .= ", datefrom<=".$input->whitelist("datefrom"); $selector .= ")";1 point
-
hi tpr, do you plan to publish your work as a module? could be quite helpful to many others i think1 point
-
Hello, honestly that was my first concern,too. But I quickly realised how easily things can be put together without needing a module for this, another one for the next task and so on. In PW I can do almost everything using my templates. Makes me independent from 3rd party module developers once there are upgrades. I expect things won't break that much when PW is upgraded to a new version. Glad I found PW!1 point
-
1 point
-
I had been looking for CMS alternatives for a few months, I had been doing work primarily on Wordpress but only with already made templates, later, for custom design needs, I discovered Perch which I was quite excited to see how well it worked and how easy it was to set up a site with it, but the license fee made it less attractive as it did impact my costs of production (I normally do small websites). But I did love this thing, simple websites, simple admin, just the right amount of things to edit, everything managed through Pages (though not in tree form). Though, I did had a hard time getting used to their weird way of configuring field types (which looked like you were making a template, so I got confused between templating and configuration now an then) I then went to Kirby, flat-file CMS, also a very neat CMS, though I didn't like much the admin panel, I did like that it was pure files, so my local version of sites were pushed really easily, galleries options weren't as neat as in Perch and had no comments system for blogs. Then again, the license fee kicked in. Start looking again... This is when I came up with Bolt, Pico, Grav CouchCMS, etc. But nope, nothing at least comparable to Perch in simplicity, (or some don't have admin panel) If I remember I think Bolt did call to my attention but when I tried it it had this "bloggy" feel to it, similar to Wordpress, that ended up not convincing me. Then I was making a website for a friend's to be released comic book and I wanted to mimic what is done on manga sites, volume, chapter and page navigation dropdowns and stuff, then again same old story, look for a Wordpress plugin, found out that the best option wasn't exactly what I had expected and then again, doing Wordpress themes always looked like such a pain, so I that didn't even bother. Started looking again...even found a dedicated CMS for comics, that didn't really fit my needs. In this now long search for a perfect CMS, I stumbled upon CMS Critic while looking for reviews website, and saw they had an award thing going on, so I decided to check top places. "Well well, who do we have here Mr.Processwho-No-1-OpenSource-CMS?". Started reading the docs, saw the examples, looked awesome, so I decided to put it inside a website. Clean urls, everything custom fields, repeaters, multilanguage out of the box, extendable, a kick ass API....YOU HAVE TO BE KIDDING ME! The rest is history my friends, Processwire has brought the happiness to my web development career as nothing had ever done. I believe in this project and it's community, it's gonna be awesome, nuff said!1 point
-
It also works for just one image. If you allow more than one image in field settings you have to get the first image, iterate over or get one randomly. // $image = $page->images->getRandom(); // foreach ($page->images as $image) { ... } $image = $page->images->first(); $sidebar = "<img src='$image->url' alt='$image->description' class='$image->orientation' />";1 point
-
PW has to support a broad range of MySQL versions. One of PW's distinctions is making all of the data highly accessible, behaving as if it was all in memory ready to be used, while still being able to scale to millions of pages. One of the important keys to this is fulltext indexes. InnoDB did not support fulltext indexes for a long time, not until recently, in the overall MySQL timeline. While InnoDB now supports fulltext indexes, that's only if your server has a newer MySQL version that supports it, and a great many out there do not support it. Whereas it is universally supported on MyISAM, and has been forever. PW also performs reliably and particularly well with MyISAM (though does with InnoDB too). Like SiNNuT mentioned above, there are no foreign keys in MyISAM, so it's not even a consideration to be debated. While having foreign keys would have certainly saved time on the development side of PW, and are a nice-to-have feature at the DB level, the lack of them is not going to "lead to data inconsistency" either. We manage our table relations very carefully and thoroughly, as we know we don't have foreign keys managing that for us. To the end user of PW it makes no difference. I'm quite certain that whatever issue you are running into has nothing to do with the lack or presence of foreign keys. You can take advantage of InnoDB in PW now if you want to, and we've confirmed it working quite well across several installations. In fact, it's now an installation option available to you. If you click on the gear icon during install (MySQL settings screen) you'll see an experimental option to use InnoDB. While PW won't use features that aren't in both MyISAM and InnoDB (in order to be compatible with both), there are still some benefits to using InnoDB. Specifically, if the power goes out on your server, you won't have a potentially crashed table (needing a repair command). In addition, tables aren't locked during writes, making it work better in high traffic environments that are having to do a lot of INSERT or UPDATE operations in PW (i.e. constant updating or importing pages).1 point
-
Easy answer: PW uses the MyISAM storage engine, which does not support foreign key constraints. InnoDB could be considered at some point because it has some benefits and also full text search for a while now. But to my knowledge MyISAM still outperforms InnoDB in some areas and there are more things to consider.1 point
-
Sorting by subfields is now supported (see https://github.com/ryancramerdesign/ProcessWire/pull/862). It was my first contribution, so I'm pretty proud1 point
-
I agree about that PW intro video - I know Ryan is self-conscious about his spoken videos, but there was definitely something about his approach that got me hooked. I think it can be hard to find the right balance between being professional enough without going too far and coming across as a hyped up marketing spiel, vs being too low budget and hokey. This video was the right balance for me. I think in general PW could benefit from upping the marketing anti a bit, but not too much!1 point
-
Hi Thomas and welcome to PW! You should be able to do this with a very basic custom module. I think this code from Pete should be a good start for you: http://processwire.com/talk/topic/1648-ok-to-change-page-name-path-after-save/?p=152321 point
-
Much of this defers to the GNU v2 license. My thoughts are that people should feel free to make their own admin theme and put their logo (or their clients logo) wherever they see fit. But regardless of admin theme, I do think the software name ProcessWire, version number and copyright should always remain in the footer of the admin at least. The reason for this is that I don't ever want ProcessWire to be a burden on a client. Web sites very often outlive the relationship of the site developer to the client. I think it's important for the client to know what software and version they are using and where it came from. Without that, if some future issue surfaces, the client would be blind and ProcessWire would be a burden on them. Can you imagine white label installations of any other major open source CMS out in wild, and what a security nightmare that would be? Keeping this information in a place where the client can find it keeps everyone honest about how the software is licensed. If someone just provided a re-branded PW to a client and charged them $25k for it, I think it's important that the client knows they are paying for a service from their developer and not the software. If a company still felt strongly that they needed to remove the software name, version and copyright from the admin, then I'd want them to keep and maintain a long term support contract with us and make the GNU license really clear to the users of the software.1 point