...And Then My Brain Turned to Cheese!

3 posts by 2 authors in: Forums > CMS Builder
Last Post: April 11, 2011   (RSS)

By Perchpole - April 8, 2011

Hello, All

I haven't written in for a while so this little puzzler marks a fitting return to the fold.

There are 3 elements to consider:

1) Category pages

2) Panels

3) Boxes

Each element is nested inside the other. The boxes sit the panels which sit on the Category pages.

A panel can be assigned to any of the Category pages (via a multi-select menu called "categorySelector").

Multiple boxes can be assigned to each panel (each via a multi-select menu called "panelSelector").

Thus far I have the panels rendering on the right Category pages, using the following code:

list($panelRecords, $panelMetaData) = getRecords(array(
'tableName' => 'panel',
'where' => "categorySelector LIKE '%\t{$selectedCategory['num']}\t%'",
));


...which seems to work.


What I can't work out is how to filter the right boxes to appear on the panels.

I'm working with something like this...

$activePanels = array();

foreach($panelRecords as $panels){

if($panels['categorySelector'] == $selectedCategory['num']){
$activePanels[] = $panels;
}
}

list($boxesRecords, $boxestMetaData) = getRecords(array(
'tableName' => 'boxes',
'where' => " '%\t{panelSelector}\t%' IN ('%\t{$activePanels}\t%')",
));


It doesn't work. I'm sure I'm close but I can't quite nail it....

Help!

:0)

Perch

Re: [robin] ...And Then My Brain Turned to Cheese!

By Perchpole - April 11, 2011

Hi, Robin -

I feel another fondue moment coming on just looking at this!

Seriously, this is great. I really love ingenious stuff like this.

:0)

Perchpole