Is it possible to load a cshtml template?
I have a template, contacs.cshtml, plain html.
with: http://localhost/Views/contacs.cshtml i get a 404 (Server Error in '/' Application. / The resource cannot be found.).
i have set the follow things in the views/web.config:
Any template that's been created in Umbraco can be appended to any url. http://localhost/contacts means: load the homepage with the contacts template instead of the saved template.
Not really what I was hoping for, the templates are plain html, no razor.
What if i want them to load with jquery: $("#contact").load("http://localhost/views/contact.cshtml");
So the question really is: is that ultimately what you want to do or is it just an example. If you describe what you really in the end want to do it's much easier to help. :)
Sorry, but please keep it on the forum, I might not have time to answer in the next few days (very likely) and in that time someone else could help you instead.
With the Umbraco Api I want to retrieve all document types that ends with a given alias.
Here, the back end user can select with a custom property editor the document types that contains the alias. After that, I want to render every document types default template. witch can be everything, plain html, html with angular.
In the newly rendered template, i will render a next template, witch can be every allowed child's document type default template.
These templates are not used by Umbraco self, they only live there so i can link the template to a document type.
I want do this in the back-end of Umbraco 7+ with angular, so i can't use razor:
It's pretty hard to understand what you're trying to do and most of all why.
So.. you want and overview of pages with specific doctype in the backoffice of Umbraco, right? Not all of them, the editor selects the ones they want. And then you want to render the documents that they picked (still in the backoffice) with their chosen template?
It sounds like you're building some kind of live-editing option, so your editor see the page as it will look on the frontend and can change certain parts of it?
I don't exactly get the purpose of rendering every child template.
Also why are you using cshtml files if you do not want to do razor? Wouldn't it be easier just to use html files and load them in, with ngInclude for example?
So let's forget about Umbraco for a minute: what's the purpose of all this, what do you want your editors to be able to do?
As with most things on this forum; it's easier to ask "how can I do X in Umbraco" than to make all kinds of assumptions about Umbraco and try to cobble it together yourself.
It sounds like you're building some kind of live-editing option, so your editor see the page as it will look on the frontend and can change certain parts of it?
yes, that's what I want
I don't exactly get the purpose of rendering every child template.
Also why are you using cshtml files if you do not want to do razor? Wouldn't it be easier just to use html files and load them in, with ngInclude for example?
yes, that's what I want and have in mind
But now I'm looking for a way to link one or more.(cs)html files to a specific document types.
I went to use templates because they are link well to a document type.
Direct load .cshtml
Hi everyone,
Is it possible to load a cshtml template? I have a template, contacs.cshtml, plain html. with: http://localhost/Views/contacs.cshtml i get a 404 (Server Error in '/' Application. / The resource cannot be found.).
i have set the follow things in the views/web.config:
with kind regards
Jan.
Edit: a work around, not desirable
http://localhost/umbraco/surface/views/index?alias=contacs
Well
http://localhost/contacts
should work.Any template that's been created in Umbraco can be appended to any url.
http://localhost/contacts
means: load the homepage with thecontacts
template instead of the saved template.See:
http://umbraco.tv/videos/umbraco-v7/implementor/fundamentals/templating/alt-template/documentation
http://www.nibble.be/?p=42
Thank you,
But I want load the content of the template, for example inside a div.
I have chosen for templates, so I can change the content through Umbraco.
Jan.
Alright, no problem. It's best to put them in the Views/Partials folder but they can live anywhere you want, call the view using:
I think the partial view needs to start with
@inherits UmbracoTemplatePage
as the first line but I'm not entirely sure, but that's easy to test.Not really what I was hoping for, the templates are plain html, no razor. What if i want them to load with jquery: $("#contact").load("http://localhost/views/contact.cshtml");
That's just not how Razor works.. If you want to load them with jQuery you could do something like this I guess: http://stackoverflow.com/questions/9958282/how-do-i-load-html-into-a-variable-with-jquery
So the question really is: is that ultimately what you want to do or is it just an example. If you describe what you really in the end want to do it's much easier to help. :)
Can i send you a mail in dutch, my english is not that good for a long answer
I live in Denmark!
Sorry, but please keep it on the forum, I might not have time to answer in the next few days (very likely) and in that time someone else could help you instead.
I want a template link to a document type.
With the Umbraco Api I want to retrieve all document types that ends with a given alias.
Here, the back end user can select with a custom property editor the document types that contains the alias. After that, I want to render every document types default template. witch can be everything, plain html, html with angular.
In the newly rendered template, i will render a next template, witch can be every allowed child's document type default template.
These templates are not used by Umbraco self, they only live there so i can link the template to a document type.
I want do this in the back-end of Umbraco 7+ with angular, so i can't use razor:
In other words, i need to link a .(cs)html file to a document type.
It's pretty hard to understand what you're trying to do and most of all why.
So.. you want and overview of pages with specific doctype in the backoffice of Umbraco, right? Not all of them, the editor selects the ones they want. And then you want to render the documents that they picked (still in the backoffice) with their chosen template?
It sounds like you're building some kind of live-editing option, so your editor see the page as it will look on the frontend and can change certain parts of it?
I don't exactly get the purpose of rendering every child template.
Also why are you using cshtml files if you do not want to do razor? Wouldn't it be easier just to use html files and load them in, with ngInclude for example?
So let's forget about Umbraco for a minute: what's the purpose of all this, what do you want your editors to be able to do?
As with most things on this forum; it's easier to ask "how can I do X in Umbraco" than to make all kinds of assumptions about Umbraco and try to cobble it together yourself.
It sounds like you're building some kind of live-editing option, so your editor see the page as it will look on the frontend and can change certain parts of it?
yes, that's what I want
I don't exactly get the purpose of rendering every child template. Also why are you using cshtml files if you do not want to do razor? Wouldn't it be easier just to use html files and load them in, with ngInclude for example?
yes, that's what I want and have in mind
But now I'm looking for a way to link one or more.(cs)html files to a specific document types.
I went to use templates because they are link well to a document type.
is working on a reply...