We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16240
    • 64 Posts
    Hi! Sorry for my English. wink I’m from Russia

    I have problem:
    I call snippet:
    [!tvExplorer? &dittoSnippetParameters=`tpl:ditto_search|debug:1|paginate:1|depth:5|parents:47` &dittoName=`Ditto` &formTPL=`123`!]
    [+tve.searchForm+]
    [+tve.dittoList+]
    


    Form template:
    <form action= " [~[*id*]~] “method= "get” >
    <input type="hidden" name="id" value="[*id*]" />
    <fieldset>
    [+tve.qwe:filter->4+]
    </fieldset>
    <fieldset>
    [+tve.asd:filter->4:blankLabel->-+]
    </fieldset>
    <fieldset>
    [+tve.zxc:filter->4+]
    </fieldset>
    <fieldset class= "sendForm" >
    <input type= "submit" name= "search" value= "Search"/>
    </fieldset>
    </form>
    


    I have this error:
    « MODx Parse Error »
    MODx encountered the following error while attempting to parse the requested resource:
    « PHP Parse Error »
     
    PHP error debug
      Error: 	htmlspecialchars() expects parameter 1 to be string, array given	 
      Error type/ Nr.: 	Warning - 2	 
      File: 	/home/ginkoru8/public_html/assets/snippets/ditto/classes/ditto.class.inc.php	 
      Line: 	942	 
      Line 942 source: 	$query[htmlspecialchars($param, ENT_QUOTES)] = htmlspecialchars($value, ENT_QUOTES); 	 
     
    Parser timing
      MySQL:      0.0597 s	(16 Requests)
      PHP:          0.3040 s	 
      Total: 	0.3637 s	 
    


    FURL is OFF. Where is my mistake? huh
      • 11975
      • 2,542 Posts
      Hi,

      could you please give me more information?

      ditto version?
      is the site on line and could you provide me the url by PM and if possible an account to log me in

      :-)
        Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
        • 16240
        • 64 Posts
        MODx 0.9.5 (maybe it is the reason?)
        Ditto 2.0.3
        Win1251
        I have cleaned from a call "pagination", because in line 942 are something about Pagination (My PHP is bad... very bad). And now I have this error:
        PHP error debug
          Error: 	htmlspecialchars() expects parameter 1 to be string, array given	 
          Error type/ Nr.: 	Warning - 2	 
          File: 	/home/ginkoru8/public_html/assets/snippets/ditto/debug/modxDebugConsole.class.php	 
          Line: 	79	 
          Line 79 source: 	$query[htmlspecialchars($param, ENT_QUOTES)] = htmlspecialchars($value, ENT_QUOTES); 	
        

        I in despair... huh

        UPD: I seem have found the reason. I have cleaned ’debug’ from snippet call. Now I have ’ No documents found. ’ But it already result! I shall understand with filters. Now my call is:
        [!tvExplorer? &dittoSnippetParameters=`tpl:ditto_search` &dittoName=`Ditto` &formTPL=`123`!]
        [+tve.searchForm+]
        [+tve.dittoList+]
        


        I have clean all Ditto parameters, that Explorer have started to work (I understand, that it not the decision. And in the future I shall face problems of addition of parameters), but I don’t see another way huh Specifying(?) specific parameters of existing page, I all the same receive ’ No documents found. ’

        Chunk 123:
        <form action= " [~[*id*]~] “method= "get” >
        <input type="hidden" name="id" value="[*id*]" />
        <fieldset>
        [+tve.qwe:filter->9+]
        </fieldset>
        <fieldset>
        [+tve.asd:filter->9+]
        </fieldset>
        <fieldset>
        [+tve.zxc:filter->9+]
        </fieldset>
        <fieldset class= "sendForm" >
        <input type= "submit" name= "search" value= "Search"/>
        </fieldset>
        </form>
        

        I’m don’t understand what I doing wrong...
        Oh, my God! I solve problems, cleaning values from snippet smiley
          • 11975
          • 2,542 Posts
          Hi,

          tvExplorer has never been tested with ditto 2.0.3
          The buildUrl function has been mofidied.
          As the checkbox input are named as an array name="tvname[]", the buildUrl fails.
          I’ve commented the line involved and there are no more errors but I need to look at those modifications to deal with.
          I’ve tried to fix this on your website but no luck.
          The debug mode doesn’t work.
          So I can’t get any information
          I will try to fix this and will let you know If I’ve fiure out what’s going on.

          You could downgrade ditto and download the 2.0.2 version

          :-)
            Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
            • 16240
            • 64 Posts
            heliotrope, thanks for your help! I shall try Ditto version 2.0.2. I shall try to solve a problem! wink

            UPD: I solved it! It’s work! heliotrope, thank you... no, THANK YOU VERY MUCH!!!!!!! The community keeps on such people as you
              • 11975
              • 2,542 Posts
              Hi,

              about Ditto 2.0.3 compatibility.

              Mark has changed the builUrl function. But it fails when array are in the $_GET values.

              Here is a quick fix :
              in ditto.class.php add this function


              function applyHsc($var){
              $var = htmlspecialchars($var, ENT_QUOTES);

              }

              and in buildUrl change the first foreach loop


              foreach ($_GET as $param=>$value) {
              if ($param != ’id’ && $param != ’q’) {
              $keyparam =htmlspecialchars($param, ENT_QUOTES);
              $keyvalue = (is_array($value)) ? array_walk($value,"ditto::applyHsc") : htmlspecialchars($value, ENT_QUOTES);
              $query[$keyparam] = $keyvalue;
              }

              I couldn’t use

              array_walk($value,array($this,"applyHsc")) because the tagging.class use ditto::buildUrl

              :-)
              P.S you still have to apply the change mentionned in the first tveditor post.
              change the line:
              $url = $modx->makeURL(trim($cID), ’’, $queryString);
              to
              $url = (isset($modx->documentObject[’id’])) ? $modx->makeURL(trim($cID), ’’, $queryString) : ’index.php?id=’.$GLOBALS[’modID’].$queryString;
                 
                Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
                • 20054
                • 21 Posts
                Hey Heliotrope,

                I’ve got my search form working well, as well as pagination, but when I use the two together things get messy. I have the following code for my pagination:
                <p class="ditto-pagination">
                Page <strong> [+currentPage+] </strong> of <strong> [+totalPages+] </strong>
                <span class="ditto-pages"> [+previous+] [+pages+] [+next+]  </span>
                </p>
                


                The trouble seems to be that the previous, pages, and next bits are escaping the url so the search gets mucked up. You can see this happening at http://artisan.oxygenit.co.nz/house-plans.html (do a search then try to move through the results).

                Any way I can get around this?
                  • 11975
                  • 2,542 Posts
                  Hi,

                  it seems that there is a trouble with your link syntax


                  <a href=’/house-plans.html?textSearch=&amp;amp;Stories=1&amp;amp;FloorSize-0=&amp;amp;FloorSize-1=&amp;amp;search=Search&amp;amp;start=6’>Next &gt;</a>

                  Check out in the site config, if you have enabled the convert xhtml url setting.

                  :-)
                    Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
                    • 20054
                    • 21 Posts
                    Quote from: heliotrope at Nov 27, 2007, 02:17 AM


                    Check out in the site config, if you have enabled the convert xhtml url setting.

                    :-)

                    Yes, I do have xhtml set, as I like my sites to validate if possible. I would have thought it should handle this fine... Perhaps this is a bug? If you can point me to where [+pages+] etc come from, I might be able to fix...
                      • 11975
                      • 2,542 Posts
                      The pagination is made by Ditto.

                      You ’ll have to change the last line in buildUrl function in ditto.class.inc.php and in the debug.class.inc.php

                      replace it with return $url;

                      And let me knox if it’s ok

                      :-)
                        Made with MODx : [url=http://www.copadel.com]copadel, fruits et l