Leaderboard
Popular Content
Showing content with the highest reputation on 01/16/2018 in all areas
-
If anybody wants to steal some code (or use that little module as is, of course), feel free...8 points
-
So I stumbled over the request to allow limiting templates to be used only once under every parent page in this thread and found that this would actually come in handy (also in a site I've built). The code can be found on github and soon also in the module repo. After installation, you'll find a new checkbox "Only once per parent" in the family tab when editing a template.4 points
-
SYNOPSIS A little guide to generating an sitemap.xml using (I believe) a script Ryan originally wrote with the addition of being able to optionally exclude child pages from being output in the sitemap.xml file. I was looking back on a small project today where I was using a php script to generate an xml file, I believe the original was written by Ryan. Anyway, I needed a quick fix for the script to allow me to optionally exclude children of pages from being included in the sitemap.xml output. OVERVIEW A good example of this is a site where if you visit /minutes/ a page displays a list of board meetings which includes a title, date, description and link to download the .pdf file. I have a template called minutes and a template called minutes-document. The first page, minutes, when loaded via /minutes/ simply grabs all of its child pages and outputs the name, description and actual path of an uploaded .pdf file for a visitor to download. In my back-end I have the template MINUTES and MINUTES-DOCUMENT. Thus: So, basically, their employee can login, hover over minutes, click new, then create a new (child) record and name it the date of the meeting e.g. June 3rd, 2016 : --------------------------- OPTIONALLY EXCLUDING CHILDREN - SETUP Outputting the sitemap.xml and optionally excluding children that belong to a template. The setup of the original script is as follows: 1. Save the file to the templates folder as sitemap.xml.php 2. Create a template called sitemap-xml and use the sitemap.xml.php file. 3. Create a page called sitemap.xml using the sitemap-xml template Now, with that done you will need to make only a couple of slight modifications that will allow the script to exclude children of a template from output to the sitemap.xml 1. Create a new checkbox field and name it: sitemap_exclude_children 2. Add the field to a template that you want to control whether the children are included/excluded from the sitemap. In my example I added it to my "minutes" template. 3. Next, go to a page that uses a template with the field you added above. In my case, "MINUTES" 4. Enable the checkbox to exclude children, leave it unchecked to include children. For example, in my MINUTES page I enabled the checkbox and now when /sitemap.xml is loaded the children for the MINUTES do not appear in the file. A SIMPLE CONDITIONAL TO CHECK THE "sitemap_exclude_children" VALUE This was a pretty easy modification to an existing script, adding only one line. I just figure there may be others out there using this script with the same needs. I simply inserted the if condition as the first line in the function: function renderSitemapChildren(Page $page) { if($page->sitemap_exclude_children) return ""; ... ... ... THE FULL SCRIPT WITH MODIFICATION <?php /** * ProcessWire Template to power a sitemap.xml * * 1. Copy this file to /site/templates/sitemap-xml.php * 2. Add the new template from the admin. * Under the "URLs" section, set it to NOT use trailing slashes. * 3. Create a new page at the root level, use your sitemap-xml template * and name the page "sitemap.xml". * * Note: hidden pages (and their children) are excluded from the sitemap. * If you have hidden pages that you want to be included, you can do so * by specifying the ID or path to them in an array sent to the * renderSiteMapXML() method at the bottom of this file. For instance: * * echo renderSiteMapXML(array('/hidden/page/', '/another/hidden/page/')); * * patch to prevent pages from including children in the sitemap when a field is checked / johnwarrenllc.com * 1. create a checkbox field named sitemap_exclude_children * 2. add the field to the parent template(s) you plan to use * 3. when a new page is create with this template, checking the field will prevent its children from being included in the sitemap.xml output */ function renderSitemapPage(Page $page) { return "\n<url>" . "\n\t<loc>" . $page->httpUrl . "</loc>" . "\n\t<lastmod>" . date("Y-m-d", $page->modified) . "</lastmod>" . "\n</url>"; } function renderSitemapChildren(Page $page) { if($page->sitemap_exclude_children) return ""; /* Aded to exclude CHILDREN if field is checked */ $out = ''; $newParents = new PageArray(); $children = $page->children; foreach($children as $child) { $out .= renderSitemapPage($child); if($child->numChildren) $newParents->add($child); else wire('pages')->uncache($child); } foreach($newParents as $newParent) { $out .= renderSitemapChildren($newParent); wire('pages')->uncache($newParent); } return $out; } function renderSitemapXML(array $paths = array()) { $out = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; array_unshift($paths, '/'); // prepend homepage foreach($paths as $path) { $page = wire('pages')->get($path); if(!$page->id) continue; $out .= renderSitemapPage($page); if($page->numChildren) { $out .= renderSitemapChildren($page); } } $out .= "\n</urlset>"; return $out; } header("Content-Type: text/xml"); echo renderSitemapXML(); // Example: echo renderSitemapXML(array('/hidden/page/')); In conclusion, I have used a couple different processwire sitemap generating modules. But for my needs, the above script is fast and easy to setup/modify. - Thanks4 points
-
@noelboss just posted a comment in this thread and the thread is just one of many examples of people looking for solutions of a proper staging/production strategy. we have some modules that try to close this gap, but imho this is an important part of a professional workflow and therefore should be part of the core. don't know how that could be implemented exactly, but at least it would be great to have a thought-out strategy and maybe some kind of standard/best practise guide of how to keep staging/production in sync, be safe while editing, integrate GIT in this process etc. while other features are nice to have for me, this is really one thing that makes me feel totally unprofessional and is a huge pain. i don't think that the options we have so far are as good as they could be. for example if i had to push a fix to a live system, i wished it would be possible to: pull the latest version from live to dev with one click (excluding a predefined list of files / db tables) work on that dev version locally (having all files on the local computer makes searching all files a lot easier) push the fix to git push the fix to production some parts of this workflow can be done with the migrations module, some with the quite new duplicator module, some could be implemented via githooks, but, hey... we are talking about ProcessWire and where PW really shines is making our lives as devs easier and in this special case i feel that this is not true maybe i'm just too inexperienced in this topic and there are proper solutions out there, but following the forum over the last years i didn't see a solution that felt "processwire-awesome". maybe a blog-post covering this topic could be a first step. and maybe i'm totally alone with this opinion... a feature request-voting system could also help a lot here [pub] that was the tracy-boost3 points
-
Ah true, forgot to mention it, this was also one of the only things I identified as a drawback while working on my first PW project. While not perfect, there is a solution for WP that could help as an inspiration: https://deliciousbrains.com/wp-migrate-db-pro/ We are using Gitlab with Hooks to automatically deploy files to the staging and live systems on the corresponding branches and wp-migrate-db-pro for DB syncs as well as the .htaccess method to reference files not found on staging and development environments. If it would work reliably, this module could be an easy solution to migrate templates:2 points
-
To follow up on @Robin S's Tracy example, you can also access this without even needing to do an manual dump call. If you go to edit the field in the backend, you will see this in the Request Info panel. In this case you can quickly see that the inputfield is "InputfieldCheckboxes". You can also find this when viewing a page on the frontend if you go to Request Info > Field List & Values where you will see this, which is just one row of a table which shows the same info for all fields on the page.2 points
-
I used to use that module, but these day I prefer AdminOnSteroids for that functionality.2 points
-
Filling the bounding box is the standard behaviour for the size() method. $image->size(300, 200); For fit, I think it's a not a good idea to add background colour to the canvas. Better to use maxSize(), or size() with cropping set to false, and then center the image within the bounding box with CSS. But if you want to add a background colour you can do this with the canvas() method of Page Image Manipulator.2 points
-
HI @lickny2001 Try to use "insertAfter" method https://processwire.com/api/ref/wire-array/insert-after/2 points
-
That's an amazing list of 2017's features. Seeing them in a single place makes you appreciate how lucky we and our clients are. Thanks for another incredible year of updates. I imagine everyone's wish list is different. This is what I'd like to see natively in PW. I know some of these are already available as Modules so no offence if you're reading this and have already put tons of work into creating something similar. Processwire Multi-Admin A Processwire dashboard which allows me to monitor multiple installs across different servers. This dashboard would list my installs, version number, and display available upgrades (Module and Core) and allow me to update above from central place. It might show me logged in user(s), uptime etc. Media Manager A built in MM which acts as a single place to manage all uploads. Using the MM you can find, list and edit any uploaded file/image. and its versions. Add tags, crop, delete, rename, copy, bulk upload etc Furthermore the MM should work with user permissions so a MM for me might list different assets than an editor etc Importantly, the look of the MM would be consistent with what's already in place and the new UI Kit theme. SEO A native SEO Module that is maintained and updated as modern SEO evolves. Image Cropping Pre-set image crops and a way to define and manage them. That's it :-/2 points
-
Just a little update because of new API additions, so now you could just do foreach ($pag as $p) { foreach ($languages->find('name!=default') as $lang) { $p->setAndSave("status$lang", 1); } } Thanks @szabesz for mentioning I'm adding this here for completeness2 points
-
Attention: please don't install this module at the time being! It is not compatible with current PW versions, and it will be some time until I can work in all the changes. Due to a discussion here in the forums, I was inspired to finally have a take on datetime fields and see if I couldn't get them to be searched a little more conveniently. Here's a small module - still in alpha state, but I'd be happy to get some feedback - that allows searching for individual components of a date like year, month, day, hour or even day_of_week or day_of_year, and also returning them. Github repo: DatetimeAdvanced Current version: 0.0.5 Tested in: ProcessWire 2.8 + 3.0 Possible subfields: day month year hour minute second day_of_week day_of_year week_of_year Examples: // Database search: $pagelist = $pages->find("mydatefield.year=2016"); // Filtering PageArray in memory: $maypages = $pagelist->filter("mydatefield.month=5"); // Back to our starting point: $start = date('z'); $end = $start + 7; $sevendays = $pages->find("mydatefield.day_of_year>=$start, mydatefield.day_of_year<$end"); // Nice side effect: subfields are now directly accessible $blogentry = $pages->get('blog-entry-1'); echo $blogentry->title . "(" . $blogentry->publishdate->year . ")"; // New in 0.0.4: shorthand methods echo $blogentry->publishdate->strftime("%Y-%m-%d %H:%M:%S") . PHP_EOL; echo $blogentry->publishdate->date("Y-m-d H:i:s") . PHP_EOL; ToDos for the future: See if there's a possibility to specify ranges more conveniently Check if this can perhaps wiggle its way into the PW core Changes: example for direct subfield access and shorthand methods to strftime() and date() added.1 point
-
If you've ever needed to insert links to a large number of files within CKEditor you may have found that the standard PW link modal is a somewhat slow way to do it. This module provides a quicker way to insert links to files on the page being edited. You can insert a link to an individual file, or insert an unordered list of links to all files on the page with a single click. CKEditor Link Files Adds a menu to CKEditor to allow the quick insertion of links to files on the page being edited. Features Hover a menu item to see the "Description" of the corresponding file (if present). Click a menu item to insert a link to the corresponding file at the current cursor position. The filename is used as the link text. If you Alt-click a menu item the file description is used as the link text (with fallback to filename if no description entered). If text is currently selected in the editor then the selected text is used as the link text. Click "* Insert links to all files *" to insert an unordered list of links to all files on the page. Also works with the Alt-click option. Menu is built via AJAX so newly uploaded files are included in the menu without the page needing to be saved. However, descriptions are not available for newly uploaded files until the page is saved. There is an option in the module config to include files from Repeater fields in the edited page. Nested Repeater fields (files inside a Repeater inside another Repeater) are not supported. Installation Install the CKEditor Link Files module. For any CKEditor field where you want the "Insert link to file" dropdown menu to appear in the CKEditor toolbar, visit the field settings and add "LinkFilesMenu" to the "CKEditor Toolbar" settings field. http://modules.processwire.com/modules/cke-link-files/ https://github.com/Toutouwai/CkeLinkFiles1 point
-
In this post, we take a look at all that was covered in 2017, and our roadmap for 2018, which includes plans for the year ahead. https://processwire.com/blog/posts/processwire-2018-roadmap/1 point
-
If i were faced with your issue, i would change the structure of the pages and all of that, it doesn't make sense to me; i guess it must make complete sense to someone else, whoever set it up that way, but obviously the module author(s) never accounted for this sort of setup; You can also just roll your own RSS feed, then you don't need to be straddled with module interactions; it's not that hard to just make your own RSS class that takes into account any arbitrary structure and outputs it how you want; you could also just extend the module itself and modify the Module Class to a new one, and work from there until it works...1 point
-
1 point
-
1 point
-
You posted the correct link, but Adrian missed it1 point
-
Not meaning to take away from this module, and I am also not certain of its exact features, but we also have this new one from Ryan: http://modules.processwire.com/modules/login-register/1 point
-
I may be wrongly interpreting this as a quite specific need, but I'd make this feature a module. I've never needed something like this but who knows, maybe one day. So it makes sense to me to keep this out of the core, and something we could add as a module when we need it.1 point
-
I use FieldtypeYaml module because it is relatively easy to manually edit Yaml. JSON is easy to read but not so easy to manually edit. It is a good choice using FieldtypeYaml for not too complex config fields , I think.1 point
-
1 point
-
I want to see a separate channel in the forum where everybody can upload graphics, banners, animations and video clips to promote processwire.1 point
-
Thanks for those reports @godmok - should all be fixed in the latest version, although I didn't quite understand so could you please check that is working now as well. I assume it was related to the leading zero issue which is now fixed.1 point
-
totally agree! right now it sometimes seems that the interest is measured by "who shouts loudest"... but we had several examples where users didn't show their interest because the feature has been on the roadmap for a while so nobody said anything about it and waited for a surprise in the next blogpost. just if it was requested this is great example of what robin is talking about. informations about upcoming features are spread over the forum (wishlist) and github... so i want to support robins request and maybe extend it a little bit towards "better community management". we had one occasion where @ryan implemented something that was already available as a module (image tagging). don't get me wrong, of course i prefer solid solutions built into the core over 3rd party modules (i was voting for the predefined-crop-in-the-core-feature for a long time), but i would love to see a little more discussion and community involvment here. i can imagine that this can eat up a lot of time if done wrong - but i think it can also save time if done right. for example the community could do some research (like in the github link above), bring in ideas or point ryan to already existing solutions like it was the case with image tagging. finally i want to thank everybody contributing to this project and helping me out in the forum. i had a great 2017 and it would not have been possible without this awesome product and community! happy and successful 2018 to everybody1 point
-
Put the code I have posted in your ready.php and replace $this with $wire. $wire->addHookBefore('PagefilesManager::path', function ($e) { $e->replace = true; $e->return = null; });1 point
-
You may know this already, but just to explain the reason... Guest users do not have direct access to repeater pages because they live under the Admin branch (guest users can only view repeater content via a repeater field). One solution is to add "check_access=0" to the selector if it is definitely the repeater pages themselves you want to find. Or instead you might want to find the pages that the repeater pages are contained within... $container_pages = $pages->find("Images_With_Variations.title|Images_With_Variations.keywords*=" . $search_term_string);1 point
-
This is a good suggestion, but the action code would need to be modified in order to work in this case. By default that action copies the unformatted value from one field to another, but in this case the formatted value is needed in order for the newlines/markdown to be converted to HTML.1 point
-
yeah i also want to thank @flydev for the awesome work on this, massively appreciated!1 point
-
Hi, I just want to thank to flydev and everyone else who has contributed to this wonderful module. For me, Duplicator It has worked flawlesly to make backups and bring those backups to my local machine to test new functionality. Sincerely a fellow Processwire developer.1 point
-
If you're not comfortable doing this manually, take a look at this action in the AdminActions module: Copy Content to Other Field This action copies the content from one field to another field on all pages that use the selected template. This can be useful if you decide you need to split one field into two to allow different settings on different templates. It also makes it easy to move content from one field type to another one that is incompatible.1 point
-
For each field that you want to change to CKEditor, add a new CKEditor field to the template. Then use the API to set the formatted value of the textarea field to the CKEditor field. When you have done the API operations and checked that everything is okay you can delete the old textarea field. See here:1 point
-
There is a SEO module already. I guess it's not maintained anymore, but it can be a good base for extensions. What do you miss? Personally, I don't think a SEO module belongs to the core (if it's that what you have meant by "native"), because the core should keep it's clean and generic character. Keep in mind that ProcessWire is not just used for websites, and even a lot of websites don't need that much SEO.1 point
-
FYI... There is also a discussion around focal point image cropping https://github.com/processwire/processwire-requests/issues/150 if anyone is interested.1 point
-
If there are many such fields, consider changing the textarea values via API + regex. e.g. with https://gist.github.com/jbroadway/2836900 Just take care about when using / removing / adding which textformatters in the whole process. Perhaps do a test with only a handful of fields first, and see if it works out OK?1 point
-
1 point
-
SEO and image cropping is also what I find very useful. In addition to image manipulations it would be great to add a feature that makes the scaling of images to FIT/FILL bounding boxes possible. Take a look at http://a32.me/2012/06/scale-images-to-fit-fill-bounding-box-in-php-using-gd/ for a detailed example. This is useful if you have images with different proportions fitting in a box (fe. logos of different partners, product images). Best regards1 point
-
It sounds like one of the factors that determines which roadmap items get attention first is the level of interest within the community (makes sense). But it would be good to have a more accurate and transparent gauge of the interest in each roadmap item. A simple solution would be to have an official Roadmap sub-forum with a topic for each roadmap item (separate from the Wishlist sub-forum). The community could then indicate their interest in each item by "liking" it, and give feedback or ideas about implementation in topic replies. My vote for most desirable roadmap item: Add support for custom properties in file/image fields.1 point
-
jquery shopping carts are vulnerable on the client side as prices can be changed before checkout. many jquery shopping carts have this known security flaw. Please do some research before you are going to use a jquery based shopping cart. You have to verify that each item in the cart exists and that the price is correct. Snipcart should be safe to use. https://www.reddit.com/r/javascript/comments/1dxiy0/this_javascript_shopping_cart_just_looks_too_easy/1 point
-
This seems to work Perhaps it could be more efficient. <?php foreach($page->verspreidingen as $country){ // all countries echo "<a href='". $country->url . "'>" . $country->title . "</a>"; $s = null; $s_out = null; $states = null; $sarray = new PageArray(); foreach ($page->sub_verspreiding as $state) { // foreach state on the page that is child of a country if ($state->parent == $country) $sarray->add($state); } foreach($sarray as $s){ $s_out .= "<a href='". $s->url . "'>" . $s->title . "</a>"; if($s != $sarray->last()) $s_out .= ", "; } if(isset($s_out)) echo " (" . $s_out . ")"; if($country != $page->verspreidingen->last()) echo ", "; } ?>1 point
-
1 point
-
Welcome to the forums @mikhail $page->find() could be useful here. I think something like this should do the trick: // This category plus all child categories under it $categories = $page->find()->prepend($page); $pano_results = $pages->find("location_category=$categories, sort=-shoot_date, limit=10");1 point
-
I don't have repeater matrix here to test, but shouldn't this work (all PW API)? $lastTextItem = $page->flexible_content->find("type=text")->last(); foreach($page->flexible_content as $content) { //... do whatever if($content == $lastTextItem) //... do something only after last text }1 point
-
https://polarartistit.fi/ https://bomba.fi/ Webstores (developed by Tuspe): https://sajt.fi/ https://kupilka.fi/ (shop is only for visitors from Finland) https://tommisoidinmakiproduction.com/ Events: https://osuuskaupparock.fi/ https://karhurock.com/ We have made almost 100 projects already.1 point
-
Your case reminds me of these: https://processwire.com/talk/topic/16732-loosing-session-in-certain-network-environments/ https://processwire.com/talk/topic/16446-random-admin-logouts-solved-well-in-this-case/1 point
-
sessionFingerprint = 0 solved my issue.. Thanks1 point
-
Hey @arjen. This is a list I published in my blog article Why ProcessWire is the best choice for your website (not always, but in most cases) to convince people, that ProcessWire is not so unknown.1 point
-
I'm not sure if this is best in here or in the Modules/Plugins section – I've just been doing some general housekeeping on a site that's nearing the end of development. I deleted some fields that were no longer in use and afterwards I get an error when I try to open certain templates – Error: Call to a member function getInputfield() on a non-object (line 222 of /var/www/xxxxxx/wire/modules/Fieldtype/FieldtypeRepeater/InputfieldRepeater.module) Form the error it's related to a repeater in the template, but the problem templates all have 3 repeater fields in common, so it could be anyone of them that's causing the problem. Is there any way to find out which one it might be, how can I fix the error, and what might have caused it? Update Managed to fix the errors by using the "Check field data" checkbox at the bottom of the suspected problem field Action tabs. One of the fields had a load of redundant rows in the database, deleting them seems to have done the trick.1 point
-
For my mariadb installation the auth_socket (hope I have the name correct) plugin was the culpit. Disabling it for the user fixed the issue.1 point
-
In case you want it a little more simpler $pages->setOutputFormatting(false); $pag = $pages->find("template=basic-page"); foreach($pag as $p) { foreach($languages as $lang) { if($lang->isDefault()) continue; $p->set("status$lang", 1); $p->save(); } }1 point