Jump to content

cst989

Members
  • Posts

    134
  • Joined

  • Last visited

Posts posted by cst989

  1. 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.

  2. 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...

    image.png.7e72e48d81ecdfadd4e7f3b041132582.png

  3. 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.

    • Like 1
  4. 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. 

  5. 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"

  6. 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");

     

  7. On 12/20/2021 at 10:06 AM, DV-JF said:

    Hey @Wanze I've maybe figured out a problem with your module - see: https://github.com/wanze/SeoMaestro/issues/40

    Edit: Because this seems for me that this could be a problem for anybody else, I'll copy the text and images here - anyone else facing this problem?

    Seo image is duplacated multiple times:

    • PW Ver. 3.0.184
    • Modul Ver. 1.1.0
    • PHP 7.4
    • Settings - see. Screenshot below

    Description:
    Till now I've only setup one image on the Homepage (page id 1) for the SEO image field.
    But it seems, that every time  I save the page  I visit the page an extra image is created in site/assets/files/1234 the folder corresponding to the page I'm saving.

    EDIT OUUUCH -It seems even worse: - The suspicious files are generated every time the page is loaded in frontend - see last three screenshots.

    999075392_2021-12-2011_11_58.jpg.cfa38b9d40b7c5b4e995b2404c273100.jpg

    1295879251_2021-12-2011_13_13.jpg.03c3cff43d41d6f1402162b4f3671c12.jpg648843762_2021-12-2011_14_14.jpg.a02fd1f3700809277921516b0c362ba5.jpg

    This blows up the assets folder enormously and is absolutely weird.

    For more screenshots see attachments.

    2021-12-20 10_48_32.jpg

    2021-12-20 10_44_08.jpg

    2021-12-20 10_39_12.jpg

    Screenshot 2021-12-20 at 10-30-13 Feld bearbeiten seo_meta • stadthalle-kelkheim local.png

    Was this tackled in the 1.1.1 update? I can see it's still an open issue on github

    • Like 1
  8. 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.

  9. 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...

  10. 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?

  11. 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?

  12. 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.

    • Like 1
  13. 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.

×
×
  • Create New...