Parent, sibling viewer.

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

By rconring - August 10, 2009

Problem:
I have a page with 4 columns to display groups of links. I have 2 tables
web_categories - Contains group name, display column (1,2,3,or 4) in order to be able to group by column and sorted by globalSortOrder within column viewer.
--web_links - Contains group (num, from group list), display text, rollover text, URL, target frame ...etc in order to construct links to external and internal URLs and be sorted within the group using globalSortOrder.

I have it working now using only one file (web_links as categories) and a viewer for each column. Works fine except I do
not have the ability to quickly move an entire group to another column. Using 2 files, I can simply change the column number in the parent file and the siblings will follow.

My problem is that I don't quite know enough PHP to create the viewers to read from the parent and display the group
name, then display the group of siblings.

Any advice would be appreciated.
Ron Conring
Conring Automation Services
----------------------------------------
Software for Business and Industry Since 1987

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