How do you load more data based on data retrieved from one listener

1 view
Skip to first unread message

Matthew

unread,
Oct 21, 2009, 2:11:12 AM10/21/09
to Mach-II for CFML
Hi all

I'm developing a content management system. I have a simple "panel
manger" which allows users to build simple panels made up of HTML
content and drop them in various positions on the template (float
right in content, show under content etc). Now I need to have quite
complex panels on pages and I'm trying to work out how to best build
this in a MVC pattern.

The current scenario is as follows: browser URL would be something
like index.cfm?event=cms&page=about-us.

The MachII "cms" event calls various listeners to pull in general page
content, SEO data, promotions etc. It also calls a PanelManger
listener which grabs all the panels related to the page and displays
them in sequence. The panels in the database obviously has a field to
store the HTML. I'm trying to work out the best way to accommodate
complex panels. These will vary enormously and entail things like
photo gallery previews, interactive booking components, FAQ drop down
list etc. So on the page load I obviously need all the data which will
drive each of these components. One idea I had was next to the HTML
field I could have a field called "machIISubRoutine". So in the MachII
"cms" event I could call a PanelManager plugin, loop through each
panel and run each sub routine to get the data. Then in the view as a
loop through the panels I'd have the data required to populate the
panels.

It's quite a complex concept to explain so hopefully I've got the idea
across. I guess the shortest way I can ask it is "How do you load more
data based on data retrieved from one listener?".

Feel free to ask more questions.

The only other possible solution I could think of was to create and
event for each panel and store the URL string in the database and load
the panels via an AJAX call. So the PanelManager would return either
HTML or a URL and if it finds a URL it would make and AJAX call to
build the panel.

Cheers
Matthew

Kurt Wiersma

unread,
Oct 21, 2009, 8:50:02 PM10/21/09
to mach-ii-for...@googlegroups.com
I think you on the right track with add in a subroutine call based on
the data you get back and dynamically building up the data and the
view. You could also consider announcing a different event based on
what you get back.

--Kurt

Matthew

unread,
Oct 21, 2009, 9:37:10 PM10/21/09
to Mach-II for CFML
Thanks for the reassurance Kurt. I just can't think of any other way
to do it. My concern with this solution is am I building too much
business type logic into the MachII controller (and possibly breaking
the rule of integrating/relying in MachII too much). If I bring it
back to an MVC level the process would be: Controller calls Model to
get data, Controller loops through some Model data and calls more
Model data, View is called and builds the page based on original Model
data then at one point on the page loops through some data builds
panels based on the extra data. Anyone got any thoughts?

Cheers
Matthew

On Oct 22, 11:50 am, Kurt Wiersma <kwier...@gmail.com> wrote:
> I think you on the right track with add in a subroutine call based on
> the data you get back and dynamically building up the data and the
> view. You could also consider announcing a different event based on
> what you get back.
>
> --Kurt
>
Reply all
Reply to author
Forward
0 new messages