• Resolved iHanky

    (@ihanky)


    Goodmorning,

    Almost there, but not all the way!
    This page: http://www.larmit.nl/caresse/index.php/dealers/aenc-slapen/
    shows a page which I build with a list-template.
    I put [pdb_list template="single" filter="my_id=23" limit="1"] on a page and this the result.
    Unfortunately the record is repeated times the number of records there are in the database. Is there a way to stop this loop?

    I think I have to look for the answer here:

    <?php if ( $record_count > 0 ) : // print only if there are records to show ?>
    <div style="min-height:390px;" >
    <?php while ( $this->have_records() ) : $this->the_record(); // each record is one row ?>
    <?php while( $this->have_fields() ) : $this->the_field(); // each field is one cell ?>

    I’m building the site this way so my url looks ok and I can add some seo-stuff to every single page.

    Tnx again!

    http://wordpress.org/extend/plugins/participants-database/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter iHanky

    (@ihanky)

    This is the link:
    http://www.larmit.nl/caresse/index.php/dealers/aenc-slapen

    This is the template-code:

    <?php
    /*
     *
     * template for participants list shortcode output
     *
     * this is the default template which formats the list of records as a table
     * using shortcut functions to display the componenets
     *
     * If you need more control over the display, look at the detailed template
     * (pdb-list-detailed.php) for an example of how this can be done
     *
     * Please note that if you have more than one list on a page, searching, sorting
     * and pagination will not work correctly.
     *
    */
    ?>
    <div class="wrap <?php echo $this->wrap_class ?>">
    <a name="<?php echo $this->list_anchor ?>" id="<?php echo $this->list_anchor ?>"></a>
    <?php
      /*
       * SEARCH/SORT FORM
       *
       * the search/sort form is only presented when enabled in the shortcode.
       *
       */
      $this->show_search_sort_form()
    
      /* LIST DISPLAY */
    ?>
      <?php /*
       * IMPORTANT: the list container must have an id="pdb-list" in order for the
    	 * AJAX-enabled search to work.
       */ ?>
    
        <?php // print the count if enabled in the shortcode
    		if ( $display_count ) : ?>
        <caption>
          Total Records Found: <?php echo $record_count ?>, showing <?php echo $records_per_page ?> per page
        </caption>
        <?php endif ?>
    
        <?php if ( $record_count > 0 ) : // print only if there are records to show ?>
    
    <div style="min-height:390px;" >
    
          <?php while ( $this->have_records() ) : $this->the_record(); // each record is one row ?>
              <?php while( $this->have_fields() ) : $this->the_field(); // each field is one cell ?>
    
    		<h1>Caresse <?php echo $this->record->fields['dealer_type']->value ?> dealer</h1>
    		<h1><?php echo $this->record->fields['bedrijfsnaam']->value ?></h1>
    		<?php echo $this->record->fields['address']->value ?><br />
    		<?php echo $this->record->fields['zip']->value ?> <?php echo $this->record->fields['city']->value ?><br />
    		tel. <?php echo $this->record->fields['phone']->value ?><br />
    		fax <?php echo $this->record->fields['fax']->value ?><br />
    		<a href='mailto:<?php echo $this->record->fields['email']->value ?>'><?php echo $this->record->fields['email']->value ?><br />
    		<a href='http://<?php echo $this->record->fields['website']->value ?>' target='_blanc'><?php echo $this->record->fields['website']->value ?></a><br /><br />
    
    <table width="200" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td colspan="2"><strong>Openingstijden</strong></td>
      </tr>
      <tr>
        <td width="80">maandag:</td>
        <td width="120"><?php echo $this->record->fields['maandag']->value ?> uur</td>
      </tr>
      <tr>
        <td>dinsdag:</td>
        <td><?php echo $this->record->fields['dinsdag']->value ?> uur</td>
      </tr>
      <tr>
        <td>woensdag: </td>
        <td><?php echo $this->record->fields['woensdag']->value ?> uur</td>
      </tr>
      <tr>
        <td>donderdag:</td>
        <td><?php echo $this->record->fields['donderdag']->value ?> uur</td>
      </tr>
      <tr>
        <td>vrijdag:</td>
        <td><?php echo $this->record->fields['vrijdag']->value ?> uur</td>
      </tr>
      <tr>
        <td>zaterdag:</td>
        <td><?php echo $this->record->fields['zaterdag']->value ?> uur</td>
      </tr>
    </table><br />
    <strong>Koopavond: </strong><?php echo $this->record->fields['koopavond']->value ?>
    </div><div>
    <hr /><br />
    <h4><?php echo $this->record->fields['kopregel_bedrijf']->value ?></h4><br />
    <p><?php echo $this->record->fields['tekst_bedrijf']->value ?></p><br />
    <a href="http://www.caresseboxsprings.nl/wp-content/uploads/showroom-6506basis.jpg"><img class="alignleft eerste wp-image-3216" title="Caresse boxsprings & more, AenC Slapen, Geleen" src="http://www.caresseboxsprings.nl/wp-content/uploads/showroom-6506basis-857x536.jpg" alt="" width="416" height="260" /></a><a href="http://www.caresseboxsprings.nl/wp-content/uploads/showroom-6508basis.jpg"><img src="http://www.caresseboxsprings.nl/wp-content/uploads/showroom-6508basis-857x536.jpg" alt="" title="Caresse boxsprings & more, AenC Slapen, Geleen" width="416" height="260" class="alignleft laatste wp-image-3217" /></a><br />
    <hr /><br />
    <h4><?php echo $this->record->fields['kopregel_plaats']->value ?></h4><br />
    <p><?php echo $this->record->fields['tekst_plaats']->value ?></p><br />
    
    <div class="aiframe"><iframe src="<?php echo $this->record->fields['googlemap']->value ?>&iwloc=near" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="590" height="300"></iframe></div>
    <div id="biframe" style="text-align: right;"><a style="color: #666; top: -25px; text-align: right;" href="<?php echo $this->record->fields['googlelink']->value ?> target="_blanc">Grotere kaart weergeven</a></div>
    
    <p><a title="Dealers" href="http://www.caresseboxsprings.nl/index.php/dealers/"><strong>Dealeroverzicht</strong> →</a></p>
            <?php endwhile; // each field ?>
          <?php endwhile; // each record ?>
    
        <?php endif; // $record_count > 0 ?>
    
      <?php
      /*
       * this shortcut function presents a pagination control with default layout
       */
      $this->show_pagination_control();
      ?>
    </div>
    </div>

    Plugin Author xnau webdesign

    (@xnau)

    OK, well if you are going to explicitly show each field, you don’t need the “field” loop. Remove the line that starts the field loop: <?php while( $this->have_fields() ) : $this->the_field(); // each field is one cell ?> and also the loop closing line down below <?php endwhile; // each field ?>

    Also, in the shortcode the correct attribute name is “list_limit”: [pdb_list list_limit=1]

    Thread Starter iHanky

    (@ihanky)

    Thanks! Works like a charm.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Stop the loop in the list’ is closed to new replies.