Detailed documentation about mapping a web templet

2019-09-06 06:23发布

I found a web template on the net link and I want to allow end-users to edit the website using CMS. I found Orchad CMS, which is based on ASP.Net MVC. But the problem I'm facing is that I didn't find the full documentation on how I can map a web template similar to the one I provide to be managed inside a CMS such as Orchard so that end-users (non-technical users) can add new images, change the home page message, add new projects, etc.

1条回答
等我变得足够好
2楼-- · 2019-09-06 07:05

This basically comes down to "writing a new theme" and implementing the functionality :).

The specific page you are referring to is fairly simple to implement in the Orchard which as a CMS, has extensive content definition and editing possibilities.

However you might want to try this first:

  1. Forget about the template/theme for a second
  2. Download and run Orchard in Visual Studio
  3. Try to build your functionality with the default theme
  4. Configure it so that other users (create a test user) can use it as you want (create new projects and change names/images).

To give you a head start for #3 (NO CODING REQUIRED):

  • Your functionality is a list of 'recent projects'
  • In Orchard, a 'recent project' can be implemented as a ContentType (of which users can 'create instances' also called ContentItem(s))

    One way of defining contenttypes is by using the admin interface behind "Content Definition". Make sure the module "Content Types" is enabled.

  • Your 'recent project' contenttype basically has two properties namely "name/title" and an "image". These can be implemented in several ways which I won't all mention, but the easiest way is by adding Fields to the contenttype definition (A TextField for the name/title and an ImageField for the image).

    tip: You can also implement the name/title by adding the TitlePart to the RecentProject contenttype instead of using a TextField. Parts are one of the concepts which make Orchard a very powerful CMS and this one is the easiest to understand. The result is more or less the same, you will get a way to add a title to the contentitem instances.

Up to this point you will basically be able to create "RecentProject" contentitems. You will now need to create a way to render your contentitems on the frontend. Again there are multiple ways of doing this. I'll continue on the path where you do not have to create any code.

  • Add a ContainablePart to your RecentProject contenttype.
  • Create a List named 'Recent projects' (optionally restrict the containable items to 'RecentProject' which should be listed after you add the containerpart to your contenttype

    A list also has the AutoroutePart attached which is the mechanism for proving a frontend url to display contentitems. By default a url is created based on your title to this would result in a page /recent-projects Make sure the Lists module is enabled

  • Read carefully: Do not create your RecentProject contentitems using the link in the upperleft of the admin ("New > RecentProject"), but go to your 'Recent projects' list which you just created. There is an option to create new items in that specific list which automatically hooks up the items to the list (this is all done using the ContainerPart).

At this point you can go to /recent-projects and see your Recent Projects list being displayed in Detail mode. The Detail display of a List basically renders each of its Contained items in Summary mode (and also a optional pager). Don't mind the way it looks right now. If you got everything up to here then you can start with the first link I mentioned about writing a new theme, but more importantly you should try to understand "Accessing and rendering shapes" and "Understanding placement info" both of which are used to manage those display modes like "Detail" and "Summary".

Enable the Shape Tracing module to help you with this. It is gold!

查看更多
登录 后发表回答