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

I've created a new section (big_animals) and in it I have a field called 'category' (contains a checkbox list of options like 'big_cats','big_frogs' etc.), among many others.

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

Hi there.

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

Yes but then that will only output the data for a single category when I want the Detail page to be a summary of all categories.