When I have this:
@using Orchard.Themes.Models
@using Orchard.Themes.Preview
@using Orchard.Themes.Services
@using Orchard.Themes.ViewModels
@{
Script.Require("OrchardTinyMceDeluxe");
var pluginsBaseUrl = @Url.Content("~/modules/tinymcedeluxe/scripts/plugins");
var siteThemeService = WorkContext.Resolve<ISiteThemeService>();
}
I get this error:
Parser Error Message: The code block is missing a closing “}” character. Make sure you have a matching “}” character for all the “{” characters within this block, and that none of the “}” characters are being interpreted as markup.
Line 4: @using Orchard.Themes.Services
Line 5: @using Orchard.Themes.ViewModels
Line 6: @{
Line 7: Script.Require("OrchardTinyMceDeluxe");
Line 8: var pluginsBaseUrl = @Url.Content("~/modules/tinymcedeluxe/scripts/plugins");
But if I break the code up into two separate C# blocks, as shown below, it works fine. Why?
@{
Script.Require("OrchardTinyMceDeluxe");
var pluginsBaseUrl = @Url.Content("~/modules/tinymcedeluxe/scripts/plugins");
}
@{
var siteThemeService = WorkContext.Resolve<ISiteThemeService>();
}
You shouldn’t use the @ on Url.Content, it’s already inside a code block.
What I think is happening is that razor is getting confused by the @ and the semicolon at the end, thus placing the close bracket into the HTML.