Search code examples
piranha-cms

Piranha showing my current webpages in the CMS


I have a project I have attached Piranha CMS too. That bit worked fine.... However the pages I have already created and the template are not displaying in the CMS edit.

Steps I have done.

  1. imported Piranha from guget.
  2. Altered webconfig to passive.
  3. removed piranha connection section.
  4. changed connection to forms.
  5. Alter connection string to match sql-server DB.
  6. altered the global.config
  7. built DB in sql server
  8. Built project setup admin and the DB structure built followed.

Like I said it has built ok... But only the standard template. I'm guessing I've ether missed a step or there are steps to go. Can you advise me were to go next?

The webpage site currently just a home page.. The remaining pages are not completed. But if I don't crack this point there is little point continuing.


Solution

  • I think you have to add the pages into Piranha through the manager interface, then use the Permalink as the argument to fetch the Piranha managed content from Piranha. I don't think Piranha will parse your view/controller/routes and automatically import them into the site definition.

    I use Piranha in my views like this;

    @Html.ActionLink((string)Model.CMSData.Properties.WebSiteTitle, "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
    

    I embed the CMS data into my model based on the examples in the Getting Started section;

    public object CMSData = Piranha.Models.PageModel.GetByPermalink("my-permalink") ; 
    

    This enables me to weave in CMS content to my Model and then use it inside my View.