Announcement

Collapse
No announcement yet.

Pagination & View more/all

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

    #16
    Originally posted by glennrocksvb View Post
    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.
    Oh, ok, that's a good point.

    So I should use the <widgets></widgets> part of the product xml and add a <definition> ?
    Do you know what would be the definition writeup ? I don't think the current search module is stored as an xml file anywhere right ? (If so I could have studied & copy it's coding)

    Comment


      #17
      I found some XML tips in the install folder, I tried that :

      Code:
      <definition>
             <name>searchJSON</name>
             <field>LongText</field>
             <labelphrase>widget_searchresults_widgetsearch</labelphrase>
             <defaultvalue></defaultvalue>
             <isusereditable>1</isusereditable>
             <ishiddeninput>0</ishiddeninput>
             <isrequired>0</isrequired>
             <displayorder>10</displayorder>
             <validationtype>force_datatype</validationtype>
             <product>vbulletin</product>
      </definition>
      (I also tried with the name of my product instead of vbulletin, no difference)

      I do get the textbox in the widget config when I set it on a page, but by copying this JSON (for example) into it :

      {"type":["vBForum_Text"],"channel":["2"],"sort":{"lastcontent":"desc"},"view":"","exclu de_type":["vBForum_PrivateMessage"]}
      I get the same "There are no results that meet this criteria."

      Comment


        #18
        Follow up of my research :

        Given that the previous solution didn't work (certainly I'm missing something in the way I've set the definition).

        I've managed to have results shown that way :

        Code:
        {vb:set searchJSON, '{"type":["vBForum_Text"],"channel":["2"],"sort":{"lastcontent":"desc"},"view":"","exclude_type":["vBForum_PrivateMessage"]}'}
        I set this code here :

        Code:
        <vb:if condition="$searchperm">
                            <vb:if condition="!empty($page['searchJSON'])">
                                {vb:set searchJSON, {vb:raw page.searchJSON}}
                            <vb:else />
                                {vb:set searchJSON, ''}
                            </vb:if>
                            {vb:set searchJSON, '{"type":["vBForum_Text"],"channel":["2"],"sort":{"lastcontent":"desc"},"view":"","exclude_type":["vBForum_PrivateMessage"]}'}
                            {vb:set searchJSONParam, {vb:compilesearch {vb:raw searchJSON}, {vb:raw page}}}
                            {vb:set searchJSONParam, {vb:php 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>
        Of course this is only a test, I don't want to "hard code" the search arguments, but I wanted to see where I should implement them in the code.

        Problem now : I only get the full search result in the page, without any pagination at all, so I guess there's something I'm doing wrong here or I am missing other declaration elsewhere.

        What do you think glennrocksvb ? I can post the full widget here if that more convenient for you to look at ?

        Comment


          #19
          Update again :

          I've managed to find out how to control pagination :

          {vb:set widgetConfig.resultsPerPage, '10'}

          Which will of course be provided via widget options.

          Now I'm facing another problem, and there I think I'll have a hard time circumventing it, if possible at all : when switching page of research, the page load a new one in the form of http://URL/search?r=XXX&p=X

          Meaning that the whole previous page build alongside with the other module in it are rendered useless since we're just on step 1 again with the "View all" opening another page

          Any idea ?

          Comment


            #20
            Further investigation have been made :

            glennrocksvb Am I correct in assuming that the search function isn't using ajax to display results ?
            I tested with the regular search page and the page is loading a new URL in the form I've posted above, in order to switch pages.

            I find it weird that the member list is fully using ajax to switch pages but something like the search results are not...

            Comment


              #21
              You are correct. The Search Results module doesn't use AJAX when switching pages.
              Helpful? Donate. Thanks!
              Buy me a coffeePayPal QR Code
              Fast VPS Host for vBulletin:
              A2 Hosting & IONOS

              Comment


                #22
                Originally posted by glennrocksvb View Post
                You are correct. The Search Results module doesn't use AJAX when switching pages.
                Thanks

                I guess no quick fix around that, as it's isn't just a matter of lack of parameters ?

                Comment


                  #23
                  Correct, no quick fix. But loading pagination without AJAX is better for SEO.

                  Not unless each page can still be generated on the server-side if accessed directly. This is what it does on multi-paged topics. It loads the topic pages using AJAX when clicking the pagination controls. But it also loads the topic pages via server-side when pages are accessed directly.
                  Helpful? Donate. Thanks!
                  Buy me a coffeePayPal QR Code
                  Fast VPS Host for vBulletin:
                  A2 Hosting & IONOS

                  Comment


                    #24
                    Originally posted by glennrocksvb View Post
                    Correct, no quick fix. But loading pagination without AJAX is better for SEO.
                    Agreed, not to mention that Ajax is an ad revenue killer !

                    But here nor the SEO or ads are a concern as this page I'm building is for staff members only

                    I'll try to come up with a solution for that, If something good comes out of it, I'll post it there in case someone else is interested

                    Thanks for the help Glenn

                    Comment


                      #25
                      glennrocksvb very quick question for you, I used a simple jquery "load" script like this one :



                      Targeting the div inside widgetcontnt, to try to refresh them and only them.
                      I have no error but if I hit my refresh button, the div does refresh, I have the working indicator, but then the div is blank.

                      In the console, everytime I hit the button I have this output :

                      vBulletin.loadingIndicator.show Counter: 1 Source: ajaxStart
                      vBulletin.loadingIndicator.hide Counter: 0 Source: ajaxStop

                      In your opinion, I'm entering in conflict with Vb Ajax system (even though it's not supposed to be present here) or is this something else ?

                      Comment


                        #26
                        Code:
                        $("#div").load(" #div > *");
                        The above code which is used in the sample code you linked is incorrect and doesn't do anything. The parameter for that load method is url [, data ] [, complete ] where url is the ajax URL.

                        You need to post your actual code in order for me to find the issue or at least understand exactly what you're trying to do.
                        Helpful? Donate. Thanks!
                        Buy me a coffeePayPal QR Code
                        Fast VPS Host for vBulletin:
                        A2 Hosting & IONOS

                        Comment


                          #27
                          Originally posted by glennrocksvb View Post
                          Code:
                          $("#div").load(" #div > *");
                          The above code which is used in the sample code you linked is incorrect and doesn't do anything. The parameter for that load method is url [, data ] [, complete ] where url is the ajax URL.

                          You need to post your actual code in order for me to find the issue or at least understand exactly what you're trying to do.
                          I've just changed the targeted div, but in a regular page, with two divs fetching each one another php content, this technique in the snippet works flawlessly.

                          Code:
                          <div class="div1">
                              <?php include('includenoreload.html'); ?>
                          </div>
                          
                          <div id="div">
                              <div class="div2">
                                  <?php include('includereload.html'); ?>
                              </div>
                          </div>
                          
                          <br>
                          
                          <button id="MyButton">Refresh</button>
                          
                          <script>
                           $("#MyButton").click(function() {
                              $("#div").load(" #div > *");
                            });
                          </script>
                          This above example is doing exactly what I want : reloading only the div targeted and nothing else.
                          I'm trying to reproduce that for the search result on this Vb module, by targeting the widget ID div

                          I can send you the xml file by PM if that help

                          The current page I'm using is the search result module mentioned above in this thread

                          Comment


                            #28
                            Managed to fix my error, and it does refresh the content of the div on Vbulletin (it's not optimal at all, but it's some progress).

                            glennrocksvb Do you know where I could find how the memberlist ajax is coded ? I would like to see if I can find something in there that would allow me to do an ajax pagination of the search results (or if you have a better idea on how to achieve that)

                            Comment


                            • glennrocksvb
                              glennrocksvb commented
                              Editing a comment
                              There is a JS file named memberlist.js

                            • Glaudiar
                              Glaudiar commented
                              Editing a comment
                              Yep, find it but didn't take the time to post it here, thanks for looking at that still I'm making some progress in the addition of Ajax on this, If I get somewhere, I'll post what I've found here

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