Parent, sibling viewer.

4 posts by 2 authors in: Forums > CMS Builder
Last Post: August 12, 2009   (RSS)

Re: [rconring] Parent, sibling viewer.

By Chris - August 11, 2009

Hi rconring,

I'm having trouble figuring out exactly what you want to accomplish. Can you post any examples of what you have and/or want?
All the best,
Chris

Re: [chris] Parent, sibling viewer.

By rconring - August 11, 2009

Here is a quickie page of how it renders using only one category table http://stmarysonline.org/webdir/
Each record in the table has a column number and there are 4 viewers, one for each column.
There are 4 columns with a viewer for each column, $list1Records - $list4Records

list($list1Records, $menu_categoriesMetaData) = getRecords(array(
'tableName' => 'menu_categories',
'where' => 'colnum = "1"',
));

This displays the records for the first column ... other columns are from $list2,3,4 and creates a group header cell when a top level parent record is encountered otherwise, creates a hyperlink cell.
<?php foreach ($list1Records as $record): ?>
<?php if ($record['parentNum'] == '0'): ?>
<tr>
<td width="100%" class="headercell">
<b><?php echo $record['name'] ?></b>
</td>
</tr>
<?php else: ?>
<tr>
<td width="100%" class="linkcell">&nbsp;
<a title= "<?php echo $record['screen_tip'] ?>" target="<?php echo $record['new_window'] ?>" href="<?php echo $record['link_url'] ?>" style="text-decoration: none"><?php echo $record['name'] ?></a><br/>
</td>
</tr>
<?php endif ?>
<?php endforeach; ?>
I can move groups up and down within a column, but in order to move an entire group to another column, You have to edit the column number in each record of the group.
If I used two tables, the parent containing the group category name and column number .. the second containing the chidren of the group related only to the group and not the column, then one would only need to change the column number in the parent record to move the entire group.
I just need to loop thru the categories for a column, print the header record, then loop thru the children and print the links.
I hope this is a little clearer.
Ron Conring
Conring Automation Services
----------------------------------------
Software for Business and Industry Since 1987

Re: [rconring] Parent, sibling viewer.

By rconring - August 12, 2009

Never mind ... I found the answer on page 35 of Jerry Kornbluth's CMS COOKBOOK.
The solution is nested getRecord lists. Place the primary list in the header and the secondary list within the foreach loop in the body. Therefore, the column placement is controled solely by the primary table.

Thanks Jerry!
Ron Conring
Conring Automation Services
----------------------------------------
Software for Business and Industry Since 1987