Hey,
i have asked this before but am pretty desperate now to work this out.
Basically, i want to allow multiple views to run of a single Module section.
The Module instance has a large domain Model and i want to leverage this with many views (User Controls) that are placed on variosu page nodes.
Mayeb i am missign something obvios, as the only way i currently can see it working is to crate a Module per view, and then somehow tell it which section has the Module with the Data Module or something.
Can anyone think of a way of getting htis done using the current Cuyahoga code??
I think this is a common problem people hit.
ged
Hi Ged,
Basically you need to create a module setting which is a custom type and points to an enum defined in your module for the display type. This will then tell your section which control to point at.
something like this:
public override void ReadSectionSettings() {
base.ReadSectionSettings();
if (base.Section.Settings["DISPLAY_MODE"] != null) {
_displayMode = base.Section.Settings["DISPLAY_MODE"].ToString();
}
}
protected string GetViewBase() {
return DefaultViewControlPath.Substring(0, DefaultViewControlPath.LastIndexOf("/") + 1);
}
public override string CurrentViewControlPath {
get {
if (!string.IsNullOrEmpty(_displayMode) && base.CurrentViewControlPath == DefaultViewControlPath) {
return GetViewBase() + _displayMode + ".ascx";
} else {
return base.CurrentViewControlPath;
}
}
}
public enum DisplayMode {
BasketView = 0,
BasketSummary,
CatNav,
ProductInfo,
OrderHistory,
Navigation,
Checkout,
SubGroupLinks
}
You get the Idea.
Lee
Hey Lee,
Yes i get the idea of using a Module setting to tell the section that is an instance of that module which User Control to show at runtime. Right?
But what I also need is to have the various views on different pages, all pointign back to the same Section. They are not in the same section at all.
Have i missed something and the example you gave allows this to happen???
Ok, I am not sure why you would want to do that, but the only way to do this is to have another section setting called "parentSectionID" (bit of a bodge) and adapt your data access stuff to access that sections data.
Out of curiosity why do they need to point to the same section? Maybe I can help further if I understand why you want to do it.
Lee
Here what i am doing.
i am building a site with a large domain model. i want this domain Module to be completely inside a single module.
i can break it down into smaller Modules too, but i am not sure where the doman model splits would be yet.
Then for the all the UI, i want to be able to spread the User Controls onto various page node sections. Maybe 2 or 3 User Controls per Module.
So, as you can see i am having to decide the architectural approach of doing this with Cuyahoga.
Does this make sense now?
If you want to discuss further skype: gedw99.
Gerard
Perhaps you should not even worry about what section the module is installed on. As long as you are going to only have one installation of this module per cuyahoga installation.
I assume all your data will be various new tables, but they don't HAVE to be linked to a section, that is just the ideal.
Alternatively what I suggested in my last post would theoretically work as I have have done it for a article system. You would have summary articles on the front page that were linked via the section setting to the 'master' section.
gedw99i am building a site with a large domain model. i want this domain Module to be completely inside a single module.
i can break it down into smaller Modules too, but i am not sure where the doman model splits would be yet.
This is what I do in such cases: put the domain model in a single class library and create separate modules with that contain the views.
To register the mappings of the domain model, just add the class library with the domain model to the NHibernate facility. This works out pretty well in my experience.