Show States if a record exists

15 posts by 2 authors in: Forums > CMS Builder
Last Post: February 16, 2015   (RSS)

By Mohaukla - February 7, 2015

Thanks Claire

Works awesome!

Michael Moyers



Owner of Just Rite Design Inc. A growing network of professionals in web design, graphic design, flash development, programming, and audio & video productions.



"Due to budget constraints, the Light at the end of the tunnel will be temporarily out!"

By Mohaukla - February 12, 2015

Ok Claire,

The client has added another filter to the mix. They have asked that there be just a list of "agricultural" or "recreational" dealers.

I created a new separate list "dealer_types"(multiple check boxes) and associated it in the dealers section using the field name "type".

What I BELIEVE I need is a "if" {  continue;  } statement to filter only 1 type of dealer by the record number. Or an "if" "else" statement maybe..

                            <?php foreach ($canadian_statesRecords as $key=>$record): ?>
                                       <? // load records from 'dealers'
                                         list($dealersRecords, $dealersMetaData) = getRecords(array(
                                         'tableName'   => 'dealers',
                                         'loadUploads' => false,
                                         'allowSearch' => false,
                                         'where' => "providences LIKE '%\t". mysql_escape($record['num']) . "\t%'",
                                          ));
                                        ?>
                            <?php if(empty($dealersRecords)) { continue; } ?>
                                <section class="toggle<?php if ($key == 0) { echo " active"; } ?>">
                                    <label><?php echo htmlencode($record['title']) ?></label>
                                    <div class="toggle-content">
                                    <?php foreach ($dealersRecords as $dealer): ?>
                                    <?php IF DEALER "TYPE" NUM = ANYTHING BUT "1" { continue; } ?> //  I will assign which record number I want to filter
                                    <div class="panel-body">
                                      <strong><?php echo htmlencode($dealer['title']) ?></strong><br/>
                                             <p>
                                              <?php echo htmlencode($dealer['address']) ?><br/>
                                              <?php echo htmlencode($dealer['phone']) ?><br/>
                                              Contact: <?php echo htmlencode($dealer['contact_name']) ?>
                                             </p>
                                         <hr>
                                     </div>
                                     <?php endforeach ?>
                                    </div>
                                </section>
                            <?php endforeach ?>

Let me know what you think,

Thanks
Michael

Michael Moyers



Owner of Just Rite Design Inc. A growing network of professionals in web design, graphic design, flash development, programming, and audio & video productions.



"Due to budget constraints, the Light at the end of the tunnel will be temporarily out!"

By claire - February 13, 2015

Yeah, that'd definitely work. Looks like you don't need my help in fact :P

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By Mohaukla - February 13, 2015

Oops sorry I do need your help to write the expression correctly.

I know I'm close but. ..

Thanks

Michael

Michael Moyers



Owner of Just Rite Design Inc. A growing network of professionals in web design, graphic design, flash development, programming, and audio & video productions.



"Due to budget constraints, the Light at the end of the tunnel will be temporarily out!"

By claire - February 16, 2015

Sure, here's how the line should look:

<?php if($dealer['num'] != 1 { continue; } ?> //  I will assign which record number I want to filter

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/