How to include 2 multi record lists from same table

7 posts by 2 authors in: Forums > CMS Builder
Last Post: November 2, 2009   (RSS)

By (Deleted User) - October 27, 2009

You may say it's easy to include two lists on a page from a multi record - simple you just include the echo code twice right? Wrong, let me explain.

I have a main page that includes a list of multi records from tableName guided_tour - they are limited to displaying only 2 at a time using the perPage of 2.

I would also like to include a list in the footer and limit this to say 4. It's easy to do if the footer is on a page that doesn't already contain the guided_tour tableName but how can I do it if it does??

Thanks Jonathan

Re: [jonoc73] How to include 2 multi record lists from same table

By ross - October 28, 2009

Hi Johnathan

Thanks for posting!

Once you know how to do this, it does end up being pretty easy :). It's just a matter of learning how :). Here's what I would do.

To get your first list going, you'll have the usual code at the top of the page like this:

list($guided_tourRecords, $guided_tourMetaData) = getRecords(array(
'tableName' => 'guided_tour',
'perPage' => 2,
));


What you can do is make a second copy of that but change the names slightly so you have something like this:

list($guided_tourFooterRecords, $guided_tourFooterMetaData) = getRecords(array(
'tableName' => 'guided_tour',
'perPage' => 4,
));


See what I did there. Just added "footer" into the variable name and now you have a whole separate list pulling from the same table but with different options. Just use that new variable name in the foreach loop you setup in the footer.

Does that 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] How to include 2 multi record lists from same table

By (Deleted User) - October 28, 2009

Ross,

This is great. Yes as soon as you explain, it all makes sense - I will understand it all one day no doubt! Oh and it works just fine!

Thanks Jono.

Re: [jonoc73] How to include 2 multi record lists from same table

By ross - November 2, 2009

Hi.

Interesting. You should be able to have the header code in the include so that it's always just the one file.

Could you attach a copy of one of your pages as well as the footer include to a reply so I can see how it's setup?

Thanks!
-----------------------------------------------------------
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] How to include 2 multi record lists from same table

By (Deleted User) - November 2, 2009

Hi Ross, I have updated the page to have this include in the footer. Details are in the email I sent to you on the 30th Oct.

Thanks Jono

Re: [jonoc73] How to include 2 multi record lists from same table

By ross - November 2, 2009

Hi there.

Whoops. I didn't realize this was all the same thing :). I'll be going through my email as quick as possible and get back to you with some ideas :).

Thanks!
-----------------------------------------------------------
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/