Announcement

Collapse
No announcement yet.

Pagination & View more/all

Collapse
X
Collapse
First Prev Next Last
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Pagination & View more/all

    Hi glennrocksvb , hi all !

    I've been trying to stay away from your help and figure out things by myself, not because your help isn't good, quite the contrary, but because I think it's the best way to learn.

    But you can't always figure everything out by yourself in an instant, hence this new post.

    I'm building a custom new page, to display the most recent topic/replies using the search widget module (the Activity stream is bugging because of a cache issue on my server)

    Two issues :

    If I input the JSON parameter into the url, following on the vbulletin.com tutorial, I can get the exact display I want to use :

    searchJSON={"type":["vBForum_Text"],"view":"default","ignore_cache":"1","sort":{"last content":"desc"},"date":{"from":"10"},"exclude_typ e":["vBForum_PrivateMessage"]}

    But if I use those parameters in the advanced mode of the search module widget, I don't get the same page display at all (no pagination, etc...)

    I even tried inputting those parameters directly in the database, but no luck, it can even say : no result meet the criteria

    Second issue :

    I tried other stuff, nothing really satisfying, but one of the things that bugs me the most is the pagination, currently I'll get a very, very long page, with a lot of result, and the option to view more or view all.
    But no page numbers.

    I saw a couple of your post Glenn to disable Ajax, but I don't think it's the heart of the problem, I don't mind Ajax here, I would like to have a regular pagination, like the classic search result return.

    Do you have any clue or help for me regarding one of those problems or even better, the two of them

    Thanks a lot

    #2
    Did you remove the searchJSON= when using the JSON in the Search Module?

    The Search Results page contains pagination controls. Which page were you referring to?
    Helpful? Donate. Thanks!
    Buy me a coffeePayPal QR Code
    Fast VPS Host for vBulletin:
    A2 Hosting & IONOS

    Comment


      #3
      Thanks for the prompt answer Glen, always appreciate your support !

      I forgot to say, but yes I've only used the arguments after the SearchJSON=
      And when modifying the database I've only edited the part concerned and not what was after.

      The search result page contain indeed pagination, but the search widget doesn't seem to have pagination, even with a standard result the widget doesn't seem to show pagination, only the View more or View all button

      I'm using the Site editor to build a simple page

      Comment


        #4
        Originally posted by Glaudiar View Post
        The search result page contain indeed pagination, but the search widget doesn't seem to have pagination, even with a standard result the widget doesn't seem to show pagination, only the View more or View all button
        Yes the Search Module only contains View All button that leads to the Search Results page with pagination. That's how they designed that module. But personally in my opinion, I think that makes sense. I wouldn't want to clutter the Search module with pagination buttons. And if you added pagination buttons in the Search Module, it would require AJAX to dynamically update the content of the module without reloading the page and affecting other modules on the page.
        Helpful? Donate. Thanks!
        Buy me a coffeePayPal QR Code
        Fast VPS Host for vBulletin:
        A2 Hosting & IONOS

        Comment


          #5
          Originally posted by glennrocksvb View Post
          if you added pagination buttons in the Search Module, it would require AJAX to dynamically update the content of the module without reloading the page and affecting other modules on the page.
          Which would be awesome I think lol But I wouldn't mind this action to refresh the all page, it's the going to an another different page that is an annoyance to me.
          Currently If I want to build a page, with say, tabbed content, and other module on it, I obviously don't want to show 250 result on the first page, that would be a mess, that force the user to click View all and open another window.

          There's no way to have the search results inside some sort of include in php or iframe in html, directly into the page I'm building ?
          What's pleasing is the way the search results are displayed, the "see more" and "go to post" option are neat (I know that the title will take the user to the post in the other views, but still), the fact that you have direct access to IP, Edit, Like etc... whereas on the search module view, it's pretty limited

          I don't mind customizing templates, etc... as you know, cloning this widget and making a new one wouldn't work either I guess right ?

          Comment


            #6
            I'll take a look if it's possible to create a new module similar to Search Results module.
            Helpful? Donate. Thanks!
            Buy me a coffeePayPal QR Code
            Fast VPS Host for vBulletin:
            A2 Hosting & IONOS

            Comment


              #7
              Originally posted by glennrocksvb View Post
              I'll take a look if it's possible to create a new module similar to Search Results module.
              Thanks !

              I could look at it myself too, but I don't know which one I should be looking at, there's multiple widget template, search, search2, search_result (which would be my first guess) etc...

              Comment


                #8
                I was also wondering if you think there could be a simple way to add a specific search, I don't necessarily need a "do it all" plugin customised, I already have the exact searchJSON argument I need.
                At some point in the widget, those arguments are fed to the search function.

                Thinking out loud :

                - It seems that Vbulletin register the search under an ID like : search?r=ID to generate a link to the full search page. Of course I don't want to include the whole page, only the search results are of interest to me, I guess there's no way (php, javascript or Vb code) to only do a sort of "include" of those results inside a php module, html module or via a simple vb module ?

                - I've looked at the search result page (a random one) and if you go through the site builder, you can see that a module called "Search Result module" do exist, you can even move it around, but you can't "use" this module when building a custom page.
                Would the solution be to "clone" this module by copying his code and make it available everywhere as a custom widget (need to see what's preventing the appearance of this module), I guess this module would have to be edited to accept search arguments, either by hard coding them (a bit annoying) or by just adding an option to the widget ?

                It seems that this problem is more a matter of design choice (which I can understand, you have to make them at some point and they'll not always fit everyone) rather than a limitation they purposely inserted to prevent the module to be used.

                There must be something I'm missing in my thought, hope you can clue me in, I don't want to waste your time by looking at that, more than you have time to spare

                Cheers

                Comment


                  #9
                  You need to clone the Search Results module via new product XML that will be installed as a product. I think the existing Search Results module is a system module which prevents it from being used on other pages.
                  Helpful? Donate. Thanks!
                  Buy me a coffeePayPal QR Code
                  Fast VPS Host for vBulletin:
                  A2 Hosting & IONOS

                  Comment


                    #10
                    I'll give that a go and keep you posted on this

                    Comment


                      #11
                      It seems to be working, at least the widget don't throw any error, and without modifying the content of it, I just get a "This search didn't return any result".

                      Next course of action is to modify this part I guess :

                      Code:
                      <vb:if condition="!empty($searchJSON)">
                                              {vb:rawdata nodes, search, getInitialResults, {vb:raw searchJSONParam}, {vb:raw widgetConfig.resultsPerPage}, {vb:raw page.currentPage}, 1, 1}
                                              {vb:set searchJSON, {vb:raw nodes.searchJSON}}
                                              {vb:set searchJSONStructure, {vb:raw nodes.searchJSONStructure}}
                                              <vb:if condition="!empty($searchJSONStructure['error'])">
                                                  {vb:set redirurl, 'search?e='}
                                                  {vb:strcat redirurl, {vb:raw nodes.resultId}}
                                                  {vb:redirect {vb:raw redirurl}}
                                              </vb:if>
                      Since this module is loaded without having any parameter, my guess is it'll automatically land on this function, am I right ?

                      I'm a bit lost about where I would insert my search terms in there ?
                      Would it be there ?

                      Code:
                      {vb:set searchJSON, {vb:raw nodes.searchJSON}}
                      Replacing {vb:raw nodes.searchJSON} by ideally, the content of the field added in the widget options ?

                      Or am I completely wrong there ?

                      Comment


                      • Glaudiar
                        Glaudiar commented
                        Editing a comment
                        Or would it be better for me to add some sort of set SearchJSON with the field value in it, to make it believe he received the arguments, rather than modifying it's functions ?

                      • glennrocksvb
                        glennrocksvb commented
                        Editing a comment
                        You can do what you are thinking. But ideally, if you create a product XML, you can add module configuration settings and make the module available in the Modules tab.

                      #12
                      Oh I must not have been clear enough in my explanation, sorry, that's exactly what I did, I just need to figure out now, where to edit/add the field that will be supplied by the module options, in the original code.
                      I believe this code is meant to have argument parsed into him before showing, here I only display the "blank" or "default" page result.

                      I hadn't pay enough attention on my code posted above, but I posted the part where it handle the presence of result, I always get screwed by the "!" before the variable declaration, silly me !

                      I would guess modifying something in this part :

                      {vb:set searchJSONParam, {vb:compilesearch {vb:raw searchJSON}, {vb:raw page}}}
                      {vb:set searchJSONParam, {vbhp json_decode,{vb:raw searchJSONParam},1}}
                      {vb:set orgJSONParam, {vb:raw searchJSONParam}}
                      <vb:comment>set default json params for the search page here</vb:comment>
                      <vb:if condition="!isset($searchJSONParam['ignore_protected'])">
                      {vb:set searchJSONParam.ignore_protected, '1'}
                      </vb:if>
                      <vb:if condition="!empty($searchJSON)">
                      {vb:rawdata nodes, search, getInitialResults, {vb:raw searchJSONParam}, {vb:raw widgetConfig.resultsPerPage}, {vb:raw page.currentPage}, 1, 1}
                      {vb:set searchJSON, {vb:raw nodes.searchJSON}}
                      {vb:set searchJSONStructure, {vb:raw nodes.searchJSONStructure}}
                      <vb:if condition="!empty($searchJSONStructure['error'])">
                      {vb:set redirurl, 'search?e='}
                      {vb:strcat redirurl, {vb:raw nodes.resultId}}
                      {vb:redirect {vb:raw redirurl}}
                      </vb:if>
                      <vb:else />
                      <vb:if condition="!empty($page['resultId'])">
                      {vb:rawdata nodes, search, getMoreResults, {vb:raw page.resultId}, {vb:raw widgetConfig.resultsPerPage}, {vb:raw page.currentPage}}
                      {vb:set searchJSON, {vb:raw nodes.searchJSON}}
                      </vb:if>
                      </vb:if>
                      Is the correct way to go right ?

                      Comment


                        #13
                        I don't think you need to edit the template code itself. The module configuration settings must be included in the <widgets> tag in the product XML.
                        Helpful? Donate. Thanks!
                        Buy me a coffeePayPal QR Code
                        Fast VPS Host for vBulletin:
                        A2 Hosting & IONOS

                        Comment


                          #14
                          Originally posted by glennrocksvb View Post
                          I don't think you need to edit the template code itself. The module configuration settings must be included in the <widgets> tag in the product XML.
                          My understanding of this widget is that it was just here to produce search results (I may be wrong) but those search results needs to come from somewhere no ?
                          I was thinking that I need to add something to the original code, a way to supply the code with the search arguments, in order for this module to display them (can be wrong again)

                          You think I just need to copy the original search widget options (the one that is available everywhere) and integrate them to the current search result widget I created ?

                          Currently I was trying to add things like that :

                          Code:
                          <vb:comment>set default json params for the search page here</vb:comment>
                                              <vb:if condition="!isset($searchJSONParam['ignore_protected'])">
                                                  {vb:set searchJSONParam.ignore_protected, '1'}
                                              </vb:if>
                                                  {vb:set searchJSONParam.view, 'activity'}
                                                  {vb:set searchJSONParam.ignore_cache, '1'}
                                                  {vb:set searchJSONParam.keywords,'goat'}
                          To the above code but it doesn't seem to work (maybe bad syntax or bad place to add them) just to test forced results

                          What do you think ?

                          Comment


                            #15
                            The values for the module settings must come from when the admin edits and sets the module configuration settings. The module template code itself doesn't need to be modified. It is already expecting to get the search options from the module configuration settings.
                            Helpful? Donate. Thanks!
                            Buy me a coffeePayPal QR Code
                            Fast VPS Host for vBulletin:
                            A2 Hosting & IONOS

                            Comment

                            Users Viewing This Page

                            Collapse

                            There is 1 user viewing this forum topic.

                            • Guest Guest

                            Latest Posts

                            Collapse

                            Working...
                            X
                            Searching...Please wait.
                            An unexpected error was returned: 'Your submission could not be processed because you have logged in since the previous page was loaded.

                            Please push the back button and reload the previous window.'
                            An unexpected error was returned: 'Your submission could not be processed because the token has expired.

                            Please push the back button and reload the previous window.'
                            An internal error has occurred and the module cannot be displayed.
                            There are no results that meet this criteria.
                            Search Result for "|||"