Jump to content

cst989

Members
  • Posts

    137
  • Joined

  • Last visited

Everything posted by cst989

  1. I solved this by creating a new field and saving it with a hook, essentially... if($page->template == "news-post") { $page->set('has_media', $page->image->count || $page->slideshow->count || !empty($page->video_embed)); } now I can just check if has_media=1 But I'm still curious why my old approach stopped working
  2. We have just updated a ProcessWire site from 3.0.184 to 3.0.229 and the following selector has stopped working: template=news-post,image|slideshow|video_embed!='',sort=-created In other words, I'm trying to grab the latest articles for featuring on my homepage, as long as they have at least an image, slideshow or video - if not, they're not suitable for the location. Is there an obvious reason this should've stopped working in the latest version, and/or an alternative approach?
  3. Hello, following various guides on here in years past, I've always had a css file in the admin by editing /site/templates/admin.php and adding: $config->styles->add("/site/assets/css/dist/admin.css"); Now suddenly I find that this call is aggressively cached with a v=3.0.227 on the end. Even if I add my own cache-busting variable to the end, it's ignored in favour of this. Does anyone know how to get it to clear? Or never be cached? In the end, 3 commits later, I had to rename the whole file.
  4. Bump! Nobody know if this is possible? Am I explaining the question badly? Edit: revisiting this so much later, I had a brainwave, I can simply target the field with some custom CSS: .ProcessPageEdit-template-hotel .Inputfield_gallery .Inputfield_map { display: none; }
  5. That's correct yeah and it did kick me out as expected. Clearing my cookies seems to have worked, thanks!
  6. I changed the name of "Admin", which worked as expected, and I've done many times before. However, internal links, like Setup > Templates are not updating Is there something I could do - a cache I could clear perhaps (tried object cache, procache and browser cache) - to try and solve this? This happens locally on a ddev site and in staging which is an apache/cpanel site
  7. Using the "show only if" logic on a Fieldset (Page) field settings, can I target the template of the page that's currently being edited? I think this is more complicated than it should be because the page in question is actually that kind of sub-page containing the fields E.g. template='hotels' page.template='hotels' parent.template='hotels' image of what I'm looking at...
  8. I just recently started using DDEV and it's great. However I do have one issue with it out of the box, it seems like ProcessWire's normal error reporting doesn't work for me when debug mode is on. Instead I get the standard 500 error message that would normally be shown to a logged-out user. Anyone else run into that? This is when not using Tracy Debugger. When using Tracy, it does show errors, but only if I manually set it to DEVELOPMENT mode, it's not able to DETECT that.
  9. We would like to know about this too @ryan!
  10. This module is looking great and I really appreciate all the effort that's gone into describing how to get started, videos etc.. Our team (myself excluded) is experienced with Phinx for database migrations on non-ProcessWire projects. From what I understand, a good thing about Phinx is that a file is created for each migration, that migration will only be run once, the database will record that the migration has been run, and the file will be ignored from then on. It also has a nice CLI that creates the file, dated, with the structure ready to go. I'm thinking I could write something to make it work this way... a module that manually keeps track of all these files and then creates a list, in date order, with any new files and passes that list to $rm->watch()? Or am I reinventing the wheel with something which goes against the logic of RockMigrations...? I suppose the main aim is to idiot-proof the process so nobody edits old migrations.
  11. I should add that I imagine this whole thing would be better off in a module, and not using a field but some custom way to store and filter the data, however that's not something I have time for at the moment! To me it seems a bit wild that this isn't possible by default. It's kind of like it's more of a "translated from English" module than a multi-lingual site.
  12. 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"
  13. Thanks Robin, what a dope, I know that the query needs sanitizing it just escaped my brain for a moment.
  14. 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");
  15. Was this tackled in the 1.1.1 update? I can see it's still an open issue on github
  16. I'm dying to know, am I the only one bothered by (or maybe the only one seeing??) this line under the tabs now? ?
  17. 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.
  18. 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/
  19. Hello, this is a great module! Is it possible to make subfields of Profields: Combo selectable for indexing?
  20. 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.
  21. 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...
  22. 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! ?
  23. 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?
  24. 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?
×
×
  • Create New...