We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24531
    • 213 Posts
    First of all, thanks for this extremely flexible and multi-purpose solution (i mean Ditto snippet).

    I think i found a bug.

    Here’s my ditto call
    [[Ditto? &parents=`3` &display=`5` &tpl=`ditto.news` &id=`news` &debug=`0` &paginateSplitterCharacter=`|` &language=`russian-UTF8` &dateFormat=`%d-%m-%Y` &extenders=`request,dateFilter,cwhere`&dateSource=`pub_date` &paginate=`1` &orderBy=`pub_date DESC` &where=`[+phx:ss+]`]]
    


    called on uncached page my phx:ss is

    <?php
    if (!empty($_POST['searchString'])):
    $ss = $_POST['searchString'];
    return "content like '%".$ss."%' or pagetitle like '%".$ss. "%' ";
    endif;
    ?>

    which is basically gets searchString var from $_POST and builds custom where clause. Anyway, here’s the issue:

    (3) News
    - (4) child with keyword we search
    - (5) child
    - etc

    (79) - Some page that has keyword

    so i type "keyword" and Ditto returns results with id 4, and 79 which is not child of resource id #3. What should i do to fix this?
      • 24531
      • 213 Posts
      and if i add &fiter=`parent,3,1` in where clause i get:
        Error: 	array_merge() [function.array-merge]: Argument #2 is not an array	 
        Error type/ Nr.: 	Warning - 2	 
        File: 	/home/meridian/new.meridiancapital.ru/docs/assets/snippets/ditto/classes/ditto.class.inc.php	 
        Line: 	948	 
        Line 948 source: 	$resourceArray[$x] = array_merge($resource,$this->prefetch["resource"][$x]); 
      
        • 24531
        • 213 Posts
        i’ve noticed that if i put &where=`pagetitle like ’%keyword%’ or content like ’%keyword%’` in snippet call, everything works fine.

        i’ve managed to solve the problem by inserting some phx logic to ditto template but it seems kinda freaky and not right.