Multiple Viewers On Same Page (need help)

5 posts by 2 authors in: Forums > CMS Builder
Last Post: March 6, 2008   (RSS)

Re: [rasbro] Multiple Viewers On Same Page (need help)

By Dave - March 5, 2008

It depends what kind of content you have. If you have a single record you want to display (such as from a single-page section) then method #2 would we the way. If you had a list of pages or records you wanted displayed then you'd want to use method #1.

Assuming you're using method #2, one thing you can do to avoid collisions is to rename some of the variables. For example, instead of using $record, you could rename those to $left_nav or something else.

If you're still getting errors, see if you can post an url to a test page with the errors and attach the viewer to your post and I can have a look at it for you.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Multiple Viewers On Same Page (need help)

By rasbro - March 6, 2008

Okay, so would I rename all references to $record parameter, like this:

In the viewer at the beginning of the document...

from, $record = getRecord($options);
to, $leftnav = getRecord($options);

And also in the body of the document...

from, <?php echo $record['leftnav_content'] ?>
to, <?php echo $leftnav['leftnav_content'] ?>

Is this true for the List Viewer parameters also?:

from, list($listRows, $listDetails) = getListRows($options);
to, list($anynameiwantRows, $anynameiwantDetails) = getListRows($options);

and...

from, <?php foreach ($listRows as $record): ?>
to, <?php foreach ($anynameiwantRows as $record): ?>

If this is the case then it certainly opens a lot of options for me. I had no idea these parameters such as $record or $listRows could be changed. Any other parameters or viewer attributes that can be changed like this? Sorry for all the questions - I'm getting excited at the possibilities!

Thanks,
Brian

Re: [rasbro] Multiple Viewers On Same Page (need help)

By Dave - March 6, 2008

Yes, that right. Those are just PHP variables so you can give them any name you want. Basically anything that starts with a dollar sign (like $this) you can try renaming.

Give a try and feel free to ask as many questions as you like. :)
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Multiple Viewers On Same Page (need help)

By rasbro - March 6, 2008

Okay Dave, that clarifies it a lot!

Thanks,
Brian