3 posts in this topic
Recently Browsing 0 members
No registered users viewing this page.
I have pages that have separated fields for first name and last name.
I'm working on a search form that has one single input field, so that if someone search for "John Doe" it should find all pages that have "first_name = John" and "last_name=Doe" or, of course, "first_name=Doe" and "last_name=John".
What would be the best use of selectors and operators in this case?
I came up with
first_name=John|Doe, last_name=John|Doe so that i should split the search key with |
I'm not sure this is the best solution.
What would you suggest?
I want to use language-alternate fields inside selectors for manipulating PageArrays, i.e. find(), sort() or filter().
I have set up a multi-lingual file upload with the file field "fileField" and its language alternate fields "fileField_lang1", "fileField_lang2", ...
This works as expected:
$matches->sort("-fileField.modified"); While this:
$matches->sort("-fileFile_lang1.modified"); ...throws an error: "Recoverable Fatal Error: Argument 1 passed to ProcessWire\PageArray::getItemPropertyValue() must be an instance of ProcessWire\Wire, boolean given, called in ..."
Maybe I have to turn off outputFormatting? But how would I do that in this context?
Any help is well appreciated, thx.
I'm trying to sort pages based on their parent's fields, which are page references.
$someOrders = $pages->find("template=order, sort=parent.customer.id"); Here, order's parent has a template called 'orderslip' that has multiple 'order' children. Orderslip contains a page field called customer, and I want to sort based on the parent's customer's id. But i can't make it work. It throws out an exception:
Error: Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'customer' in 'order clause' (in /srv/rewwwards/wire/core/PageFinder.php line 410) I'm sure customer page field exists and it works everywhere else. It's just that this time, I'm trying to sort it from a page's 'parent' selector. Is it even possible do this?
As always, any help is greatly appreciated. Thanks.
By Nils Wiere
For one of my projects, I'm currently building a small events calendar in ProcessWire. One requirement is that an event may have an unlimited number of associated dates. I tried two approaches, however each approach come with a difficulty:
1) One page per event with a repeater that holds the dates.
Page: Event 1
Text fields for shared event info Repeater with a date field (e.g. Jan 1, Feb 1, ...) Page: Event 2
Text fields for shared event info Repeater with a date field (e.g. Jan 10, Jan 11., ...) Problem: How can I get a chronological list with all events (dates + shared info) that is sorted like that:
Jan 1, Event 1 info Jan 10, Event 2 info Jan 11, Event 2 info Feb 1, Event 1 info ... I know how to access repeaters, however all I got so far is a list structured like that:
Event 1 info
Jan 1 Feb 1 Event 2 info
Jan 10 Jan 11
2) A page with a page reference field from which the backend user shall be able to directly create child pages for each associated date.
Problem: What selector string do I need in the page reference setup, to make sure the new page is always created as child of the current page (no matter where that page lives in the backend structure)? Or is this only possible with custom PHP code in ready.php?
Would you consider one of those approaches a good strategy? If so, do you have any solution to my problems? If not, is there a better way?
By Nils Wiere
This must be simple, however, I couldn't figure out how to do it. I got this structure in the admin tree:
Page 1 [Template A]
Children 1-1 [Template B]
Children 1-2 [Template B]
Children 1-3 [Template B]
Page 2 [Template A]
Children 2-1 [Template B]
Children 2-2 [Template B]
Page 3 [Template A]
Children 3-1 [Template B]
What I want in the front end, is this sort order:
Plus, the order should depend on the order in the admin tree. So, if I move Page 3 on top of the tree, the children of Page 3 should appear first.
I tried this, but the order seemed to be random (without a connection to the order in the admin tree):
I also tried this, and again I got a random looking order:
Do you have any idea?