Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Themes support in MVC4

MVC4 has a folder called Content/themes/ Is the expectation, to create any new theme under that folder? Is the default theme of MVC4 called BASE becaus there is a folder under Content/themes/ called the same.

like image 506
wonderful world Avatar asked Apr 05 '13 15:04

wonderful world


3 Answers

The "Themes" folder in MVC is just a feature of jQuery UI and is not an MVC-specific feature. MVC itself does not have any actual "theme" support.

You can find additional themes as NuGet packages from the NuGet feed: http://nuget.org/packages?q=Tags%3A%22jQueryUI%22+themes

like image 69
Eilon Avatar answered Nov 05 '22 09:11

Eilon


There is something like what you wish to do in the project MVC.Forum They've created a folder named ~/Themes and View Engine ForumViewEngine which searches the views in that folder. Substituting the default View Engine like so:

protected void Application_Start()
    {
...
        // Set the view engine
        ViewEngines.Engines.Clear();
        ViewEngines.Engines.Add(new ForumViewEngine(defaultTheme));
...
}

Where the defaultTheme is a name of a subfolder of ~/Themes, that contains the views for the specific theme.

like image 44
gyosifov Avatar answered Nov 05 '22 09:11

gyosifov


MVC4 has a folder called Content/themes/ Is the expectation, to create any new theme under that folder?

Not really. By default, jquery UI is included in an MVC project, if you use one of the provided templates. The base folder contains the images and styles needed by the different jQuery UI widgets, the accordion being one of them. So if you use any of those widgets you don't need to download the css and script files needed. You can see those files being referenced in the BundleConfig.cs file under the App_Start folder. This same link that is included in that file explains what it is and what it does.

If you are thinking about how Themes in webforms are done in MVC, you can use layout pages and css files to define different themes for different situations/scenarios for your website.

like image 1
von v. Avatar answered Nov 05 '22 11:11

von v.