Prev/Next Links on List Page

8 posts by 2 authors in: Forums > CMS Builder
Last Post: January 5, 2011   (RSS)

By design9 - December 29, 2010 - edited: March 21, 2011

Hello,
I need some help in putting some prev/next record links on a list page. I have seen the posts that show this for a details page but that code doesn't seem to work for my list pages. I have it set to show the first 25 listings on the page and then I want to include the prev/next links to show additional listings. My information is set up using a multi-viewer that is called 'mag_locater'.

Thank you,

Re: [apdance9] Prev/Next Links on List Page

By Chris - December 29, 2010

Hi April,

The Code Generator can generate code for displaying prev/next links for you. Try this:

Log into CMS Builder and go to Admin > Code Generator. Select your mag_locater section and "List page". For the "How Many" option, choose "Show records per page with [15] prev & next page links".

You'll get a page of code with a "STEP3" section, which contains the code for displaying prev/next links. You can either modify the generated page to be your new list page, or copy that section into your existing page.

I hope this helps! Please let me know if you have any questions.
All the best,
Chris

Re: [apdance9] Prev/Next Links on List Page

By Chris - December 30, 2010

Hi April,

You'll need to add the perPage option to this getRecords call as well:

// get records
$addressRecords = array();
if ($myLat && $myLng) {
$maxDist = floatval(@$_REQUEST['maxDistance']);
list($mag_locaterRecords, $mag_locaterMetaData) = getRecords(array(
'tableName' => 'mag_locater',
'addSelectExpr' => geocoder_getSelectExprForDistance($myLat, $myLng, '_distance', $kmOrMiles), // adds '_distance' field to output records
'where' => geocoder_getWhereForDistanceWithin($myLat, $myLng, $maxDist, $kmOrMiles), // optimization: remove results outside of minimum bounding rectangle
'having' => "_distance <= " . $maxDist, // only show results within max distance
'orderBy' => 'ISNULL(_distance), _distance', // sort nearest records first -and- unknown or undefined distances last
'perPage' => 4,
));
}


I hope this helps! Please let me know if you have any questions.
All the best,
Chris

Re: [chris] Prev/Next Links on List Page

By design9 - January 3, 2011

Hi Chris,
Thanks so much...that did the trick. The only part that is not working now is the speech balloon in the google maps. I have the coding on the page to display the information in the balloon when you click on a pointer on map but it takes you straight to the details page without showing the speech balloon. Is there anything else that is missing that would cause this not to work on this page? The page source was attached above and here is the page:
http://www.piedmontparent.com/publications/findmagazine/distanceresults.php

Thanks!
April

Re: [apdance9] Prev/Next Links on List Page

By Chris - January 4, 2011

Hi April,

You'll need to add the "STEP4" code from sample_map_multi.php to your page to get infowindows (aka speech balloons) working:

<!-- STEP4: Map with multiple addresses: Set the popup window content, rename $myrecords if needed -->
<div id="marker_details" style="display: none;">
<?php foreach ($myRecords as $record): ?>

<?php // marker_infowindow_### is the content displayed in the info-window on click ?>
<div id="marker_infowindow_<?php echo $record['num']; ?>">
<h3><?php echo htmlspecialchars( @$record['address']); ?></h3>
Add any extra content you like here...<br/>
<a href="<?php echo $record['_link']; ?>">details</a>
</div>

<?php endforeach ?>
</div>
<!-- STEP4: Map with multiple addresses -->


You can add this anywhere in the <body/> of your page.

I hope this helps. Please let me know if you have any questions.
All the best,
Chris

Re: [chris] Prev/Next Links on List Page

By design9 - January 5, 2011

Chris,

I do have this coding already on my page and the [font "Verdana"]infowindows (aka speech balloons) still[/#000000] doesn't work.

Any other ideas of what could be wrong?

April

Re: [apdance9] Prev/Next Links on List Page

By Chris - January 5, 2011

Hi April,

Looking at your attached source code, I see that the <div id="marker_details"/> is inside of an <?php if (!$hasAddresses): ?>. You'll need to move it outside of that IF block, which is preventing it from being displayed when there are addresses to show.

You can check to make sure it's getting output by viewing source (through your browser) and searching for "marker_details".

I hope this helps. Please let me know if you have any questions.
All the best,
Chris