Viewer Detail page with multiple category outputs and styles
4 posts by 3 authors in: Forums > CMS Builder
Last Post: April 29, 2010 (RSS)
By mark99 - April 27, 2010 - edited: April 27, 2010
Now I've also created several listing viewer pages, each with specific calls to a certain category option and different templates for the output of different fields. I select the category for each viewer file by this simple method (on the listing viewer page that is, obviously the detail viewer might have problems doing the same):
'where' => " category LIKE '%big_cats%' ",
Works fine, but I only have a single viewer detail page (as is my intention). Now I'd like to output several categories and related fields on to the detail.php page, each having their own unique fields and styles. Crucially I only want to output the data for categories that actually apply to any given record, so as to avoid confusing people with lots of blank fields for categories that might not apply to my product. If you see what I mean :). Anyway I have no idea how to do this.
It would be wonderful if my Detail page only showed data for related categories.
Re: [mark99] Viewer Detail page with multiple category outputs and styles
By ross - April 27, 2010
Thanks for posting!
Because you have several listing viewer pages, what I would do is just hardcode the link to your detail page on them.
On your big_cats view page, you can have something like:
<a href="big_cats_detail.php">
Now, you'll also need to have at least the record number in there as well so the detail page knows what record to load. That will make your link look like this:
<a href="big_cats_detail.php?<php echo $record['num'] ?>">
Of course, you might need to change the $record part. Now, one thing to keep in mind is that you can also add in other variables to that URL so it ends up being more descriptive. For instance, you could have the title of the record in there too like this:
<a href="big_cats_detail.php?<php echo $record['title'] ?> - <php echo $record['num'] ?>">
Just make sure to have the num field at the end.
Does that all make sense? Let me know what you think :).
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com
Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/
Re: [ross] Viewer Detail page with multiple category outputs and styles
By mark99 - April 29, 2010 - edited: April 29, 2010
Re: [mark99] Viewer Detail page with multiple category outputs and styles
By Jason - April 29, 2010
So you want to have a single detail page that outputs information for all of the different categories, but each category will output different fields. Is that right?
If so, you could have a different database select for each of your categories. For example:
list($bigCatsRecords,$bigCatsMetaData)=getRecords(array(
'tableName'= 'products',
'where'=> "category LIKE '%big_cats%'",
));
list($bigFrogsRecords,$bigFrogsMetaData)=getRecords(array(
'tableName'= 'products',
'where'=> "category LIKE '%big_frogs%'",
));
...etc
Then you would individually output each of those in a separate loop. Example:
<?php foreach ($bigCatsRecords as $record): ?>
*OUTPUT FOR BIG CATS*
<?php endforeach ?>
<?php foreach ($bigFrogsRecords as $record): ?>
*OUTPUT FOR BIG FROGS*
<?php endforeach ?>
...etc
Does that sound like what you're aiming for? Let me know.
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/