Leaderboard
Popular Content
Showing content with the highest reputation on 03/08/2017 in all areas
-
What Adrian said. You need &&. Try it, it will work . If page ID is not 1037 AND it is not 1038 AND it is not 1039.....3 points
-
Last week’s post indicated we may have the first [beta] version of the Uikit admin theme ready, and I’m glad to report that we’ve now got it ready for download on GitHub. In this post, we’ll describe what’s new, how to install it, and how to develop with it. https://processwire.com/blog/posts/processwire-3.0.54-and-adminthemeuikit/2 points
-
OR AND 1037 F T F T F T F T 1038 F F T T F F T T F T T T F F F T2 points
-
Again thanks for your help @Zeka. I wasn't aware of the each() function, so that help alot! Just to be clear on the above reactions, with the country list example I just wanted to point out an example of a large dataset. I wasnt looking for a country list itself. But if I need it in the future, I'll have some great pointers on how to upload them ;-) Next to that if you are really stubborn person (like I am ;-) and still want to utilize the fieldtype options for this, use this code: $options = $fieldtypes->get('FieldtypeOptions')->getOptions('xyz'); $options->each(function($item) { $count = wire('pages')->count('template=basic, xyx='.$item.''); if($count) { echo "<li>{$item->title} ({$count})</li>"; } });2 points
-
Thanks for this very useful fork! It would be rad if it integrated @flydev 's fork too for hashtag search!2 points
-
@DL7 Options ( page with template "options") - ABS ( page with template "option") - DEF ( page with template "option") - BAR ( page with template "option") Page 1 ( template "page" with single page field "options_field" ) use ABS Page 2 ( template "page" with single page field "options_field" ) use DEF Page 3 ( template "page" with single page field "options_field" ) use DEF Page 4 (template "page" with single page field "options_field" ) use BAR Then in your output $options = $pages->find("template=option, limit=100"); echo $options->each(function($item) { $count = $pages->count("template=page, options_filed=$item"); if($count) { return "<li>{$item->title} ({$count})</li>"; } });2 points
-
Migrator has a country list complete with ISO country code fields etc. If you want to go this route, install this commit of Migrator: https://github.com/adrianbj/ProcessMigrator/tree/3e2121b8fdb68e9d9dc0c6aca8aae75e923a2669 Alternatively, use https://processwire.com/talk/topic/4523-page-field-select-creator/ and paste in a list of countries, or even http://modules.processwire.com/modules/batch-child-editor/ A CSV list like this (https://developers.google.com/public-data/docs/canonical/countries_csv) would be helpful for the last two options.2 points
-
I personally haven't had any issues, just make sure you do the standard checks that are built into ProcessWire's API https://processwire.com/api/ref/sanitizer/ also make sure you do permission checks such as updating a user: $u = $users->get($id); if($user == $u) { // Do stuff here } else { // You don't have permission to edit this user } If for example you have profile pages which are a page, you will have a Page Reference field that will store the user then you can do: $p = $pages->find("template=profile, user=$user"); $p->of(false); if($location) { $p->location = $sanitizer->text($location); } $p->save(); And the update will be url will be: domain.com/users/update/?location=England In the ajax.php file you don't want to pass $user as this is built in however you do want to pass location: if($input->urlSegment1 == "users") { if($input->urlSegment2 == "get") { wireIncludeFile("ajax/users/get", ["id" => $input->get->id]); } if($input->urlSegement2 == "update") { wireIncludeFile("ajax/users/update", ["location" => $input->get->location]); } } EDIT: Sorry, I didn't consider if you was using AJAX externally (websites on a different server), you will probably want some external authentication checks you can create fields for Users I would create a field called auth, salt the username and password then you can do a check on username and password salt and if it matches select that user as active $ajaxUser = $users->find("auth=$salt);2 points
-
Hello, I suppose there loads of ways of doing this, and it mostly comes down to person preference. I usually create a template called Ajax then give the template the ability to use segments, I use segment 1 for the group and segment 2 for the action, the rest I use GET. Then each action can live in an Ajax folder. The ajax.php will look like: if($input->urlSegment1 == "users") { if($input->urlSegment2 == "get") { wireIncludeFile("ajax/users/get", ["id" => $input->get->id]); } if($input->urlSegement2 == "update") { wireIncludeFile("ajax/users/update", ["id" => $input->get->id, "email" => $input->get->email]); } } Then in ajax/users/get.php for example I do: return $users->get($id); Ajax request will be to the url domain.com/ajax/users/get/?id=1039 for example Not sure if I'm answering your question here.2 points
-
I tried to reproduce and got what I have expected. My template file: <?php var_dump($input->post->hidden); // array(3) { [0]=> string(3) "123" [1]=> string(3) "456" [2]=> string(3) "789" } ?> <form action='/test/' method='post'> <input type="text" name="text[]" value="Hello"/> <input type="text" name="text[]" value="Jo"/> <input type="hidden" name="hidden[]" value="123"/> <input type="hidden" name="hidden[]" value="456"/> <input type="hidden" name="hidden[]" value="789"/> <input type="submit" value="go"> </form>2 points
-
2 points
-
It looks really nice, and works well on my test site. However, I've grown so accustomed to having the side bar in Reno, that I miss it here on the desktop. I see you've made a great side bar for mobile devices though. Having such so much screen real estate (hurray for the responsive full width experience!), could you make it (optionally?) available for larger screen sizes too? Great work Ryan!2 points
-
I've used JavaScript to check the scroll position and show/hide the menu toggle (hamburger icon). Recently though I found out that I can fake it with CSS. The idea is having a header element that is full-width with a background color and covers the fixed position toggle button. On scroll the button is revealed. Of course this technique can't be applied to any site, although in the majority of my projects I could have used it. Before you ask I use no JavaScript to show the mobile menu, it's shown using the :checked technique.2 points
-
You do need to save. Not sure how your tests are set up, but if you set the email and then get it straight after, it will appear changed, but if you reload the page, it won't have stuck unless you save.2 points
-
This is amazing and so easy to skin, I noticed a few CSS errors, I will put them on GitHub Great work Ryan!2 points
-
1 point
-
1 point
-
The thing about this approach where you foreach the selectable options (for an Options or a Page field) is that if you have 196 countries (for example) then that is 196 database queries. Not the end of the world or anything but also not very efficient. I like this code from Ryan that requires only a single DB query, and which can be adapted for an Options fieldtype: $field = $fields->get('my_options_field'); $table = $field->getTable(); $query = $database->query("SELECT data FROM $table"); $ids = $query->fetchAll(PDO::FETCH_COLUMN); $count_values = array_count_values($ids); // count the frequency of values in the array arsort($count_values); // sort highest to lowest // use the option IDs and counts as needed, for example: $all_options = $field->type->getOptions($field); echo '<ul>'; foreach($count_values as $option_id => $count) { $option = $all_options->get($option_id); echo "<li>{$option->title} ({$count})</li>"; } echo '</ul>';1 point
-
1 point
-
You can easily create a select field with countries with FieldtypeSelectExtOption First install this table countries.sql via MysqlAdmin or another tool. Choose the new table in the settings of your FieldtypeSelectExtOption field. Done! You have a comfortable access to all the data via API. Read the docs or the related thread https://processwire.com/talk/topic/9320-fieldtype-select-external-option/1 point
-
Thanks, it's mostly PageList IDs that is causing this and perhaps PageListThumbs. I'll check it soon.1 point
-
1 point
-
1 point
-
Hi @DL7 I think that you should stick with page field instead of options fields. It is much more easier to accomplish what you want with that field. Make read of this https://processwire.com/blog/posts/making-efficient-use-of-fields-in-processwire/#use-page-fields-rather-than-individual-checkboxes1 point
-
thanks for your quick answer. I played a little with the code and suddenly it was working. As I used another naming method before, I probably got the wrong result from the browser cache. thanks anyway!1 point
-
Thanks. Ok , I found that some custom permisson system we have running is preventing the admin branch to be accessed. So it works fine.1 point
-
1 point
-
There is another members register/login module here? http://modules.processwire.com/modules/subscribers/ https://github.com/benbyford/subscribers1 point
-
Hi and welcome @Cole. Could you please provide some more information... Is the 403 error occurring in your local environment or online? Are those rewrite rules the source of the error - that is, does the error disappear if you remove those lines from htaccess? Does the error occur when you access the website via all three of the below? dev.example.com www.example.com example.com And I take it that you are routing dev.example.com to 127.0.0.1 by editing whatever the MacOS equivalent is to the Windows 'hosts' file and have configured that domain as an Apache virtual host in your local environment?1 point
-
1 point
-
Hi @MilenKo Did you see these modules? http://modules.processwire.com/modules/fieldtype-star-rating/ http://modules.processwire.com/modules/page-ratings/1 point
-
You can get the array of entries and then do a usort(): $entries = $forms->get('reserveren')->entries()->find(''); // sort entries newest to oldest by field 'datum' usort($entries, function($a, $b) { return $b['datum'] - $a['datum']; }); // OR, sort entries oldest to newest by field 'datum' usort($entries, function($a, $b) { return $a['datum'] - $b['datum']; }); // do what you want with $entries array1 point
-
It is still the same. Show us the code you have and tell us the steps you did and I'm sure someone will help you1 point
-
Hey man! We all here will do our best to help you, but you should provide at least some details) Like what profile did you install and started from. It just might be that you do use the default profile, and the the name of the variable for main content should be $content and not $bodycopy. But that is a just a wild guess. Be more specific, provide some details and get the best answers on the web from the most awesome community on the planet. Have fun with ProcessWire!1 point
-
Just got my copy I hope this is safe! I'll trust random internet software with my servers haha1 point
-
you don't need another template..you can use urlSegments for this and then if /amp/ is appended to the url you output amp content..without the url segment you can then output normal html which is recommended (to have both)1 point
-
This module now works with the core Page Clone module, so now when you "Copy" a page and edit the title, the name will also change based on the config settings of this module. I think this is really important, because the current behavior of the clone module will likely result in incorrect names/urls for the new page - I don't think you can rely on site editors to manually edit page names to match titles. There is currently one issue where it doesn't work for the names of other languages on a multi-language site. I believe this is a bug in the clone module (https://github.com/processwire/processwire-issues/issues/207), but if Ryan says it isn't a bug, then I'll add a workaround in this module.1 point
-
@modifiedcontent Say you have the following form <form method="post"> <input type="text" name="name"> <input type="textarea" name="message"> <input type="submit" name="submit"> </form> You can save it to a page like this <?php if($input->post->submit) { $p = new Page(); $p->template = "template_to_save_form"; $p->parent = $pages->get("/parent-page/"); $p->title = $input->post->name . " - " . date("Y-m-d"); $p->submitted_by = $input->post->name; $p->message = $input->post->message; $p->save(); } You'll have to create the template, its fields and the parent page first. Also before saving the page make sure to validate/sanitize the input. <?php $p->submitted_by = $sanitizer->text($input->post->name); // instead of just $p->submitted_by = $input->post->name; https://processwire.com/api/ref/sanitizer/1 point
-
Hi @phil_s Also check this blog post from Ryan Filtering out common WordPress files1 point
-
@jploch - I'd like to see a dump of $event after line 718 because $field is not an object and it should be. That said, a quick fix might be to change the hook on line 97 to: InputfieldImage::processInputFile1 point
-
Try this: $forms->get("reserveren")->entries->find("id>0")->sort($entry['datum']) It should however work if one is loading all entries beforehand and doing the sorting in memory.1 point
-
Looks like an attack on a WordPress site with a small wave. Maybe this is an interesting read for it: https://perishablepress.com/protect-post-requests/1 point
-
1 point
-
How cool is that! Couple of months before it was on the roadmap and now it is here. Or is time starts going faster as you get older?!1 point
-
Hello all ! Just because I'm proud to be featured by Snipcart (js ecommerce solution) about my integration on my Processwire based website ! This post talks about Processwire and how I've done it : https://snipcart.com/blog/case-study-ateliers-fromagers-processwire If you wanna take a look at my website : https://www.ateliersfromagers.com/ (french & english) Have a good day everyone ! S1 point
-
Hi @Sebastian. Welcome to the forums. The real answer is that these forms were never intended for use in the frontend. Their purpose and design was for backend use only where trade-offs have had to be made between complying with standards versus delivering a usable and highly efficient UI, taking into account the underlying complexities that constitute the PW Admin. Using them in the frontend is just a bonus, but it comes at a 'cost'. You are probably better off using your own forms, or investing in Form Builder or similar.1 point
-
Already done that (https://github.com/ryancramerdesign/MarkupTwitterFeed/pull/5), but the previous pull request I did for this same module in January 2015 has stayed unanswered, so I don't know if this one will be integrated…1 point
-
@benbyf I forked the module and added the functionality, you can find the module at github: https://github.com/flydev-fr/MarkupTwitterFeed To search hashtag use it as the following : $options = array( 'searchQuery' => 'ProcessWire', 'limit' => 3 ); $t = $modules->get('MarkupTwitterFeed'); $out = $t->search($options); echo $out; The function search() act like render(). Thanks again for the suggestion (searching for hashtag). I think we can improve it a bit, let me know for any needs.1 point
-
Hey.... I figured it out. It was an echo statement messing up the buffer, in turn causing the Ajax call in ProcessPageList.js to fail. Just shoot me. Apologies to anyone who spent time looking at the post. And I just advanced to junior member too lol Have a good one..1 point
-
Being able to compose a page of individual blocks on the fly has been requested a couple of times now. I remember asking for something similar some time ago (click). I think the obvious and most comfortable solution would be that repeaters have no fields attached to them but rather templates, or only one template to have the same functionality as we have now. One step further would be that one is able to attach more than one template to the repeater, and then while creating content when you click add item a drop down appears with the template names you added. You choose a template and the next repeater item contains the fields of that chosen template. Next item could be another template and so on. This would be awesome. I would create this kind of behaviour with a module/fieldtype but my knowledge of pw module development and the related api work is not sufficient yet. Sure this kind of structure can now be created with subpages but this is not convenient for clients, since they don't have all the content on one page. One argument I've seen a lot is that there is too less of constraints for content creators/editors so they would mess up things or go nuts with laying out content. But the developer can exactly define which templates are assigned to that repeater. And those individual blocks/templates are very much under control of the dev so I strongly disagree with that argument.1 point