Setting context and search_viewtype

I'm having a problem with search_viewtype;

When I change the search_viewtype in the url it effects every object on the page, so if the search_viewtype is set to gallery, any object on the page including my side bar items that are called from the object also get set to gallery.  If I set the serach_viewtype manualy just before calling a function, again it sets that value to every object on the page. 

So I thought, add a context, that inclides listing.php, that almost works, but again, if I set the search_viewtype in the url, the listed items get wrapped in the tables for gallery view....

how can I get each object called to display according to it's own search_viewtype, not the one paassed in the url?


  • Cmon' Am I to assume this is just an inherent weakness in elgg, nobody has seen this problem?

  • nobody has multiple object calls on thie pages?

    again here is another way to ask my question; 

    1) How can I set the serch_viewtype per object not the whole page.

    2) Is it possible to set the search_viewtype to a single object.

    3) is it possible to over ride the search_viewtype that get passed in the url for each object on the page.

  • I'v gone through the docs, and do not see anything that explains this, I know I might be missing something, that is why I turned to the community. I am so sure that elgg would provide a method to achieve this that I am getting frusterated with myself over here, sorry if that is reflected in my post.

    Please at least take a look at this on your own site pages

    1. go to: any page, I will use friends for my example works.
    2. append this to the url in the browser "  ?search_viewtype=gallery  "

    what you should see is the list of friends displayed as a gallery

    if you have customized your page to display content from other sections of your site, you will notice that those items will also be displayed wrapped in the gallery wrapper.

    So far what I have found is that on our entities file, is where the url switch is handled, or so I thought. I hard coded this to be set to search_viewtype=list, and the result was then a combination of list and gallery search_viewtypes where entities were list items, but wrapped in the gallery viewtype tables. This imples to me that a function in the core is setting the view type to gallery based on the url, this action should not take place in the core, unless there is a method to pass a parameter to control it's return, so in good faith I expect that elgg does provide a method for this, but I am not having any luck finding that method.


  • There is a ticket on trac concerning this:

    What version of Elgg are you using?

  • 1.7 updated a few days ago from 1.7 branch.

  • It looks like that ticket is focused on 1.6 - , becuse my search/index.php is signifigantly diffrent, I'm a little short on time now but I will take a look at merging the relevent diffrences if that seems appropriate when I can dedicate some time.  Thanks for pointing me in a direction.

  • I taking a fresh approach to this starting with updating mod/search from the trunk, I noticed one possible bug; search results for GROUPS displayed while Groups PLUGIN is disabled.