Jump to content

cst989

Members
  • Posts

    134
  • Joined

  • Last visited

Posts posted by cst989

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

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

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

    image.png.960fa453b362008bac90467ee905c6bf.png

    It's a shame because it looks perfect for what I needed otherwise. Including ionicons was a great choice.

     

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

    image.thumb.png.d09a209f0111195e4021df03d9756a84.png

     

    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!

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

    image.png.ea13aa60f92310cb379fa1db647f735b.png

    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 ? 

    • Like 1
  6. I know this was asked before but I still don't fully understand, why does this module open a popup with a tab where you can select the target, if it doesn't do anything? I handed over a CMS using this field to a third party and they tried to use target="_blank" from the attributes tab of this field all over the site and were surprised when it did nothing. Wouldn't it be better if this module stored an object with these bits in, returning the link by default? Either that or at least drop the attributes tab from the popup if it doesn't do anything.

  7. I hit a back-end error with a default value on this module

    Basically I set the default opengraph image to an image within a pagereference field, like so: {banner.image}

    This works fine if it exists, but if it doesn't, it hits a fatal error

  8. What would you consider a good, clean way to append a list of pages retrieved randomly, with more random pages (excluding those you've got already)?

    Eg you start with

    $pages->find("template=gallery-detail, sort=random, limit=100");

    You output this to your template, then you have a "load more" button. This works through ajax.

    Now within the ajax, you need to select another 100, but exclude those you retrieved the first time. So I'm thinking you need to post all the pages you've got already, or maybe store in a session? And then exclude them from your next find(). But I imagine that would be a bit slow, excluding 100 pages by ID? Is there a more efficient way?

  9. Hi all, I have a simple issue with inputfield:attr() not setting a value.

    I'm doing this in ready.php

    $forms->addHook('FormBuilderProcessor::renderReady', function($e) {
        $form = $e->arguments(0);
        if($form->name != 'enquiry_form') return;
        $inputfield = $form->getChildByName('cart');
        if($inputfield) {
            $cart = json_encode(wire('session')->get('cart'));
            $inputfield->attr('value', $cart);
        }
    });

    This is lifted straight from formbuilder hooks and inputfield method specs.

    If I echo $cart it's definitely a simple string of json, but nothing appears in the cart field (which is a plain text field - later to change to hidden)

    Is there something obvious I might've overlooked here?

    As a side question, can anyone think of a better way to do this - add my cart to a Formbuilder submission (it's not a shop, just an enquiry) - while still storing entries easily in the formbuilder entries list.

  10. Thank you, I finally got around to doing this. I was able to combine in

    || $template->fieldgroup->has('meta_description')

     as well, and left out the

    , meta_title=''

     so you can see them all, empty or otherwise. Only minor oddity remaining is that all the filters generated by this script load in an open position, and you get an odd js glitch when you try to close them the first time - but beggars can't be choosers!

  11. Sorry I should've been clearer. I used the latest version, ie part of Processwire (3.0.1xx)

    The gifs etc were very big, memory limit was 128M I think. I can't tell you the exact size because I told the person editing the page to make them (much) smaller and reupload. Of course, I can increase the memory and decrease the filesize but the problem was more about  being unable to get back into the page without uninstalling the module

  12. Yeah I absolutely can narrow it down in other ways, its just that if this worked I would have something I could use on any site without modifying the templates checked each time, or having this extra step to check when finishing a site. I build quite a lot of ProcessWire sites so I'm making templates more often than most!

    I really appreciate the input though, I will make do with what I have for now. Maybe @ryan could weigh in on this one day ?

  13. I'd like a bookmark in the admin to a page list of pages that have a "meta title" field, so that you can quickly see which pages need updating. 

    Without just limiting all the templates that have the field, I want something a bit more future-proof.

    Is this possible? If so how?

    I don't want to check if its empty or not equal to anything, as it would also serve to review what is there.

    I have ListerPro as well but can't see how to do it with either.

  14. On 3/4/2019 at 7:41 PM, andi said:

    This seems like one of the nicest, cleanest methods to do this, but for me it doesn't work. I end up on this page instead

    image.png.ec655219186f67c846278467f8ca040c.png

    The Url is /manage/settings but when I click it I'm redirected to /manage/settings/bookmarks

    What am I doing wrong?

×
×
  • Create New...