cst989
Members-
Posts
159 -
Joined
-
Last visited
Everything posted by cst989
-
[[Template core/front/system/searchResult is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]]
-
Is there an answer for this? I would like to know this also. I have considered (and it has been suggested before) that you could add a custom field for disabling the page in the default language. Then throw a 404 easily if that field is checked. However the issue remains with any selectors, find() etc. that are listing pages. They correctly check for the "Active" checkbox for non-default languages, excluding pages in menus etc.. But you would have to manually update any existing selectors to exclude pages with this new field checked. Unless there's a way to modify core selector process and exclude pages at the top level? Maybe with a hook on $pages->find()? I don't know if that's possible. Edit: this is how I've done it, however I suspect I've probably missed something as I've not tested it thoroughly yet... exclude_in_default_language is a checkbox field $this->addHookBefore('PageRender::renderPage', function() { if(!$this->user->isSuperuser() && $this->user->language->id == $this->languages->getDefault()->id && $this->page->exclude_in_default_language == 1) { throw new Wire404Exception(); } }); $this->addHookBefore('Pages::find', function(HookEvent $event) { $selector = $event->arguments(0); if ( !is_int($selector) && /* seemed to run into an issue with selectors like $pages->find(27) which loads the 404 page, this is just here to tackle that */ !empty($selector) && /* not sure why this would ever happen but I think appending with a comma would be an issue if it did */ $this->page->rootParent->id != 2 && /* exclude admin */ $this->user->language->id == $this->languages->getDefault()->id ) { $selector = $event->arguments(0); $selector .= ', exclude_in_default_language<1'; $event->arguments(0, $selector); } }); Edit 2: Pagination might still be a problem, not sure if this works Ideally I'd have used addHookBefore on the Pages:find, but I struggled in that case searching against a field that might not exist. Updated the hook to "before"
-
Searching through nested repeater items, is there a better way?
cst989 replied to cst989's topic in API & Templates
Thanks Robin, what a dope, I know that the query needs sanitizing it just escaped my brain for a moment. -
Hi there, recently found myself wanting to search through nested repeater items on a page, for reference they were FAQs, organised into FAQ groups, so: faqs_group (parent repeater with group title) faqs (repeater item with title/body) faqs (repeater item with title/body) faqs (repeater item with title/body) faqs_group faqs faqs Etc. However, when I do a search of these FAQ items, I don't want them grouped anymore, just want to find the FAQ items and display them all. Firstly I searched using the repeater_faqs template that Processwire generates, that works fine once you add check_access=0 since this template shouldn't normally be searched by regular users (found in another thread on here) - but then I need to narrow it down to just those FAQs on the current page so that the search doesn't find items related to totally different pages in the future. The only way we could figure out to do this was to loop through all the FAQs on the page, grab their IDs, then limit our search result to these IDs. This is what I ended up with, but I feel like there must be a better way using the API that I missed? $ids = []; foreach ($page->faqs_groups as $group){ foreach($group->faqs as $faq){ $ids[] = $faq->id; } } $ids = implode('|',$ids); $results = $pages->find("id=$ids, title|body*={$input->get->search}, template=repeater_faqs, check_access=0");
-
Was this tackled in the 1.1.1 update? I can see it's still an open issue on github
-
I'm dying to know, am I the only one bothered by (or maybe the only one seeing??) this line under the tabs now? ?
-
Module Profile Export module (also upgrade PW 2.0 to 2.1)
cst989 replied to ryan's topic in Modules/Plugins
Does anyone know if it's possible to modify the installation process without overriding a core file (e.g. install.php) ? I'm trying to create a starting point for my colleagues and I'd like to limit what the admin can be called, and what the CMS URL can be, etc. -
The video on this page is not loading - didn't fill my boss with confidence when I said "yeah, Processwire could be a great solution for a multilingual site, let me show you their docs!" https://processwire.com/docs/multi-language-support/multi-language-fields/
-
Hello, this is a great module! Is it possible to make subfields of Profields: Combo selectable for indexing?
-
For some reason this map marker field has stopped working on my production server. It just saves 0.00000 as both lat and lng values, even though it correctly finds and shows the lat/lng on the field itself.
-
The only time I've had different output in different browsers that wasn't a CSS etc issue, was with https or cross-browser cookie policies, where one browser was more strict with what it blocked than the other. I know I'm just brainstorming and it doesn't match the code you've provided, but food for thought maybe for you or another who lands here from google...
-
Best way to store table data - with columns managed per-page?
cst989 replied to cst989's topic in API & Templates
That looks... remarkably like what I mean! Probably more feature-rich than I even need but definitely solving the same issue. The latest idea I was going to do was to use the ProFields: Table I mentioned above, and then use hooks to cache and store only the columns I need on a per-page basis. But I might keep an eye out to see what your solution is first! ? -
Hi guys, this is one that's stumped me for a while and I've tried various methods none of which I've been particularly happy with. Basically I want a table field where the CMS user can add or remove columns as they need them. The usage for this is a catalogue website where products have a long list of model variations. For each product category or even individual products, the headers and number of columns could be completely different. A HTML table in a WYSIWYG would probably suffice - at least the kind of functionality you get with that is the kind of thing I'm after. Except that I want it to be both importable from a CSV, and the resultant data to be a bit more accessible afterwards. One option I've used in the past was to use Repeater Matrix, where the first entry controls headers and subsequent entries control all rows (and have to have the same number of sub-fields to match the header row). This worked from an import/usage perspective, but is hardly clean management in the CMS. Other times I've resorted to the fact that the CMS user can never manage the table with the CMS, and simply has to re-import. This way I can simply store the data however I like (custom table, json etc). I considered using ProFields: Table and simply putting all the possible columns in one field, then the user simply scans over fields that don't apply to the product. My concern with this is that the table could be huge and slow down the site - is that a valid concern?
-
Just bumping this thread from a couple of years ago because it's the top result for "fieldset page as a tab" ? I wanted to say that I think it would be a really good idea if this was baked into the Fieldset Page by default. In fact, I think a tick box to make basically any field live in a tab of its own could be a pretty good idea. At this point a single field can contain so many subfields. There's Repeater Matrix, FieldsetPage, Profields: Combo, tables, textareas, and more. Many of these field types do a great job of reducing the amount of fields you need overall, but also lead to a very cluttered page edit screen. Fieldset Tabs were excellent in the past when we didn't have so many clever fields-within-fields, but now it feels like there could be a better way?
-
Thank you, that worked! I wanted to loop through the results to template them manually and for some reason I had to change the following, which did nothing: echo $limitedResults->renderPager(); to $pager = $modules->get("MarkupPagerNav"); echo $pager->render($limitedResults); but otherwise, got there in the end.
-
Ah yes, that's something I thought of and an elegant solution. But yeah a single selector I think is something I need, as unfortunately there's one additional thing I should've mentioned in the original post, I need to render pagination! And I don't think that will play nicely with combining queries and slices.
-
I would like to sort search results so that those with a specific root parent ID (could be the immediate parent, could be one higher) are prioritised, essentially pinned to the top of the results. How can I do this please? My existing query is very straightforward (using SearchEngine module for index): $pages->find('search_index%=' . $query . ', limit=15'); Essentially what I want is something like this: $pages->find('search_index%=' . $query . ', sort=[has_parent=1234], limit=15'); Thanks.
-
Best way to do a fixed count, repeated group of fields?
cst989 replied to cst989's topic in General Support
I didn't get as far as checking if a table field would save the rows when they were new, because unfortunately table doesn't offer as many options that I needed, like a default option on selector, or the ability to show/hide fields I ended up sticking with the repeater matrix but forcing the repeater to publish on save. I tried the following, it worked at first but then it started creating database errors.... $this->addHookAfter("Pages::saveReady", function (HookEvent $event) { $page = $event->arguments("page"); if(!($page->hasField("featured_articles"))) return; foreach($page->featured_articles as $item) { $item->of(false); $item->status("published"); $item->save(); } }); now I think I'm just going to create 5 separate fields of "fieldset (page)" type ? -
PW 3.0.187 – New Repeater + Repeater Matrix features
cst989 replied to ryan's topic in News & Announcements
Wow its funny you added this... I created something just a few months ago using CSS to achieve this... wish I'd waited! Mine... -
Unfortunately the module doesn't seem to work at all for me. Also none of the theme options seem to change anything. Perhaps it's using it inside a RepeaterMatrix field that's the problem? This is PW 3.0.184. Also the above post about performance is a bit disconcerting but I've not gotten far enough to test that It's a shame because it looks perfect for what I needed otherwise. Including ionicons was a great choice.
-
Best way to do a fixed count, repeated group of fields?
cst989 replied to cst989's topic in General Support
That looks great! If "show all rows" is selected, and you open and save a fresh page with that field, does it actually save rows for you to iterate through? Per my issue at the end of my first post -- it caused me some issues with repeater -
Best way to do a fixed count, repeated group of fields?
cst989 replied to cst989's topic in General Support
You know what, I have a long expired subscription for ProFields and I have been weighing up whether or not I need to renew ? I will take a look, thanks -
Hi, I'm using a repeater in the following manner: I have set the minimum items to 5, and the maximum number of items to 5. I basically just want to loop through a few fields five times. But I feel like I'm really forcing the repeater to do something it's not really meant for by doing this. A table would look and feel better, but as far as I know can't be fixed to x rows/pre-populated. Also there's a technical problem with this. Repeater rows do not seem to save unless you change something. So if I make a new page with the fields above and hit save, no data is actually available for the field. In my screenshot you can see that items #1 and #5 have saved because the type has been changed to 2 - they're solid and don't say "New" anymore. Also item #4 has saved because the type was changed and changed back. But #2 and #3 won't ever save unless you change the value. If there's not a better suggestion for the approach in general - I would appreciate any technical support in forcing each row to save!
-
Sorry I should've been clearer, what I was seeing was that the description was still visible, but the padding broke and spacing at the bottom of the fieldset was out of alignment. The way I'm trying to use minimal fieldset is like this: For me, a description would still be kinda handy to have - but I appreciate it would need new CSS logic and that's more complicated than it seems. And I understand if this isn't exactly the aim of the module. 0.1.7 certainly fixes the visual hiccup pictured, so thanks for that ?