How to show a specific record within a search result?

9 posts by 5 authors in: Forums > CMS Builder
Last Post: June 17, 2009   (RSS)

By hk - March 6, 2009

I am creating a webpage with art.
The first page shows all pictures of an artist. Each Thumbnail picture links to another page showing a large image and I want to have a prev and a next button on this page too to scroll to all images of this artist.

My problem is - what will be the link string?
If I link : page2.php?num=6 - it will only show one picture number 6 and no prv and next buttons.
If I use : page2.php?artist=3 - it will show the first picture of the artist, but not specific number 6

Thanks

Helmut

Re: [hk] How to show a specific record within a search result?

By gkornbluth - March 9, 2009

Hi Helmut,

You might want to look into either lightbox, milkbox or Slide Show Pro for displaying your images. These will allow you the links that you're looking for and offer you a lot more flexibility in image display. They all integrate easily into CMS Builder.

You might find the explanations on these and other topics in my CMSB Cookbook helpful.

You can see an example of a milkbox implementation that I did for a photographer at http://www.elleschorrphotography.com


Best,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [hk] How to show a specific record within a search result?

By Dave - March 9, 2009

Hi Helmut,

Try some code like this. Note, change that tablename and fieldname to match yours:

list($prevRecord, $nextRecord) = getPrevAndNextRecords(array(
'tableName' => 'news',
'recordNum' => getNumberFromEndOfUrl(),
));


Then add this where you want your prev/next links to go:

<?php if (@$prevRecord): ?>
<a href="<?php echo $prevRecord['_link'] ?>"> &lt;&lt; <?php echo $prevRecord['title'] ?></a>
<?php endif; ?>

<?php if (@$nextRecord): ?>
<a href="<?php echo $nextRecord['_link'] ?>"><?php echo $nextRecord['title'] ?> &gt;&gt;</a>
<?php endif; ?>


Hope that helps, let me know if you have any questions or problems with this.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] How to show a specific record within a search result?

By avrom - June 16, 2009

Hi David,

I'm trying to do the exact same thing for a list record:
http://www.hydroglove.com/new/sizing_chart.php


<?php if ($sizing_chartMetaData['prevPage']): ?>
<div id="prevLink">
<a href="<?php echo $sizing_chartMetaData['prevPageLink'] ?>"><img src="images2/button_03.gif" width="28" height="45" /></a> <a href="<?php echo $sizing_chartMetaData['prevPageLink'] ?>">PREV</a>
</div>
<?php endif ?>

Instead of displaying the word PREV I want to display the actual size of the previous record:

<?php echo $record['size'] ?>

from

list($sizing_chartRecords, $sizing_chartMetaData) = getRecords(array(
'tableName' => 'sizing_chart',
'perPage' => '3',
));

Thanks Dave !
Avrom

Re: [ross] How to show a specific record within a search result?

By avrom - June 17, 2009

Hi Ross,

Yes its working fine, with a PREV and NEXT link. But I actually wanted to display the PREV and NEXT links with the actual SIZE value:

Instead of displaying the word PREV I want to display the actual size of the previous record:

<?php echo $record['size'] ?>

Cheers and Thanx
Avrom

Re: [virgodesign] How to show a specific record within a search result?

By Dave - June 17, 2009

Hi Avrom,

That one might be a little tricky. Can you attach your viewer page so we can see what you have now?

Thanks!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] How to show a specific record within a search result?

By avrom - June 17, 2009

Dave here it is:

http://www.hydroglove.com/new/sizing_chart.php

Cheers
Avrom

Re: [virgodesign] How to show a specific record within a search result?

By Dave - June 17, 2009

Hi Avrom,

Sorry, I meant could you attach the sizing_chart.php file to the post so we could see the source code?

Thanks!
Dave Edis - Senior Developer
interactivetools.com