I can't find a layout file in settings page of Umbraco version8 but it can normal display in website - umbraco

I have trouble when I deal with a case that made by former colleague.
He made a home.cshtml and layout just only write one line:
#{ Layout = "master.cshtml"; }
I click any tree list in settings page but still can't find any file named master.cshtml!
But header is normal display of the webpage.
I really really so confused...
I check the file in visual code, I really sure the master.cshtml is header of home.cshtml, but in the Umbraco online,I just can't find the Mysterious File!
Where is it going!?
I need find the file to change text...
I try to search keyword like :Umbraco layout but can't find right answer for me... if you know what happen and what is the answer, please tell me, I can't thank you enough!

Every project is individual. But commonly developers store layout pages in the "Partial" folder.

The Layout/Master.cshtml file might not be created through Umbraco, but might be created through e.g. Visual Studio or Visual Studio Code, meaning Umbraco isn't aware that it exists.
To edit it, you would then have to edit the file directly through FTP, using an editor such as Visual Studio Code or similar.

Related

what does the model.generated.cs file do in Umbraco?

Exploring Umbraco 8 and playing around building a test site etc.
Building document types and content pages via the back office interface, and looking in the code itself I've noticed a files called models.generated.cs.
looking inside, it contains partial classes like public partial class AndyTestPage : PublishedContentModel { } and properties I've given it like
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder", "8.5.5")]
[ImplementPropertyType("andyProperty1")]
public string AndyProperty1 => this.Value<string>("andyProperty1");
my question is, what exactly is the point of this file? what does is do and how are these properties and classes created in here via the backoffice cms.
second question is, how would I go about creating a document type, and properties from code? my noob assumption is to simply add the classes in the this file, but that doesnt seem right?
Thanks,
Andy
It belongs to modelbuilder.
It depends on how you build your umbraco solution. If you use visual studio you can use something called strongly type, it helps building templates with VS.
By default, modelsbuilder is set to "PureLive", which is for users who builds within the umbraco backoffice system.
You can set modelsbuilder to different options, depending on how you build.
You should not edit the file, it is created and maintained by the system.
https://umbraco.tv/videos/umbraco-v7/implementor/working-with-umbraco-data/working-with-models-builder/
https://our.umbraco.com/documentation/reference/templating/modelsbuilder/
elitenet.dk has answered the first question
With regards to your second question Umbraco is database/content first so unfortunately you cant write documenttypes etc. from code first... not that i know of.
I beleive this is because Umbraco was designed to be used by almost anyone with a little html/css knowledge. E.g. You can create templates and views from the cms without having to know anything about serverside development.
Just a little tip if youre starting with Umbraco and plan on using multiple environments take a look at Kevin Jumps Usync package, essentually the package allows for document types/properties etc. to be pushed from environment to environment.Usync

MVC Tag helpers not working

I have an issue with tag helpers.
All I want to do is create a form that posts data to the controller - basic enough I thought but it doesnt work in my project.
I create a brand new asp.net core web application with default setup and it works there but my project refuses to recognise the tags and act accordingly.
Notably the markup doesnt highlight the same or provide info when hovered over so some ref or something fundamental is missing, can anyone advise.
*Default project working with correct highlights
*My project - not highlighting the code right or working.
Project.json is the exact same so I have no idea whats missing.
FOUND IT!
Microsoft like to change things. So, MVC 6 (asp.net core ...etc) can make use of a _ViewImports.cshtml file in the views folder (feel free to add it yourself if you like me made a project before this existed).
This acts like global import file, and to make the tag helpers available in all your views, you need to add reference here.
Mine now looks like this:
#using Mobile.Models
#addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
And boom - tags look correct and its work as expected.
You will also face this issue when you create a new Area in the asp.net core MVC project, to resolve it copy ~/Views/_ViewImports.cshtml to ~/AreaName/Views/_ViewImports.cshtml
Make sure that you MUST specify the assembly name and not the namespace.
That was my mistake.

Web API Help Pages not loading documentation XML

I'm trying to set up the ASP.NET Help Pages to run in an existing MVC project, though pointing towards the documentation file from a Web API project in the same solution. Convention has the Help Pages running inside the Web API that it's documenting but in this case I want it in a sibling MVC project.
The Web API project outputs its documentation XML file in a folder within the MVC project.
I've installed the Microsoft.AspNet.WebApi.HelpPage NuGet package in the MVC project. This creates a class \Areas\HelpPage\App_Start\HelpPageConfig.cs, and within this class's Register method I've passed the XmlDocumentationProvider the path to the Web API's documentation file.
But when I load the page, it's empty, aside from a title and a placeholder description.
Upon debugging the HelpController.Index method, I can see in the returned IApiExplorer that the _apiDescriptions are empty.
However, if I install the Help Pages directly into the Web API project and debug the same method, I can see that the _apiDescriptions are now present.
Can anyone explain what the Web API project is doing or has configured which the MVC project isn't doing or hasn't configured?
Just set this up myself, and I think I ran into a similar issue, if i'm reading what you're saying correctly.
Try the following:
Go to Areas\HelpPage\App_Start\HelpPageConfig.cs. Around line 36, you'll want to make sure you uncommented the line as below:
//// Uncomment the following to use the documentation from XML documentation file.
config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath("~/App_Data/ApiDocumentation.xml")));
And make sure the path is correct. I happened to put my xml file in the App_Data directory.
Go to Project=>Properties=>Build. Under Output, make sure the "XML documentation file" box is checked, and point it to App_Data\ApiDocumentation.XML (assuming you put it in the same place i did above.
If i remember correctly, i had to make sure i added the .xml file to the project- i had some problems when i tried publishing it to our test server at work and it said the file couldn't be found. After you build, simply go to App_Data, right click on the folder, and add existing item. navigate to App_Data in your file system and select the xml file.
This will hopefully fix your problem!
I'm not sure if this will help anyone else that stumbles across this, I had started with a blank template from VS and added the help files via the Nuget package.
Because it was a blank template and I had no areas set up, it was missing the following from the global.asax
AreaRegistration.RegisterAllAreas();
This prevented the HelpPageConfig.Register from being called and thus, the Xml Documentation provider was never set.

mvc webpage without using the default templates

I am using MVC 4.I have designed a webpage in Dreamweaver and then tried to convert it as a razor page. I wanted to view it in a browser, without using Visual Studio. I have heard that a Razor page can be edited using a notepad.
Please help, I am comfortable designing pages in Dreamweaver, than in Visual Studio.
If I understand you correctly you have a HTML design (created in whichever tool you prefer) and you wish to create an MVC website out of this. You have experience in ASP.NET Webforms.
Primarily to creating anything I would follow the topics covered in the ASP.NET MVC tutorials of MVC itself. It's not about "default templates" it's about understanding what builds your final output. Layouts, partial renderings etc...
See http://www.asp.net/mvc
PS: Ask yourself: Is MVC the right choice for my solution? (because I get the feeling everyone just wants to use MVC and doesn't think about what it is and why you should or shouldn't use it...)
If you dont't want to use default template then you can include your css files you created in Content folder. In shared folder which is located inside Views folder you can create the your customized layout which uses the css that you included in Content folder. And you can then include these layout in the views you later create inside shared folder of Views.
You can explore yourself by installing twitter.bootstrap.mvc4.sample from package manager console and see how your project changes.
This package changes your default layout to different layout, which is pretty cool.
Hope you can get idea of what is done and how you include your own layout from this above mentioned package.

How can I find where actually is the theme file?

I am new to Symfony and I need to work to a large project with many themes to modify them. How can I find where actually is the theme file in which module, just looking at the HTML browser output? Or do I need to look somewhere else, routing for example?
What you want to do is use the Web Debug Toolbar.
Once you have that running on the page, using appname_dev.php, simple click the view link and it will show you which templates have been used. If you need to know which layout to use then use logs link, click none the sfPHPView.

Resources