This project is read-only.

Customization

PortfolioEngine.Net allows you complete customization for your themes. You can modify everything from css to html and scripts.You can even have a different theme for each project if you want to.

License Stuff

The theme must contain a visible "Powered by PortfolioEngine.Net" (with its respective link) notice. You can use "ViewContext.Settings().PoweredBy" for that.

Anatomy of a theme

Cascade
Themes are considered in this order: request, project, portfolio,default. An user can change the theme at request time with the "theme" query parameter. If none is provided, it uses the projects's theme if set. If none is set, it defaults to the portfolio's theme and if that it isn't set, it uses the default theme defined in the application settings.

Directories
A theme uses the following directories
  • "~/Content/[theme_name]" - for storing the static resources: css, scripts, images.
  • "~/Views/[theme_name]" - for the theme's views. Nothing is shared between the themes.

Create Theme
To create a new theme the easiest way is to start from the default one. Just copy and rename the "default" directories from "~/Content" and "~/Views". You can then modify it as you wish.

Helpers

You will need the following helpers in a theme
  • "Url.ThemeResource" - to get the path of any static resource of the theme. Used mainly for css files and scripts.
  • "Url.ProjectScreenshotUrl" - returns the path to project's cover image or the default cover image if it isn't set one.
  • "Url.GetCurrentTheme" - returns the name of the active theme.
  • "ViewContext.CurrentProject()" - returns the active project object if available.
  • "ViewContext.Settings()" - returns the PE.Net web application settings.

When displaying project properties of type "TextItem", you need to use the Format() extension method helper, so that the correct language and format is used.
To get the path of a project resource (image, file) use the ResolvePath() extension method for the "ResourceLocation" object. If the path is local, it's returned relative to project root ("~/path").

Last edited Jan 17, 2011 at 2:45 PM by mike_sapiens, version 5

Comments

No comments yet.