Search code examples
piranha-cms

Piranha CMS - Control hosted database content only?


I have just started using Piranha CMS with my existing MVC4 website. I have a database hosted in Azure and ideally I want Piranha to control just this i.e I don't want it to alter the pages etc.

Is this possible? I have set my databases connection string in the web.config on the Piranha key and have set passiveMode to true

So the reiterate I want Piranha to just update the data in the database, if this is possible how do I go about doing it?


Solution

  • Yes!

    If you set passivemode to true the entire routing for pages & posts will be disabled. The basic functionality for getting uploaded media files from the CMS will still be active.

    You will then have to manually get the CMS data from you controllers in you actions, for example:

    public class HomeController : Controller
    {
      public ActionResult Index() {
        //
        // Let's say you have a page with the permalink 'start'
        //
        var cmsData = Piranha.PageModel.GetByPermalink("start");
    
        return View(cmsData);
      }
    }
    

    Regards