If single record go directly to Details Viewer

4 posts by 2 authors in: Forums > CMS Builder
Last Post: November 29, 2011   (RSS)

By fleff - November 28, 2011

The website in question has a section called "items". In it are records for several types of items. If a search for a particular type of item finds only one item for that type, my client wants to go directly to the details viewer for that item instead of going through the list viewer that would display only that one item. This is what I have put directly under the <body> tag:

<?php if ($itemsMetaData['totalRecords'] == 1): {
header("Location: /items_details.php");
exit;
}
?>
<?php endif ?>

That brings up the details viewer for the first record in the section, not the record we want. If I physically add the record number in the code, it works fine. My question is, how do I append the record number of the single item in the category requested? I tried the following:

<?php if ($itemsMetaData['totalRecords'] == 1): {
header("Location: /items_details.php?<?php echo $record['num'] ?>");
exit;
}
?>
<?php endif ?>

I get an error message. What should I have here to make it work?

Thanks,

Farnham

Re: [Jason] If single record go directly to Details Viewer

By fleff - November 28, 2011

Thanks, Jason, but I'm still getting the details viewer for the first record in the section rather than the record found in the search. I checked to see what record number is found and it's the correct one for the record I want, but apparently the code is not adding it to the URL for the details page.

Farnham

Re: [fleff] If single record go directly to Details Viewer

By Jason - November 29, 2011

Hi,

Could you attach the .php file you're working with along with a link to an example that demonstrates the problem? That way, I can take a closer look.

If you don't want to post this information in the forum, please email it to support@interactivetools.com

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

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