Jump to content
Mike Rockett

Excluding repeaters from $pages->find()

Recommended Posts

Greetings :)

I'm new to PW, and think it's fantastic! Never, ever, have I seen such an amazing CMF!

Anyways, to my question: I had set some Hanna Code to render a list of page suggestions on the http404 page, which works perfectly. The problem, however, comes in when I use repeaters, which are page instances.

The page suggestion renderer has the following:

    $suggestions = $pages->find('name|title|summary|body%='.$request);

I have a page that is named services-industries, and repeaters with the word services in the name. As such, repeaters appear in the suggestion results-list if applicable to the search.

How can I exclude/remove those?

Share this post


Link to post
Share on other sites

Welcome! Repeaters shouldn't be there, since they are hidden. Do you have include=hidden in selector also?

Also do you really need the name in the selector?

Share this post


Link to post
Share on other sites

Hi :) No, I don't have any selectors like that.

I thought that since I'm searching for suggestions based on the request (which is the name), that I should also be searching for others by name as well. Nonetheless, if I remove name from the query, I still get the repeaters.

Though, I've just noticed that they only appear when I am logged in. Each repeater contains a link to itself in the backend. But when you click on it, it says that there's no Process for this. This is an example URI: /administration/repeaters/for-field-136/

Anyways, if I'm logged out, it's cool. Perhaps there's a bug, or was it like that intentionally?

Share this post


Link to post
Share on other sites

I've noticed the same thing: when logged in, all repeaters are included in the search results. I don't know if this is ok, or if there's a reason. It looks weird to me :mellow:

Share this post


Link to post
Share on other sites

A temporary fix would be using this"!template^=repeater_", but maybe someone should file a github issue, so Ryan can take a look at it. 

Share this post


Link to post
Share on other sites

Repeaters are stored in admin with own template not "admin" template, so a logged in superuser see's them but others not.

it's not a bug. You could exclude admin or by template if you want superuser not see them.

has_parent!=2

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By marcus
      wireshell 1.0.0 is out    
      See Bea's post
       


      -------- Original post -----------
        Now this one could be a rather long post about only an experimental niche tool, but maybe a helpful one for some, so stay with me   Intention Do you guys know "Artisan" (Laravel) or "Drush" (Drupal)? If not: These are command line companions for said systems, and very useful for running certain (e.g. maintenance, installation) task quickly - without having to use the Admin Interface, first and foremost when dealing with local ProcessWire installations. And since it has a powerful API and an easy way of being bootstrapped into CLIs like this, I think such a tool has a certain potential in the PW universe.    It's totally not the first approach of this kind. But: this one should be easily extendable - and is based on PHP (specifically: the Console component of the Symfony Framework). Every command is tidily wrapped in its own class, dependencies are clearly visible, and so on.   ( Here was the outdated documentation. Please visit wireshell.pw for the current one )
    • By michelangelo
      Hello guys,
      very simple question about repeaters from the Core Modules. I have used them before without issues. This one concerns a weird behaviour which I am not sure whether it's caused by me not using it correctly or a bug. The problem is that when I add content, save it, refresh the page and return to the page, I cannot unfold the repeater. I made a video so you can see the behaviour (below)
      I tried re-initiating the repeater field, but still doesn't work...

      Looking forward to your advice!

      Thanks!


       
      repeater-problem.mp4
    • By benbyf
      Hello, and welcome to what I though was either my client being silly and changing things, or some evil doer. Turns out its reproducible and therefore something in Proceswire (I checked my templates and modules but couldnt find anything that would be doing this...). So what is it doing? Check out the video for evidence.
      A repeater field is interacting with a page template and another repeater field somehow to swap the fields in the template and repeater over...
      I have a template called team, and a repeater field called team_repeater with label Team. Some how and for some reason, when I change my fields on repeater called main_menu_links my team template gets those fields and when I try and revert the team template fields to the fields it should have, they get given to the repeater main_menu_links. Also this to say HELP!!!!!
      video: https://www.dropbox.com/s/exkdhc6n7x0xpsa/strange-repeater-PW-mega-bug.mov?dl=0
    • By neonwired
      I have a front end form for creating new pages, repeater and repeater matrix field don't seem to save any data. I was considering handling the data manually but can't seem to get anything useful from the post data, are there any methods i can use?
    • By quickjeff
      Hi Guys, 
      I have been debugging a site for the last 2 hours and cannot solve the issue. 
      I have a site running on 3.0.148. 
      I installed the Kongondo Blog module and was updating the templates to include the website style. 
      Once everything was set and done, I checked the page tree to see an error appear. 
      Template must be assigned a name before 'filename' can be accessed
      The same error appears in templates. 
      Debugging Steps
      I checked the templates in the server to ensure I didnt accidentally delete the namespace.  Deleted cache in browser and server under assets Still no go. 
      Any help is appreciated. 
      Thanks! 
×
×
  • Create New...