-
Posts
5,008 -
Joined
-
Days Won
333
Everything posted by Robin S
-
OT, but saveReady is one of those methods where before and after hooks are equivalent: https://processwire.com/api/hooks/#before_or_after @Zeka, the solution @kongondo linked to will work, but if you think PW should not be giving warnings for deliberate name changes that aren't related to a sibling name clash then maybe you could add your voice the GitHub issue? The fix that Ryan applied does not seem ideal and a solution (I gave a possible one in the original issue comment) that focuses more on the specific scenario of a sibling name clash would be better I think.
-
There seems to be a small issue with the new Page Files panel when there are no files on the page. The panel overflows showing a scrollbar. Looks like the panel footer markup isn't nested correctly so maybe an unclosed div tag?
-
Even if that did work, I'm hoping for something foolproof for clients because they will just tend to paste the URL straight from the address bar.
-
This part is fine (the very slight rounding isn't enough to make much of a difference). The problem is that the lat/lng coordinates in the URL do not match those shown in the blue box, and it's the ones in the URL that matter for the textformatter.
-
Hi @teppo, Would you consider updating this module to allow it to parse out degrees/minutes/seconds coordinates as an alternative to latitude and longitude? This is for the "Use coordinates?" option. The reason being that the lat/lng coordinates in a typical Google Maps URL that a person might embed are less accurate than the degrees/minutes/seconds coordinates that are also present in the URL. I have no idea why this is and it seems strange as lat/lng is capable of achieving the same accuracy in principle, but I've tested several maps and there seems to be a real difference. Here's an example... I'll start with a Plus code so as not to involve either lat/lng or degrees/minutes/seconds to begin with: H85C+MG Otatara, Southland, New Zealand A search for this Plus code results in the following URL: https://www.google.com/maps/place/46°26'26.9"S+168°19'16.7"E/@-46.4408088,168.3191238,17z/data=!3m1!4b1!4m5!3m4!1s0x0:0x0!8m2!3d-46.4408125!4d168.3213125 The marker is at the end of the road, at the edge of the green reserve area: But when I embed the map via TextformatterGoogleMap with the "Use coordinates" option checked the marker position is out by a significant distance: This is not the module's fault - the lat/lng coordinates that Google puts in the URL are simply not accurate. If I search the coordinates -46.4408088,168.3191238 directly the pin is similarly misplaced: A search for the degrees/minutes/seconds coordinates 46°26'26.9"S 168°19'16.7"E from the URL results in a correct marker placement: So seeing as the degrees/minutes/seconds coordinates are more accurate could the module provide an option to use those?
-
If you have inserted any variations into CKEditor fields it would pay to check those because they won't be automatically recreated when the page is loaded. You'd need to call the image sizer again with needed dimensions, either using the CKEditor image modal or via the API.
-
Pagetable elements, page clone/copy unpublishes original elements
Robin S replied to Webrocker's topic in General Support
Both FieldtypePageTable and ProcessPageClone belong to the core, so if the issue is consistently reproducible you could add it to the ProcessWire issues repo: https://github.com/processwire/processwire-issues/issues -
Seems like we're talking about a couple of different things here: 1. Making certain "things" (don't think I can be more specific than that) reusable in multiple projects that you work on now and in the future. These are for in-house use by a single developer or team of developers and not shared publicly with the PW community (in the modules directory for instance). You could try and use modules for this purpose (I think this is what @bernhard is interested in) or any number of other approaches. This is stuff that's very much down to individual workflow preferences and I don't think the PW core can provide easy solutions that are going to suit everyone. 2. Modules that are shared publicly with the PW community. This is totally a matter of opinion, but personally I'm not enthusiastic about things like sliders and blogs being packaged and distributed as modules. In seems very WordPressy and not really the PW way (teach a man to fish, etc). A module could provide some building block that is useful for making a slider or a blog but it shouldn't do things like try and anticipate all the fields a user needs, output all the markup, bundle third-party JS libraries and suchlike. The beauty of PW is that it's so quick and easy to build solutions that are exactly tailored to the project at hand with nothing unnecessary left lying around. And while developing these solutions you're always learning how to be a better developer. A plug-and-play module that outputs whole pieces of the website works against that IMHO.
-
That's a special case because it's a module that is all about PW fields, templates and pages - indeed anything in the PW API. Generally speaking, if your publicly-shared module needs to collect and store some data then fields/templates/pages is not the way to go. It's messy, it's not self-contained, and it's liable to cause a headache for uninstalling and upgrading (what if a user adds or removes fields from your module templates?).
-
Sometimes a module does need to create fields, templates and pages but it would be the exception rather than the rule. Most Process modules, even complex ones with multiple (pseudo) sub-pages such as Admin Actions, do not create fields, templates or pages other than the single page used to execute the Process. Instead they use multiple execute() methods that work via URL segments. The forms on those pseudo sub-pages don't save data to PW fields but save all the module-related data to the module's config (stored as JSON in a single field in the database). The "nav" array in the module info takes care of creating the navigation to sub-pages. But perhaps you already know this if you've studied ProcessHello and other Process modules. Some off-the-top-of-my-head cases where you probably would need real fields/templates/pages for a module: You want to store files or images for use with the module. You want to use a Repeater and don't want the extra work to create to repeatable input type in the Process module. You want to store a larger amount of data than is allowed for in the TEXT column type used for module config data (although alternatively your module could create a dedicated table to store its data).
-
If all your variations (thumbnails and other variations) are corrupt you can delete them with the Pageimage Remove Variations module. The variations will be recreated next time they are requested.
-
There is no method call on the repeater matrix field value there - I think you meant to include ->find(): $items = $page->matrix_slider->find('start=1,limit=3'); That should work.
-
Using comments on fake pages or on pages that are not actually loaded.
Robin S replied to NorbertH's topic in General Support
You can render the comments list and comment form for another page by calling render() and renderForm() on the value of the comments field of that other page. For example: // Get the page $p = $pages(1234); // Render comments list echo $p->comments->render(); // Render comment form echo $p->comments->renderForm(); If you have the "Redirect after comment post?" option checked then the user will be redirected to the page being commented on after the form is submitted. You probably don't want that so you could adjust the value of the hidden page_id field in the comment form. Unfortunately there's not much that's hookable in the FieldtypeComments module so you'd have to do this by editing CommentForm.php (first copy the FieldtypeComments module to /site/modules/) or use Javascript to change the field value. Alternatively you could disable the built-in redirect option and handle redirection after form submission via your own code.- 1 reply
-
- 4
-
-
Have a look at the Connect Page Fields module. This will let you simultaneously add conferences to speakers when you add speakers to conferences. You can also get pages that reference a page via the API with $page->references() since PW 3.0.107.
-
[solved] Is it possible to render a page with a page number?
Robin S replied to Robin S's topic in General Support
Good ol' ProcessWire - there's always a way! // Get the page to render $p = $pages(1234); // Set a page number $input->setPageNum(2); // Set a URL segment $input->setUrlSegment(1, 'my-segment'); // Set a GET variable $input->get->foo = 'bar'; // Render the page echo $p->render();- 1 reply
-
- 5
-
-
If I have a template "news_items" that has page numbers enabled and that lists child pages ("news_item") with a limit of 20 news items per page, is there a way I can use $page->render() to render the page with a page number other than 1? For example, what if I want to render page 2 showing news items 21-40? It seems like it ought to be possible to do this but I can't work out how. And similarly, is it possible to render a page with a particular URL segment or a particular GET variable?
-
Collapsing of fields grouped by Tags don't work anymore
Robin S replied to Klenkes's topic in General Support
Have you tried Fields > Manage Tags > [your tag] > Display as collapsed in fields list? -
v0.1.1 released: if you select more than one bottom page per parent then their sort order in the page list will be the same as the sort order in the module config.
-
Make page stick to the bottom of the page tree
Robin S replied to Michael van Laar's topic in General Support
Here is a module: ? -
Pages At Bottom Keeps selected pages at the bottom of their siblings. A "bottom page" will stay at the bottom even if it is drag-sorted to a different location or another page is drag-sorted below it (after Page List is refreshed the bottom page will still be at the bottom). Newly added sibling pages will not appear below a bottom page. The module also prevents the API methods $pages->sort() and $pages->insertAfter() from affecting the position of bottom pages. Note: the module only works when the sort setting for children on the parent page/template is "Manual drag-n-drop". Why? Because you want some pages to always be at the bottom of their siblings for one reason or another. And someone requested it. ? Usage Install the Pages At Bottom module. Select one or more pages to keep at the bottom of their siblings. If you select more than one bottom page per parent then their sort order in the page list will be the same as the sort order in the module config. https://github.com/Toutouwai/PagesAtBottom https://modules.processwire.com/modules/pages-at-bottom/
-
It's working for me using the code from your first post. ProcessGoodNews.zip If this module you're working on is going to be freely shared with community when finished then maybe it would be good to put your code into a public GitHub repo now so people can see the code and help you with problems that come up as you are developing it.
-
[SOLVED] Module error (first steps) - what's wrong?
Robin S replied to Gadgetto's topic in Module/Plugin Development
Also take a look at Ryan's helpful ProcessHello demo module: https://github.com/ryancramerdesign/ProcessHello It's a lot simpler to use getModuleInfo() (or its equivalent if using the other module configuration options Horst linked to above) to specify the page used by the Process module because then it will be automatically created on module install and removed on module uninstall. See the ProcessHello example: https://github.com/ryancramerdesign/ProcessHello/blob/9c1aa18eb40d069c7fb227f09badddc90f0b3276/ProcessHello.info.php#L41-L46 -
The PageActionClearImageVariations module sounds very useful, thanks @ryan. I have a number of sites where I suspect I have a significant amount of wasted disk space due to orphaned image variations. Trouble is that I don't think I would able to identify the orphaned variations from attributes such as width and height. What would be ideal would be if there was some way to identify orphaned variations based on whether they are called within any site code (template files or modules). Do you think there would be any way to accomplish that? Another idea I had was to see if fileatime() could be used to check if a file has not been accessed in a long time (which would be configurable) but based on a quick test it seems that the last accessed time does not get updated when an image is loaded by a browser. Any other approaches that could be useful here?