This project is read-only.

Dynamic content pages with editable title and content

Topics: Writing modules
Jun 26, 2011 at 2:30 PM

Hi, I have built an page where you can view the details of a person. The problem is that data of the person comes from an external database but i want to have an title and description who's editable in de Orchard CMS.

What's the best way to go to make this possible? (I don't want to make an page per person in the cms)

Jun 27, 2011 at 11:38 AM

The easiest way to get an editor UI is to leverage the CMS by creating a custom content type. This effectively means having a page person; but why do work yourself when the framework can do it for you?

Then have a background task that will scan the external database and create new content items based on that data.

Or if that really isn't the way you want to go, you'll need to build your own controller to manage the various views involved in displaying the data and UI. Have a look at any MVC tutorials and also the documentation to see how this works.

Jun 27, 2011 at 7:00 PM
Edited Jun 27, 2011 at 7:54 PM

Ok thanks for the quick answer! I really like the support by the Orchard community! That's 1 of the main reasons i stay with Orchard.

Back to topic:

Yes i do want to split the CMS,my data & business logic because i don't know what the future brings. For example: I don't know how long microsoft is gonna support the Orchard cms and i find this a risk my project. (Don't get me wrong i really like Orchard cms). For smaller websites i find it no problem.

If i manage to get it working this way i get a nice separation.But i do want to edit my description, title etc in the CMS though.

I've managed to get it working but probably not in the nicest way:

In my controller I retrieve the external data combine it with the data of a Content page i created. I simply retrieve the first content page of my custom content page part type. I've also manually created a edit link so i can still edit the custom content page.

Is this the best way i can achieve this while using external data?



Jun 27, 2011 at 8:40 PM

It sounds like in order to avoid dependence on Orchard, you're actually introducing strange Orchard-specific hacks, and basically creating extra work for yourself.

The best way to create a UI is with a controller and a view; then you're completely MVC compatible and only using Orchard for its theming system.

Jun 28, 2011 at 5:34 PM

Ok thought it over and you actually convinced me not to split the Data layer and Orchard. I reconsidered this because i think it will be to messy the way i wanted to implement this. so thanks for the info!