ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

weblog filtering doesn't works how it supposed to be? (logic sense)

November 03, 2008 5:43am

Subscribe [3]
  • #1 / Nov 03, 2008 5:43am

    orezz

    43 posts

    I’m using search:city=“aalter|antwerpen” and category=“Sociaal Recht”

    Now I know, I only have 1 entry from “Aalter” that is attached to my category “Sociaal Recht”

    But my results it shows :

    Every entry that contains “Aalter”
    Every entry that contains “Antwerpen”
    Every entry that is in the “Sociaal Recht” category

    For me this is pretty unlogical??

    What I expect from this, that I only get the office in “Aalter” from the Category “Sociaal Recht” no?

    In any way, where should I alter the source code to change OR to AND ?

  • #2 / Nov 03, 2008 7:16pm

    Sue Crocker

    26054 posts

    orezz, one thing to note about your category=“Sociaal Recht” - category should be a the number for the category instead.

    I don’t believe you can do an OR there. But please give it a try with the proper category id specified.

  • #3 / Nov 04, 2008 6:13am

    orezz

    43 posts

    it was an category id sue. But the weird thing is. I need to puyt my category & entry_id before the search:field parameters. And like that it orders just fine!
    If I put my search: first, then my category & entry_id additions act like an OR

  • #4 / Nov 04, 2008 12:22pm

    Robin Sowell

    13255 posts

    Glad you got it working, but it seems very odd.

    Do you mind pasting the opening tag- both ways?  I want to experiment a bit on my install.  And- it definitely works differently depending on how you order the parameters?  Also- what build/version are you running?  It should be in the footer of the control panel.

  • #5 / Nov 05, 2008 9:21am

    orezz

    43 posts

    PHP:

    <?php
    global $IN, $DB;
    
    $title = $IN->GBL('keywords', 'POST');
    $speciality = $IN->GBL('specialisaties', 'POST');
    $city = $IN->GBL('city', 'POST');
    
    $query = $DB->query("SELECT entry_id FROM exp_weblog_titles WHERE weblog_id='6' AND title LIKE '%".$title."%'");
    
    if($query->num_rows > 0) {
        $id_array = array();
    
        foreach($query->result as $row) {
            $id_array[] = $row['entry_id'];
        }
    
        $entry_id_list = implode('|', $id_array);
        $search_title = 'entry_id="'.$entry_id_list.'"';
    } else {
        $search_title ='entry_id="nothing"';
    }
    
    $punctuation = array(",","-",".",";","/","\\","+","=","(",")","_","$");
    $city = str_replace($punctuation, "", $city);
    $city_array = explode(" ", $city);
    $city_list = implode('|', $city_array);
    $search_city = 'search:city="'.$city_list.'"';
    
    if(!$speciality=="") {
    $search_speciality = 'category="'.$speciality."'";
    } else {
    $search_speciality = 'disable="categories"';
    }
    ?>

    EE:

    {exp:weblog:entries weblog="{my_weblog}" group_id="10|11" status="specialist" <?php echo $search_speciality; ?> <?php echo $search_title; ?> <?php echo $search_city; ?>  }
    <div class="specialist">
        <h2>
            <a href="http://{url_title_path=%22title=%22Bekijk" title="Bekijk advocatenkantoor {title}">{title}</a>
        </h2>
    <p>{if logo != ""}<br />
    {my_path}{logo}{file_thumb_name}{/logo}<br />
    {/if}<br />
    <ul><br />
    <li>{street}</li><br />
    <li>{zipcode} <span><a href="http://{path=">{city}</a></span></li><br />
    <li><a href="http://{path=">{province}</a></li><br />
    </ul><br />
    </div><br />
    {/exp:weblog:entries}

    Both are in the same template 😊

    I’m running 1.6.5, the latest build

  • #6 / Nov 05, 2008 8:57pm

    Greg Aker

    6022 posts

    interesting work orezz.  So everything is working as you want it to now?

    -greg

  • #7 / Nov 12, 2008 5:31am

    orezz

    43 posts

    interesting work orezz.  So everything is working as you want it to now?

    -greg

    everything is working fine yeh 😉

    I sat together with the client, seems I’ll need to make it a lil’ bit more advanced. But we’ll handle. I’ll keep u posted;)

  • #8 / Nov 12, 2008 11:10am

    Ingmar

    29245 posts

    Glad to hear it. If you need anything else, you know where to find us 😊

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases